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

Function pow_fp

src/fl/gfx/gamma_lut.h:161–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159// ---- Fixed-point pow: base^exp via exp2(exp * log2(base)) ----
160
161constexpr u32 pow_fp(u32 base_raw, u32 exp_raw) FL_NOEXCEPT {
162 return base_raw == 0 ? 0
163 : exp_raw == 0 ? SCALE
164 : base_raw == SCALE ? SCALE
165 : exp2_fp(static_cast<i32>(
166 (static_cast<i64>(exp_raw) *
167 static_cast<i64>(log2_fp(base_raw))) >> FRAC
168 ));
169}
170
171// ---- 8-bit gamma correction for a single pixel value ----
172// Computes: clamp(round(pow(x/255, gamma) * 255), 0, 255)

Callers 2

evalFunction · 0.85
eval16Function · 0.85

Calls 2

exp2_fpFunction · 0.85
log2_fpFunction · 0.85

Tested by

no test coverage detected