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

◆ operator()() [9/15]

void fl::int_conversion_visitor< i64 >::operator() ( const float & value)
inline

Definition at line 295 of file types.h.

295 {
296 // AUTO CONVERT FLOAT TO INT. Route through int32 first to avoid the
297 // direct (i64)float cast — libgcc's `__aeabi_f2lz` helper internally
298 // chains through `_fixunssfdi.o` which anchors `__aeabi_dmul/dsub`
299 // (soft-double helpers, ~6 KB on no-FPU targets). See FastLED #3002.
300 // The variant only ever holds float (not double — see line 652), so
301 // JSON numbers fitting in int32 cover every value the parser
302 // currently emits; larger magnitudes saturate.
303 if (value > static_cast<float>(2147483647)) {
304 result = static_cast<i64>(2147483647);
305 } else if (value < static_cast<float>(-2147483648.0f)) {
306 result = static_cast<i64>(-2147483648LL);
307 } else {
308 result = static_cast<i64>(static_cast<fl::i32>(value));
309 }
310 }
fl::optional< i64 > result
Definition types.h:279

References fl::FL_NO_EXCEPT, result, and fl::type_rank< T >::value.