diff options
Diffstat (limited to 'include/byte_math.h')
-rw-r--r-- | include/byte_math.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/byte_math.h b/include/byte_math.h new file mode 100644 index 0000000..79f93b8 --- /dev/null +++ b/include/byte_math.h @@ -0,0 +1,15 @@ +#pragma once + +#include <stdint.h> + +/* Library for doing fast math functions using just uint8_t. */ + +extern uint8_t sintable[256]; + +/* Returns ((sin(n) + 1) / 2) * 255 */ +static inline uint8_t byte_sin(uint8_t n) +{ + return sintable[n]; +} + +uint8_t calc_w(uint8_t n); |