aboutsummaryrefslogtreecommitdiff
path: root/include/byte_math.h
blob: 79f93b83cce9d7e3436f0eeb44c0ebf13e0375fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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);