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

279{
280 // since the tests below can be done bit-wise on the bottom
281 // four bits, there's no need to mask off the higher bits
282 // hash = hash & 15;
283
284 int8_t u,v;
285 if(hash & 8) {
286 u=x; v=x;
287 } else {
288 if(hash & 4) {
289 u=1; v=x;
290 } else {
291 u=x; v=1;
292 }
293 }
294
295 if(hash&1) { u = -u; }
296 if(hash&2) { v = -v; }
297
298 return avg7(u,v);
299}
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
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: