MCPcopy Create free account
hub / github.com/FastLED/FastLED / scale16by8_nozero

Function scale16by8_nozero

src/fl/gfx/five_bit_hd_gamma.cpp.hpp:30–32  ·  view source on GitHub ↗

Branchless scale16by8: (i * (1 + scale)) >> 8. Eliminates the if(scale==0) branch from the standard scale16by8. The caller is responsible for skipping the call when scale==0.

Source from the content-addressed store, hash-verified

28// Eliminates the if(scale==0) branch from the standard scale16by8.
29// The caller is responsible for skipping the call when scale==0.
30FL_ALWAYS_INLINE u16 scale16by8_nozero(u16 i, u16 scale_plus_one) {
31 return static_cast<u16>((static_cast<u32>(i) * scale_plus_one) >> 8);
32}
33
34// Core per-pixel transform, fully inlined. All uniform values are
35// precomputed by the caller and passed in to avoid per-pixel branches.

Callers 2

five_bit_pixelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected