PER Firmware
Loading...
Searching...
No Matches
lerp_lut.h
Go to the documentation of this file.
1
#ifndef LERP_LUT_H
2
#define LERP_LUT_H
3
11
#include <stddef.h>
12
13
typedef
struct
{
14
float
key;
15
float
value;
16
}
lut_entry_t
;
17
18
typedef
struct
{
19
const
lut_entry_t
*entries;
20
size_t
size;
21
}
lerp_lut_t
;
22
23
#define LERP_LUT_INIT(name, _entries, _size) \
24
const lerp_lut_t name = { \
25
.entries = _entries, \
26
.size = _size, \
27
}; \
28
static_assert(sizeof(_entries) / sizeof(lut_entry_t) == _size, \
29
"Entries array size must match _size"); \
30
static_assert(_size > 1, "LUT size must be greater than 1")
31
32
float
lut_lookup
(
const
lerp_lut_t
*lut,
float
key);
33
34
#endif
// LERP_LUT_H
lut_lookup
float lut_lookup(const lerp_lut_t *lut, float key)
Lookup a value in a linear interpolation lookup table (LUT).
Definition
lerp_lut.c:20
lerp_lut_t
Definition
lerp_lut.h:18
lut_entry_t
Definition
lerp_lut.h:13
common
lerp_lut
lerp_lut.h
Generated by
1.12.0