162 {
163 if (magnitude == 0) {
165 }
166
168 int exponent = top_bit + binary_exp;
169 if (exponent > 127) {
170 return sign | 0x7F800000u;
171 }
172
173 if (exponent >= -126) {
174 const int shift = top_bit - 23;
175 u32 significand = 0;
176 if (shift > 0) {
178 } else {
179 significand = static_cast<u32>(magnitude << -shift);
180 }
181 if (significand >= 0x01000000u) {
182 significand >>= 1;
183 ++exponent;
184 if (exponent > 127) {
185 return sign | 0x7F800000u;
186 }
187 }
188 return sign | (
static_cast<u32
>(exponent + 127) << 23) |
189 (significand & 0x007FFFFFu);
190 }
191
192 const int subnormal_shift = -(binary_exp + 149);
193 u32 mantissa = 0;
194 if (subnormal_shift > 0) {
196 } else {
197 const int left_shift = -subnormal_shift;
198 if (left_shift >= 64 || magnitude > (
u64(-1) >> left_shift)) {
199 return sign | 0x7F800000u;
200 }
201 const u64 shifted = magnitude << left_shift;
202 mantissa = shifted > 0x007FFFFFu ? 0x00800000u : static_cast<u32>(shifted);
203 }
204 if (mantissa >= 0x00800000u) {
205 return sign | 0x00800000u;
206 }
u32 round_shift_right_u64(u64 value, int shift) FL_NO_EXCEPT
int json_floor_log2_u64(u64 value) FL_NO_EXCEPT
constexpr enable_if< is_fixed_point< T >::value, int >::type sign(T x) FL_NO_EXCEPT