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

◆ grad8() [1/3]

static int8_t grad8 ( uint8_t hash,
int8_t x )
inlinestatic

Definition at line 252 of file noise.cpp.

253{
254 // since the tests below can be done bit-wise on the bottom
255 // four bits, there's no need to mask off the higher bits
256 // hash = hash & 15;
257
258 int8_t u,v;
259 if(hash & 8) {
260 u=x; v=x;
261 } else {
262 if(hash & 4) {
263 u=1; v=x;
264 } else {
265 u=x; v=1;
266 }
267 }
268
269 if(hash&1) { u = -u; }
270 if(hash&2) { v = -v; }
271
272 return avg7(u,v);
273}
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(), and x.

+ Here is the call graph for this function: