mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 12:42:34 +01:00
Cleanup.
This commit is contained in:
@@ -84,7 +84,7 @@ namespace bx
|
||||
constexpr float kFloatLargest = 3.402823466e+38f;
|
||||
|
||||
///
|
||||
extern const float kFloatInfinity;
|
||||
// constexpr float kFloatInfinity;
|
||||
|
||||
///
|
||||
constexpr uint8_t kDoubleSignNumBits = 1;
|
||||
@@ -104,8 +104,8 @@ namespace bx
|
||||
/// Largest representable double-precision floating-point number.
|
||||
constexpr double kDoubleLargest = 1.7976931348623158e+308;
|
||||
|
||||
///
|
||||
extern const double kDoubleInfinity;
|
||||
//
|
||||
// constexpr double kDoubleInfinity;
|
||||
|
||||
} // namespace bx
|
||||
|
||||
|
||||
@@ -176,4 +176,7 @@ namespace bx
|
||||
return to;
|
||||
}
|
||||
|
||||
constexpr float kFloatInfinity = bitCast<float>(kFloatExponentMask);
|
||||
constexpr double kDoubleInfinity = bitCast<double>(kDoubleExponentMask);
|
||||
|
||||
} // namespace bx
|
||||
|
||||
@@ -24,28 +24,24 @@ namespace bx
|
||||
return _rad * 180.0f / kPi;
|
||||
}
|
||||
|
||||
inline BX_CONST_FUNC uint32_t floatToBits(float _a)
|
||||
inline BX_CONSTEXPR_FUNC uint32_t floatToBits(float _a)
|
||||
{
|
||||
union { float f; uint32_t ui; } u = { _a };
|
||||
return u.ui;
|
||||
return bitCast<uint32_t>(_a);
|
||||
}
|
||||
|
||||
inline BX_CONST_FUNC float bitsToFloat(uint32_t _a)
|
||||
inline BX_CONSTEXPR_FUNC float bitsToFloat(uint32_t _a)
|
||||
{
|
||||
union { uint32_t ui; float f; } u = { _a };
|
||||
return u.f;
|
||||
return bitCast<float>(_a);
|
||||
}
|
||||
|
||||
inline BX_CONST_FUNC uint64_t doubleToBits(double _a)
|
||||
inline BX_CONSTEXPR_FUNC uint64_t doubleToBits(double _a)
|
||||
{
|
||||
union { double f; uint64_t ui; } u = { _a };
|
||||
return u.ui;
|
||||
return bitCast<uint64_t>(_a);
|
||||
}
|
||||
|
||||
inline BX_CONST_FUNC double bitsToDouble(uint64_t _a)
|
||||
inline BX_CONSTEXPR_FUNC double bitsToDouble(uint64_t _a)
|
||||
{
|
||||
union { uint64_t ui; double f; } u = { _a };
|
||||
return u.f;
|
||||
return bitCast<double>(_a);
|
||||
}
|
||||
|
||||
inline BX_CONST_FUNC uint32_t floatFlip(uint32_t _value)
|
||||
|
||||
@@ -108,19 +108,19 @@ namespace bx
|
||||
|
||||
/// Reinterprets the bit pattern of _a as uint32_t.
|
||||
///
|
||||
BX_CONST_FUNC uint32_t floatToBits(float _a);
|
||||
BX_CONSTEXPR_FUNC uint32_t floatToBits(float _a);
|
||||
|
||||
/// Reinterprets the bit pattern of _a as float.
|
||||
///
|
||||
BX_CONST_FUNC float bitsToFloat(uint32_t _a);
|
||||
BX_CONSTEXPR_FUNC float bitsToFloat(uint32_t _a);
|
||||
|
||||
/// Reinterprets the bit pattern of _a as uint64_t.
|
||||
///
|
||||
BX_CONST_FUNC uint64_t doubleToBits(double _a);
|
||||
BX_CONSTEXPR_FUNC uint64_t doubleToBits(double _a);
|
||||
|
||||
/// Reinterprets the bit pattern of _a as double.
|
||||
///
|
||||
BX_CONST_FUNC double bitsToDouble(uint64_t _a);
|
||||
BX_CONSTEXPR_FUNC double bitsToDouble(uint64_t _a);
|
||||
|
||||
/// Returns sortable floating point value.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user