FastLED 3.10.8
Loading...
Searching...
No Matches

◆ scale_signed()

template<typename T>
T fl::alpha16::scale_signed ( T v) const
inlineconstexpr

Scale a signed integer by this alpha (UNORM16 semantics).

result = (v * (raw + 1)) >> 16 Identity: scale_signed(x) == x when raw == 65535 Zero: scale_signed(x) == 0 when raw == 0 and |x| < 65536

Definition at line 123 of file alpha.h.

123 {
124 return static_cast<T>(
125 (static_cast<long long>(v) *
126 static_cast<long long>(static_cast<unsigned int>(value) + 1u)) >> 16);
127 }
unsigned short value
Definition alpha.h:88

References fl::FL_NO_EXCEPT, and value.