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
13typedef struct {
14 float key;
15 float value;
17
18typedef struct {
19 const lut_entry_t *entries;
20 size_t size;
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
32float lut_lookup(const lerp_lut_t *lut, float key);
33
34#endif // LERP_LUT_H
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
Definition lerp_lut.h:18
Definition lerp_lut.h:13