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

◆ grad8() [2/3]

static int8_t grad8 ( uint8_t hash,
int8_t x,
int8_t y )
inlinestatic

Definition at line 259 of file noise.cpp.

260{
261 // since the tests below can be done bit-wise on the bottom
262 // three bits, there's no need to mask off the higher bits
263 // hash = hash & 7;
264
265 int8_t u,v;
266 if( hash & 4) {
267 u = y; v = x;
268 } else {
269 u = x; v = y;
270 }
271
272 if(hash&1) { u = -u; }
273 if(hash&2) { v = -v; }
274
275 return avg7(u,v);
276}
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:81
LIB8STATIC_ALWAYS_INLINE int8_t avg7(int8_t i, int8_t j)
Calculate an integer average of two signed 7-bit integers (int8_t).
Definition math8.h:306

References avg7(), x, and y.

+ Here is the call graph for this function: