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

Function float_to_fixed

src/fl/math/wave/wave_simulation_real.cpp.hpp:19–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17// i16 float_to_fixed(float f) { return (i16)(f * FIXED_SCALE); }
18
19i16 float_to_fixed(float f) {
20 f = fl::clamp(f, -1.0f, 1.0f);
21 if (f < 0.0f) {
22 return (i16)(f * INT16_NEG);
23 } else {
24 return (i16)(f * INT16_POS); // Round to nearest
25 }
26}
27
28// Convert fixed Q15 to float.
29float fixed_to_float(i16 f) {

Callers 7

setfMethod · 0.85
compute_damp_decay_q15Function · 0.85
WaveSimulation1D_RealMethod · 0.85
setSpeedMethod · 0.85
setMethod · 0.85
WaveSimulation2D_RealMethod · 0.85
setfMethod · 0.85

Calls 1

clampFunction · 0.85

Tested by

no test coverage detected