FastLED 3.9.15
Loading...
Searching...
No Matches

◆ operator/() [1/2]

FASTLED_FORCE_INLINE u0x32 fl::u0x32::operator/ ( u0x32 b) const
inline

Definition at line 105 of file u0x32.h.

105 {
106 // UQ32 / UQ32: shift dividend left 32 bits then divide
107 // (a / 2^32) / (b / 2^32) = a / b → need (a << 32) / b
108 if (b.mValue == 0) return from_raw(0xFFFFFFFFU); // Division by zero, return max
109 u64 result = (static_cast<u64>(mValue) << 32) / b.mValue;
110 if (result > 0xFFFFFFFFULL) return from_raw(0xFFFFFFFFU); // Overflow, saturate to max
111 return from_raw(static_cast<u32>(result));
112 }
static constexpr FASTLED_FORCE_INLINE u0x32 from_raw(u32 raw) FL_NOEXCEPT
Definition u0x32.h:66
u32 mValue
Definition u0x32.h:163
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31
fl::u64 u64
Definition s16x16x4.h:221

References u0x32(), FASTLED_FORCE_INLINE, FL_NOEXCEPT, from_raw(), and mValue.

+ Here is the call graph for this function: