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

◆ grad8() [1/3]

static fl::i8 grad8 ( fl::u8 hash,
fl::i8 x )
inlinestatic

Definition at line 237 of file noise.cpp.hpp.

238{
239 // since the tests below can be done bit-wise on the bottom
240 // four bits, there's no need to mask off the higher bits
241 // hash = hash & 15;
242
243 fl::i8 u,v;
244 if(hash & 8) {
245 u=x; v=x;
246 } else {
247 if(hash & 4) {
248 u=1; v=x;
249 } else {
250 u=x; v=1;
251 }
252 }
253
254 if(hash&1) { u = -u; }
255 if(hash&2) { v = -v; }
256
257 return fl::avg7(u,v);
258}
int x
Definition simple.h:92
signed char i8
Definition stdint.h:130

References x.