1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #ifdef NEED_128
25
26 # define cast_128(x) construct_128 ((uint64_t) (x).h, (x).l)
27 # define cast_s128(x) construct_s128 ((int64_t) (x).h, (x).l)
28
29 int test_math128(void);
30 bool iszero_128 (uint128 w);
31 bool isnonzero_128 (uint128 w);
32 bool iseq_128 (uint128 a, uint128 b);
33 bool isgt_128 (uint128 a, uint128 b);
34 bool islt_128 (uint128 a, uint128 b);
35 bool isge_128 (uint128 a, uint128 b);
36 bool islt_s128 (int128 a, int128 b);
37 bool isgt_s128 (int128 a, int128 b);
38 uint128 and_128 (uint128 a, uint128 b);
39 int128 and_s128 (int128 a, uint128 b);
40 uint128 or_128 (uint128 a, uint128 b);
41 uint128 xor_128 (uint128 a, uint128 b);
42 uint128 add_128 (uint128 a, uint128 b);
43 uint128 subtract_128 (uint128 a, uint128 b);
44 uint128 multiply_128 (uint128 a, uint128 b);
45 int128 multiply_s128 (int128 a, int128 b);
46 uint128 divide_128_16 (uint128 a, uint16_t b, uint16_t * rem);
47 uint128 divide_128_32 (uint128 a, uint32_t b, uint32_t * rem);
48 uint128 divide_128 (uint128 a, uint128 b, uint128 * rem);
49 uint128 complement_128 (uint128 a);
50 uint128 negate_128 (uint128 a);
51 int128 negate_s128 (int128 a);
52 uint128 lshift_128 (uint128 a, unsigned int n);
53 int128 lshift_s128 (int128 a, unsigned int n);
54 uint128 rshift_128 (uint128 a, unsigned int n);
55 int128 rshift_s128 (int128 a, unsigned int n);
56 #else
57
58 # if (__SIZEOF_LONG__ < 8) && ( !defined(__MINGW64__) || !defined(__MINGW32__) )
59
60 typedef int TItype __attribute__ ((mode (TI)));
61 typedef unsigned int UTItype __attribute__ ((mode (TI)));
62
63 typedef TItype __int128_t;
64 typedef UTItype __uint128_t;
65
66 # endif
67 #endif