mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-18 13:03:06 +01:00
Fixed issue with frexp.
This commit is contained in:
15
src/math.cpp
15
src/math.cpp
@@ -10,6 +10,21 @@
|
||||
|
||||
namespace bx
|
||||
{
|
||||
float frexp(float _a, int32_t* _outExp)
|
||||
{
|
||||
const uint32_t ftob = floatToBits(_a);
|
||||
const uint32_t masked0 = uint32_and(ftob, kFloatExponentMask);
|
||||
const uint32_t exp0 = uint32_srl(masked0, kFloatExponentBitShift);
|
||||
|
||||
const uint32_t masked1 = uint32_and(ftob, kFloatSignMask | kFloatMantissaMask);
|
||||
const uint32_t bits = uint32_or(masked1, UINT32_C(0x3f000000) );
|
||||
const float result = bitsToFloat(bits);
|
||||
|
||||
*_outExp = int32_t(exp0 - 0x7e);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void mtxLookAt(float* _result, const Vec3& _eye, const Vec3& _at, const Vec3& _up, Handedness::Enum _handedness)
|
||||
{
|
||||
const Vec3 view = normalize(
|
||||
|
||||
Reference in New Issue
Block a user