FastLED 3.10.6
Loading...
Searching...
No Matches

◆ soft_round_shift_right_u64()

u32 fl::detail::soft_round_shift_right_u64 ( u64 value,
int shift )
inline

Definition at line 58 of file soft_float.h.

58 {
59 if (shift <= 0) {
60 return static_cast<u32>(value);
61 }
62 if (shift >= 64) {
63 return 0;
64 }
65 const u64 half = u64(1) << (shift - 1);
66 const u64 mask = (u64(1) << shift) - 1;
67 const u64 truncated = value >> shift;
68 const u64 remainder = value & mask;
69 const bool round_up = remainder > half || (remainder == half && (truncated & 1));
70 return static_cast<u32>(truncated + (round_up ? 1 : 0));
71}
constexpr int type_rank< T >::value
fl::u64 u64
Definition stdint.h:220

References fl::FL_NO_EXCEPT, and fl::type_rank< T >::value.

Referenced by json_round_shift_right_u64(), and soft_float_bits_from_scaled_u64().

+ Here is the caller graph for this function: