FastLED 3.9.15
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 88 of file perlin_i16_optimized.cpp.hpp.

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

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

Referenced by pnoise2d_raw().

+ Here is the caller graph for this function: