FastLED 3.9.7
Loading...
Searching...
No Matches
Integer Mapping Functions

Detailed Description

Maps a scalar from one integer size to another.

For example, a value representing 40% as an 8-bit unsigned integer would be 102 / 255. Using map8_to_16(uint8_t) to convert that to a 16-bit unsigned integer would give you 26,214 / 65,535, exactly 40% through the larger range.

Functions

LIB8STATIC_ALWAYS_INLINE uint16_t map8_to_16 (uint8_t x)
 
LIB8STATIC_ALWAYS_INLINE uint8_t map16_to_8 (uint16_t x)
 
LIB8STATIC_ALWAYS_INLINE uint32_t map8_to_32 (uint8_t x)
 

Function Documentation

◆ map16_to_8()

LIB8STATIC_ALWAYS_INLINE uint8_t map16_to_8 ( uint16_t x)

Definition at line 31 of file intmap.h.

◆ map8_to_16()

LIB8STATIC_ALWAYS_INLINE uint16_t map8_to_16 ( uint8_t x)

Definition at line 25 of file intmap.h.

◆ map8_to_32()

LIB8STATIC_ALWAYS_INLINE uint32_t map8_to_32 ( uint8_t x)

Definition at line 43 of file intmap.h.