218 {
219 const bool negative = (bits & 0x80000000u) != 0;
220 const u32 exp_bits = (bits >> 23) & 0xFFu;
221 const u32 mantissa_bits = bits & 0x007FFFFFu;
222 if (exp_bits == 0xFFu) {
223 return false;
224 }
225
226 u64 significand = mantissa_bits;
227 int exponent = -126;
228 if (exp_bits != 0) {
229 significand |= 0x00800000u;
230 exponent = static_cast<int>(exp_bits) - 127;
231 }
232
233 const int shift = exponent + frac_bits - 23;
235 if (shift >= 0) {
236 if (shift >= 63 || significand > (
u64(0x7FFFFFFFFFFFFFFF) >> shift)) {
237 return false;
238 }
239 magnitude = significand << shift;
240 } else {
242 }
243 if ((!negative && magnitude >
u64(0x7FFFFFFFFFFFFFFF)) ||
244 (negative && magnitude > (
u64(0x7FFFFFFFFFFFFFFF) + 1u))) {
245 return false;
246 }
247 *out = negative
248 ? (magnitude == (
u64(0x7FFFFFFFFFFFFFFF) + 1u)
249 ?
static_cast<i64>(0x8000000000000000ull)
250 : -
static_cast<i64>(magnitude))
251 : static_cast<
i64>(magnitude);
u32 round_shift_right_u64(u64 value, int shift) FL_NO_EXCEPT