8#define FASTLED_INTERNAL
16#define RAND16_SEED 1337
43void *
memset8 (
void * ptr, uint8_t val, uint16_t num )
46 " movw r26, %[ptr] \n\t"
47 " sbrs %A[num], 0 \n\t"
48 " rjmp Lseteven_%= \n\t"
49 " rjmp Lsetodd_%= \n\t"
55 " subi %A[num], 2 \n\t"
56 " brcc Lsetloop_%= \n\t"
57 " sbci %B[num], 0 \n\t"
58 " brcc Lsetloop_%= \n\t"
70void *
memcpy8 (
void * dst,
const void* src, uint16_t num )
73 " movw r30, %[src] \n\t"
74 " movw r26, %[dst] \n\t"
75 " sbrs %A[num], 0 \n\t"
76 " rjmp Lcpyeven_%= \n\t"
77 " rjmp Lcpyodd_%= \n\t"
79 " ld __tmp_reg__, Z+ \n\t"
80 " st X+, __tmp_reg__ \n\t"
82 " ld __tmp_reg__, Z+ \n\t"
83 " st X+, __tmp_reg__ \n\t"
85 " subi %A[num], 2 \n\t"
86 " brcc Lcpyloop_%= \n\t"
87 " sbci %B[num], 0 \n\t"
88 " brcc Lcpyloop_%= \n\t"
98void *
memmove8 (
void * dst,
const void* src, uint16_t num )
102 return memcpy8( dst, src, num);
105 dst = (
char*)dst + num;
106 src = (
char*)src + num;
108 " movw r30, %[src] \n\t"
109 " movw r26, %[dst] \n\t"
110 " sbrs %A[num], 0 \n\t"
111 " rjmp Lmoveven_%= \n\t"
112 " rjmp Lmovodd_%= \n\t"
114 " ld __tmp_reg__, -Z \n\t"
115 " st -X, __tmp_reg__ \n\t"
117 " ld __tmp_reg__, -Z \n\t"
118 " st -X, __tmp_reg__ \n\t"
120 " subi %A[num], 2 \n\t"
121 " brcc Lmovloop_%= \n\t"
122 " sbci %B[num], 0 \n\t"
123 " brcc Lmovloop_%= \n\t"
146void test1abs( int8_t i)
148 Serial.print(
"abs("); Serial.print(i); Serial.print(
") = ");
150 Serial.print(j); Serial.println(
" ");
156 for( int8_t q = -128; q != 127; ++q) {
168 Serial.println(
"mul8:");
169 for( r = 0; r <= 20; r += 1) {
170 Serial.print(r); Serial.print(
" : ");
171 for( c = 0; c <= 20; c += 1) {
174 Serial.print(t); Serial.print(
' ');
178 Serial.println(
"done.");
188 Serial.println(
"scale8:");
189 for( r = 0; r <= 240; r += 10) {
190 Serial.print(r); Serial.print(
" : ");
191 for( c = 0; c <= 240; c += 10) {
194 Serial.print(t); Serial.print(
' ');
200 Serial.println(
"scale8_video:");
202 for( r = 0; r <= 100; r += 4) {
203 Serial.print(r); Serial.print(
" : ");
204 for( c = 0; c <= 100; c += 4) {
207 Serial.print(t); Serial.print(
' ');
212 Serial.println(
"done.");
222 for( r = 0; r <= 240; r += 10) {
223 Serial.print(r); Serial.print(
" : ");
224 for( c = 0; c <= 240; c += 10) {
227 Serial.print(t); Serial.print(
' ');
231 Serial.println(
"done.");
239 for(
byte z = 0; z < 10; ++z) {
242 Serial.print(
"nscale8x3_video( ");
243 Serial.print(r); Serial.print(
", ");
244 Serial.print(g); Serial.print(
", ");
245 Serial.print(b); Serial.print(
", ");
246 Serial.print(sc); Serial.print(
") = [ ");
250 Serial.print(r); Serial.print(
", ");
251 Serial.print(g); Serial.print(
", ");
252 Serial.print(b); Serial.print(
"]");
256 Serial.println(
"done.");
central include file for FastLED, defines the CFastLED class/object
void * memcpy8(void *dst, const void *src, uint16_t num)
Faster alternative to memcpy() on AVR.
void * memset8(void *ptr, uint8_t value, uint16_t num)
Faster alternative to memset() on AVR.
void * memmove8(void *dst, const void *src, uint16_t num)
Faster alternative to memmove() on AVR.
LIB8STATIC_ALWAYS_INLINE uint8_t qadd8(uint8_t i, uint8_t j)
Add one byte to another, saturating at 0xFF.
LIB8STATIC_ALWAYS_INLINE int8_t abs8(int8_t i)
Take the absolute value of a signed 8-bit uint8_t.
LIB8STATIC_ALWAYS_INLINE uint8_t mul8(uint8_t i, uint8_t j)
8x8 bit multiplication, with 8-bit result.
LIB8STATIC uint8_t random8()
Generate an 8-bit random number.
uint16_t rand16seed
Seed for the random number generator functions.
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_video(uint8_t i, fract8 scale)
The "video" version of scale8() guarantees that the output will be only be zero if one or both of the...
LIB8STATIC void nscale8x3_video(uint8_t &r, uint8_t &g, uint8_t &b, fract8 scale)
Scale three one-byte values by a fourth one, which is treated as the numerator of a fraction whose de...
LIB8STATIC_ALWAYS_INLINE uint8_t scale8(uint8_t i, fract8 scale)
Scale one byte by a second one, which is treated as the numerator of a fraction whose denominator is ...
#define RAND16_SEED
Seed for the random number generator functions.
Fast, efficient 8-bit math functions specifically designed for high-performance LED programming.