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

Function hb_step

src/fl/gfx/gamma_lut.h:62–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60// ---- Highest-bit finder (constexpr recursive) ----
61
62constexpr int hb_step(u32 v, int r) FL_NOEXCEPT {
63 return (v & 0xFFFF0000u) ? hb_step(v >> 16, r + 16)
64 : (v & 0x0000FF00u) ? hb_step(v >> 8, r + 8)
65 : (v & 0x000000F0u) ? hb_step(v >> 4, r + 4)
66 : (v & 0x0000000Cu) ? hb_step(v >> 2, r + 2)
67 : (v & 0x00000002u) ? r + 1
68 : r;
69}
70
71constexpr int highest_bit(u32 v) FL_NOEXCEPT {
72 return v == 0 ? -1 : hb_step(v, 0);

Callers 1

highest_bitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected