-
Notifications
You must be signed in to change notification settings - Fork 9
/
hugeint.h
47 lines (39 loc) · 1.01 KB
/
hugeint.h
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
41
42
43
44
45
46
47
/* hugeint.h implements huge integer operations at 128 bits */
/* (c) in 2014 by Frank Wille */
#ifndef HUGEINT_H
#define HUGEINT_H
#include "tfloat.h"
typedef struct thuge {
uint64_t hi,lo;
} thuge;
#define HUGEBITS 128
#define HUGESIGN(h) ((h.hi & 0x8000000000000000LL) != 0)
#define MAX_UINT64_FLOAT 1.8446744073709551616e+19
thuge huge_zero(void);
thuge huge_from_int(int64_t);
int64_t huge_to_int(thuge);
#if FLOAT_PARSER
thuge huge_from_float(tfloat);
tfloat huge_to_float(thuge);
#endif
thuge huge_from_mem(int,void *,size_t);
void *huge_to_mem(int,void *,size_t,thuge);
int huge_chkrange(thuge,int);
thuge hneg(thuge);
thuge hcpl(thuge);
thuge hnot(thuge);
thuge hand(thuge,thuge);
thuge hor(thuge,thuge);
thuge hxor(thuge,thuge);
thuge haddi(thuge,int64_t);
thuge hadd(thuge,thuge);
thuge hsub(thuge,thuge);
int hcmp(thuge,thuge);
thuge hshra(thuge,int);
thuge hshr(thuge,int);
thuge hshl(thuge,int);
thuge hmuli(thuge,int64_t);
thuge hmul(thuge,thuge);
thuge hdiv(thuge,thuge);
thuge hmod(thuge,thuge);
#endif