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

◆ grad_i16()

FASTLED_FORCE_INLINE fl::i32 fl::perlin_i16_optimized::grad_i16 ( int hash,
fl::i16 x,
fl::i16 y )
staticprivate

Definition at line 89 of file perlin_i16_optimized.cpp.hpp.

89 {
90 struct GradCoeff { fl::i8 cx; fl::i8 cy; };
91 constexpr GradCoeff lut[16] = {
92 { 1, 1}, {-1, 1}, { 1, -1}, {-1, -1},
93 { 1, 0}, {-1, 0}, { 1, 0}, {-1, 0},
94 { 0, 1}, { 0, -1}, { 0, 1}, { 0, -1},
95 { 1, 1}, { 0, -1}, {-1, 1}, { 0, -1},
96 };
97 const GradCoeff &g = lut[hash & 15];
98 // i8 × i16 → i32 (safe, result in range ±65535)
99 return static_cast<fl::i32>(g.cx * x) + static_cast<fl::i32>(g.cy * y);
100}
InputGamut g
Definition rgbw.h:125
signed char i8
Definition stdint.h:130

References FASTLED_FORCE_INLINE, fl::FL_NO_EXCEPT, fl::g, fl::x, and fl::y.

Referenced by pnoise2d_raw().

+ Here is the caller graph for this function: