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

◆ hashFFTArgs()

fl::size fl::audio::Context::hashFFTArgs ( const fft::Args & args)
staticprivate

Definition at line 7 of file audio_context.cpp.hpp.

7 {
8 // Create a hash from fft::Args for O(1) cache lookup
9 // Use simple hash combining of the integer fields
10 fl::size hash = 0;
11 hash = (hash * 31) ^ static_cast<fl::size>(args.samples);
12 hash = (hash * 31) ^ static_cast<fl::size>(args.bands);
13 hash = (hash * 31) ^ static_cast<fl::size>(args.sample_rate);
14
15 // For floats, use bit representation via memcpy (safer than reinterpret_cast)
16 u32 fmin_bits, fmax_bits;
17 fl::memcpy(&fmin_bits, &args.fmin, sizeof(fmin_bits));
18 fl::memcpy(&fmax_bits, &args.fmax, sizeof(fmax_bits));
19 hash = (hash * 31) ^ static_cast<fl::size>(fmin_bits);
20 hash = (hash * 31) ^ static_cast<fl::size>(fmax_bits);
21 hash = (hash * 31) ^ static_cast<fl::size>(args.mode);
22 return hash;
23}
void * memcpy(void *dest, const void *src, size_t n) FL_NOEXCEPT
corkscrew_args args
Definition old.h:149

References args, and fl::memcpy().

Referenced by getFFT().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: