mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Cleanup.
This commit is contained in:
@@ -227,6 +227,20 @@ namespace bx
|
||||
return log(_a) * kInvLogNat2;
|
||||
}
|
||||
|
||||
inline BX_CONSTEXPR_FUNC float ldexp(float _a, int32_t _b)
|
||||
{
|
||||
const uint32_t ftob = floatToBits(_a);
|
||||
const uint32_t masked = uint32_and(ftob, kFloatSignMask | kFloatExponentMask);
|
||||
const uint32_t expsign0 = uint32_sra(masked, kFloatExponentBitShift);
|
||||
const uint32_t tmp = uint32_iadd(expsign0, _b);
|
||||
const uint32_t expsign1 = uint32_sll(tmp, kFloatExponentBitShift);
|
||||
const uint32_t mantissa = uint32_and(ftob, kFloatMantissaMask);
|
||||
const uint32_t bits = uint32_or(mantissa, expsign1);
|
||||
const float result = bitsToFloat(bits);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline BX_CONSTEXPR_FUNC uint8_t countBits(uint32_t _val)
|
||||
{
|
||||
|
||||
@@ -254,9 +254,9 @@ namespace bx
|
||||
///
|
||||
BX_CONST_FUNC float pow(float _a, float _b);
|
||||
|
||||
/// Returns the result of multiplying _a by 2 raised to the power of the exponent.
|
||||
/// Returns the result of multiplying _a by 2 raised to the power of the exponent `_a * (2^_b)`.
|
||||
///
|
||||
BX_CONST_FUNC float ldexp(float _a, int32_t _b);
|
||||
BX_CONSTEXPR_FUNC float ldexp(float _a, int32_t _b);
|
||||
|
||||
/// Returns decomposed given floating point value _a into a normalized fraction and
|
||||
/// an integral power of two.
|
||||
|
||||
Reference in New Issue
Block a user