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 233 of file noise.cpp.

234{
235 // since the tests below can be done bit-wise on the bottom
236 // three bits, there's no need to mask off the higher bits
237 // hash = hash & 7;
238
239 int8_t u,v;
240 if( hash & 4) {
241 u = y; v = x;
242 } else {
243 u = x; v = y;
244 }
245
246 if(hash&1) { u = -u; }
247 if(hash&2) { v = -v; }
248
249 return avg7(u,v);
250}
int y
Definition Audio.ino:72
int x
Definition Audio.ino:71
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: