FastLED 3.9.15
Loading...
Searching...
No Matches

◆ operator()() [9/15]

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

Definition at line 264 of file types.h.

264 {
265 // AUTO CONVERT FLOAT TO INT. Route through int32 first to avoid the
266 // direct (i64)float cast — libgcc's `__aeabi_f2lz` helper internally
267 // chains through `_fixunssfdi.o` which anchors `__aeabi_dmul/dsub`
268 // (soft-double helpers, ~6 KB on no-FPU targets). See FastLED #3002.
269 // The variant only ever holds float (not double — see line 652), so
270 // JSON numbers fitting in int32 cover every value the parser
271 // currently emits; larger magnitudes saturate.
272 if (value > static_cast<float>(2147483647)) {
273 result = static_cast<i64>(2147483647);
274 } else if (value < static_cast<float>(-2147483648.0f)) {
275 result = static_cast<i64>(-2147483648LL);
276 } else {
277 result = static_cast<i64>(static_cast<fl::i32>(value));
278 }
279 }
fl::optional< i64 > result
Definition types.h:248

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