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

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

+ Here is the call graph for this function: