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

214{
215 // since the tests below can be done bit-wise on the bottom
216 // three bits, there's no need to mask off the higher bits
217 // hash = hash & 7;
218
219 int8_t u,v;
220 if( hash & 4) {
221 u = y; v = x;
222 } else {
223 u = x; v = y;
224 }
225
226 if(hash&1) { u = -u; }
227 if(hash&2) { v = -v; }
228
229 return avg7(u,v);
230}
int y
Definition simple.h:93
int x
Definition simple.h:92
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:322

References avg7(), x, and y.

+ Here is the call graph for this function: