mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Fixed bx::sign function to return tri-state result.
This commit is contained in:
@@ -135,7 +135,7 @@ namespace bx
|
||||
|
||||
inline BX_CONSTEXPR_FUNC float sign(float _a)
|
||||
{
|
||||
return _a < 0.0f ? -1.0f : 1.0f;
|
||||
return (0.0f < _a) - (0.0f > _a);
|
||||
}
|
||||
|
||||
inline BX_CONSTEXPR_FUNC float abs(float _a)
|
||||
|
||||
@@ -205,7 +205,11 @@ namespace bx
|
||||
///
|
||||
BX_CONSTEXPR_FUNC float invLerp(float _a, float _b, float _value);
|
||||
|
||||
/// Returns the sign of _a.
|
||||
/// Extracts the sign of value `_a`.
|
||||
///
|
||||
/// @param[in] _a Value.
|
||||
///
|
||||
/// @returns -1 if `_a` less than zero, 0 if `_a` is equal to 0, or +1 if `_a` is greater than zero.
|
||||
///
|
||||
BX_CONSTEXPR_FUNC float sign(float _a);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user