Utility header to linearly map values from one range to another.
More...
Go to the source code of this file.
|
| #define | RESCALE(input, input_min, input_max, output_min, output_max) |
| |
|
| static float | rescale_float (float input, float input_min, float input_max, float output_min, float output_max) |
| |
| static signed int | rescale_signed (signed int input, signed int input_min, signed int input_max, signed int output_min, signed int output_max) |
| |
| static unsigned int | rescale_unsigned (unsigned int input, unsigned int input_min, unsigned int input_max, unsigned int output_min, unsigned int output_max) |
| |
Utility header to linearly map values from one range to another.
Typesafe, supporting ints and floats. Integer promotions also cover int8_t, uint8_t, int16_t, uint16_t
- Author
- Irving Wang (irvin.nosp@m.gw@p.nosp@m.urdue.nosp@m..edu)
◆ RESCALE
| #define RESCALE |
( |
| input, |
|
|
| input_min, |
|
|
| input_max, |
|
|
| output_min, |
|
|
| output_max ) |
Value: _Generic((input) + (input_min) + (input_max) + (output_min) + (output_max), \
)(input, input_min, input_max, output_min, output_max)
static signed int rescale_signed(signed int input, signed int input_min, signed int input_max, signed int output_min, signed int output_max)
Definition rescale.h:34
static unsigned int rescale_unsigned(unsigned int input, unsigned int input_min, unsigned int input_max, unsigned int output_min, unsigned int output_max)
Definition rescale.h:53
static float rescale_float(float input, float input_min, float input_max, float output_min, float output_max)
Definition rescale.h:15
◆ rescale_float()
| static float rescale_float |
( |
float | input, |
|
|
float | input_min, |
|
|
float | input_max, |
|
|
float | output_min, |
|
|
float | output_max ) |
|
inlinestatic |
◆ rescale_signed()
| static signed int rescale_signed |
( |
signed int | input, |
|
|
signed int | input_min, |
|
|
signed int | input_max, |
|
|
signed int | output_min, |
|
|
signed int | output_max ) |
|
inlinestatic |
◆ rescale_unsigned()
| static unsigned int rescale_unsigned |
( |
unsigned int | input, |
|
|
unsigned int | input_min, |
|
|
unsigned int | input_max, |
|
|
unsigned int | output_min, |
|
|
unsigned int | output_max ) |
|
inlinestatic |