diff --git a/src/common/fp/info.h b/src/common/fp/info.h index a56baa2d..357fd0c3 100644 --- a/src/common/fp/info.h +++ b/src/common/fp/info.h @@ -14,6 +14,29 @@ namespace Dynarmic::FP { template struct FPInfo {}; +template<> +struct FPInfo { + static constexpr size_t total_width = 16; + static constexpr size_t exponent_width = 5; + static constexpr size_t explicit_mantissa_width = 10; + static constexpr size_t mantissa_width = explicit_mantissa_width + 1; + + static constexpr u32 implicit_leading_bit = u32(1) << explicit_mantissa_width; + static constexpr u32 sign_mask = 0x8000; + static constexpr u32 exponent_mask = 0x7C00; + static constexpr u32 mantissa_mask = 0x3FF; + static constexpr u32 mantissa_msb = 0x200; + + static constexpr int exponent_min = -14; + static constexpr int exponent_max = 15; + static constexpr int exponent_bias = 15; + + 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<> struct FPInfo { static constexpr size_t total_width = 32;