- Micro Optimization
This commit is contained in:
@@ -461,12 +461,13 @@ constexpr genType roundEven(genType x)
|
|||||||
//bool up = r - fennec::floor(r) > e;
|
//bool up = r - fennec::floor(r) > e;
|
||||||
//return i + static_cast<genType>(up);
|
//return i + static_cast<genType>(up);
|
||||||
static const genType e = std::numeric_limits<genType>::epsilon();
|
static const genType e = std::numeric_limits<genType>::epsilon();
|
||||||
genType i = fennec::floor(x);
|
int I = static_cast<int>(x);
|
||||||
|
genType i = static_cast<genType>(I);
|
||||||
genType f = x - i;
|
genType f = x - i;
|
||||||
if (abs(f - genType(0.5)) > e)
|
if (abs(f - genType(0.5)) > e)
|
||||||
return fennec::round(x);
|
return fennec::round(x);
|
||||||
|
|
||||||
bool dir = (static_cast<int>(x) % 2);
|
bool dir = (I % 2);
|
||||||
return dir ? i + 1 : i;
|
return dir ? i + 1 : i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user