FastLED 3.9.15
Loading...
Searching...
No Matches
intmap.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include "fl/namespace.h"
7#include "lib8static.h"
8#include <stdint.h>
9
11
14
24
26 return uint16_t(x) * 0x101;
27}
28
29// map16_to_8: map 16-bit values to 8-bit values
30// This function maps 16-bit values to 8-bit values.
32 // Tested to be nearly identical to double precision floating point
33 // doing this operation.
34 if (x == 0) {
35 return 0;
36 }
37 if (x >= 0xff00) {
38 return 0xff;
39 }
40 return uint8_t((x + 128) >> 8);
41}
42
44 return uint32_t(x) * 0x1010101;
45}
46
49
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
LIB8STATIC_ALWAYS_INLINE uint8_t map16_to_8(uint16_t x)
Definition intmap.h:31
LIB8STATIC_ALWAYS_INLINE uint32_t map8_to_32(uint8_t x)
Definition intmap.h:43
LIB8STATIC_ALWAYS_INLINE uint16_t map8_to_16(uint8_t x)
Definition intmap.h:25
#define LIB8STATIC_ALWAYS_INLINE
Define a LIB8TION member function as always static inline.
Definition lib8static.h:12
Defines static inlining macros for lib8tion functions.
#define FASTLED_NAMESPACE_END
Definition namespace.h:22
Implements the FastLED namespace macros.