-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsintable.h
More file actions
22 lines (18 loc) · 769 Bytes
/
sintable.h
File metadata and controls
22 lines (18 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#if !defined SINTABLE_H
#define SINTABLE_H
#include <stdint.h>
#define SINTABLE_PHYSICAL_SIZE 65536
extern const int16_t SINTABLE_PHYSICAL[SINTABLE_PHYSICAL_SIZE];
#define SINTABLE_SIZE (SINTABLE_PHYSICAL_SIZE * 4)
static int16_t sintable(unsigned int index) __attribute__((__unused__));
static int16_t sintable(unsigned int index) {
if (index < SINTABLE_PHYSICAL_SIZE)
return SINTABLE_PHYSICAL[index];
else if (index < 2 * SINTABLE_PHYSICAL_SIZE)
return SINTABLE_PHYSICAL[SINTABLE_PHYSICAL_SIZE - (index - SINTABLE_PHYSICAL_SIZE) - 1];
else if (index < 3 * SINTABLE_PHYSICAL_SIZE)
return -SINTABLE_PHYSICAL[index - 2 * SINTABLE_PHYSICAL_SIZE];
else
return -SINTABLE_PHYSICAL[SINTABLE_PHYSICAL_SIZE - (index - 3 * SINTABLE_PHYSICAL_SIZE) - 1];
}
#endif