21 return basetable[(i32 >> 23) & 0x1ff] + ((i32 & 0x007fffff) >>
shifttable[(i32 >> 23) & 0x1ff]);
28 uint16_t
base2 = (i32 & 0x007fffff) >> 12;
34 return basetable[(i32 >> 23) & 0x1ff] + ((i32 & 0x007fffff) >>
shifttable[(i32 >> 23) & 0x1ff]);
39 static_assert(
bits <= 23,
"max mantissa size is 23 bits");
40 constexpr uint32_t
mask = (0xFFFFFFFF >> (23 -
bits)) << (23 -
bits);
46 uint32_t
mask = (0xFFFFFFFF >> (23 -
bits)) << (23 -
bits);
59 constexpr uint32_t low23 = (0x007FFFFF);
60 constexpr uint32_t hi9 = (0xFF800000);
63 uint32_t mantissa = (i32 & low23) >>
shift;
66 i32 = (i32 & hi9) | (mantissa <<
shift);
88 template <
typename InItr,
typename OutItr>
93 inline static float max() {
94 constexpr uint32_t i32 = 0x477fe000;
102 constexpr uint32_t i32 = (0x8f << 23) - 1;
106 inline static float min() {
107 constexpr uint32_t i32 = 0x38800000;
115 constexpr uint32_t i32 = (0x71 << 23);
120 constexpr uint32_t i32 = 0x33800000;
126 return ((
h >> 10) & 0x1f) == 0 && (
h & 0x3ff) != 0;
static uint16_t float32to16crop(float x)
Fast implementation, but it crops the number so it biases low.
static float min32RoundedToMin16()
static uint16_t offsettable[64]
To bit_cast(const From &src) noexcept
static float float16to32(uint16_t h)
static uint16_t basetable[512]
static float denorm_min()
static uint8_t shifttable[512]
static uint16_t float32to16(float x)
static uint32_t mantissatable[2048]
static float reduceMantissaToNbits(const float &f, int bits)
static float reduceMantissaToNbitsRounding(float f, int bits)
static bool isdenorm(uint16_t h)
ReduceMantissaToNbitsRounding(int bits)
static float reduceMantissaToNbitsRounding(const float &f)
static float max32RoundedToMax16()
static unsigned int const shift
float operator()(float f) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
static uint16_t float32to16round(float x)
Slower implementation, but it rounds to avoid biases.
static float reduceMantissaToNbits(const float &f)
static uint32_t exponenttable[64]
static void reduceMantissaToNbitsRounding(int bits, InItr begin, InItr end, OutItr out)