diff --git a/src/common/fp/info.h b/src/common/fp/info.h index d60c4a31..d3cb436c 100644 --- a/src/common/fp/info.h +++ b/src/common/fp/info.h @@ -65,10 +65,21 @@ struct FPInfo { static constexpr int exponent_max = 127; static constexpr int exponent_bias = 127; - static constexpr u32 Zero(bool sign) { return sign ? sign_mask : 0; } - static constexpr u32 Infinity(bool sign) { return exponent_mask | Zero(sign); } - static constexpr u32 MaxNormal(bool sign) { return (exponent_mask - 1) | Zero(sign); } - static constexpr u32 DefaultNaN() { return exponent_mask | (u32(1) << (explicit_mantissa_width - 1)); } + static constexpr u32 Zero(bool sign) { + return sign ? sign_mask : 0; + } + + static constexpr u32 Infinity(bool sign) { + return exponent_mask | Zero(sign); + } + + static constexpr u32 MaxNormal(bool sign) { + return (exponent_mask - 1) | Zero(sign); + } + + static constexpr u32 DefaultNaN() { + return exponent_mask | (u32(1) << (explicit_mantissa_width - 1)); + } }; template<> @@ -88,10 +99,21 @@ struct FPInfo { static constexpr int exponent_max = 1023; static constexpr int exponent_bias = 1023; - static constexpr u64 Zero(bool sign) { return sign ? sign_mask : 0; } - static constexpr u64 Infinity(bool sign) { return exponent_mask | Zero(sign); } - static constexpr u64 MaxNormal(bool sign) { return (exponent_mask - 1) | Zero(sign); } - static constexpr u64 DefaultNaN() { return exponent_mask | (u64(1) << (explicit_mantissa_width - 1)); } + static constexpr u64 Zero(bool sign) { + return sign ? sign_mask : 0; + } + + static constexpr u64 Infinity(bool sign) { + return exponent_mask | Zero(sign); + } + + static constexpr u64 MaxNormal(bool sign) { + return (exponent_mask - 1) | Zero(sign); + } + + static constexpr u64 DefaultNaN() { + return exponent_mask | (u64(1) << (explicit_mantissa_width - 1)); + } }; /// value = (sign ? -1 : +1) * 2^exponent * value