summaryrefslogtreecommitdiff
path: root/demo/float16.h
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2023-11-21 22:21:37 -0600
committerAlejandro Soto <alejandro@34project.org>2023-11-21 22:21:41 -0600
commit3f5ec7003075eb78e7e2a7b179cbcd3a6c9e294d (patch)
tree45e5aeb39b02198e92eab7ed5a167289d31a02aa /demo/float16.h
parentb943b9970564be0e4e8782b0f748912339e1009a (diff)
demo: implement float16 support
Diffstat (limited to 'demo/float16.h')
-rw-r--r--demo/float16.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/demo/float16.h b/demo/float16.h
new file mode 100644
index 0000000..17cb1d0
--- /dev/null
+++ b/demo/float16.h
@@ -0,0 +1,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