summaryrefslogtreecommitdiff
path: root/demo/float16.h
blob: 17cb1d0ec20d25c90a2bbfd850571cff1e5d97ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// https://github.com/artyom-beilis/float16/tree/master/include

#ifndef FLOAT16_H
#define FLOAT16_H

#include <stdint-gcc.h>

#define f16_tenth   11878
#define f16_fifth   12902
#define f16_third   13653
#define f16_half    14336
#define f16_one     15360
#define f16_two     16384
#define f16_three   16896
#define f16_five    17664
#define f16_ten     18688
#define f16_pi      16968
#define f16_half_pi 15944

short f16_add(short a,short b);
short f16_sub(short a,short b);
short f16_mul(short a,short b);
short f16_div(short a,short b);
short f16_neg(short a);
short f16_from_int(int32_t v);
int32_t f16_int(short v);

int f16_gte(short a,short b);
int f16_gt(short a,short b);
int f16_eq(short a,short b);
int f16_lte(short a,short b);
int f16_lt(short a,short b);
int f16_neq(short a,short b);

extern const struct f16_sin_cos
{
	short cos, sin;
} f16_sin_cos[256];

#endif