-
Notifications
You must be signed in to change notification settings - Fork 10
/
ofixed.oh
36 lines (29 loc) · 1.33 KB
/
ofixed.oh
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
#ifndef OFIXED_OH
#define OFIXED_OH
#include "fixed.h"
#include "obig.oh"
#if BIT_WIDTH_32
typedef obliv fixed_t ofixed_t;
#else
typedef obig ofixed_t;
#endif
// comparison only works for unsigned numbers for now
obliv int8_t ofixed_cmp(ofixed_t a, ofixed_t b) obliv;
void ofixed_abs(ofixed_t *out, ofixed_t in) obliv;
void ofixed_add(ofixed_t *out, ofixed_t a, ofixed_t b) obliv;
void ofixed_sub(ofixed_t *out, ofixed_t a, ofixed_t b) obliv;
void ofixed_mul(ofixed_t *out, ofixed_t a, ofixed_t b, size_t p) obliv;
void ofixed_inner_product(ofixed_t *out, ofixed_t *a, ofixed_t *b, size_t p, size_t d) obliv;
obliv bool ofixed_div(ofixed_t *out, ofixed_t a, ofixed_t b, size_t p) obliv;
obliv bool ofixed_div_overflow(ofixed_t *out, ofixed_t a, ofixed_t b, size_t p) obliv;
void ofixed_sqrt(ofixed_t *out, ofixed_t a, size_t p) obliv;
bool ofixed_ln(ofixed_t *out, size_t * outp, ofixed_t a, size_t p) obliv;
obliv bool ofixed_exp(ofixed_t *out, size_t * outp, ofixed_t a, size_t p) obliv;
obliv bool ofixed_sigmoid(obig * r, size_t * rp, obig x, size_t xp) obliv;
// these functions do nothing in 32 bit mode, but are needed for obig
void ofixed_init(ofixed_t *out);
void ofixed_free(ofixed_t *out);
void ofixed_import(ofixed_t *out, obliv fixed_t a);
fixed_t ofixed_export(ofixed_t a);
void ofixed_copy(ofixed_t *out, ofixed_t a) obliv;
#endif