-
Notifications
You must be signed in to change notification settings - Fork 172
/
Copy pathcarp_int.h
67 lines (62 loc) · 1.08 KB
/
carp_int.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
int CARP_INT_MAX = INT_MAX;
int CARP_INT_MIN = INT_MIN;
int Int__PLUS_(int x, int y) {
return x + y;
}
int Int__MINUS_(int x, int y) {
return x - y;
}
int Int__MUL_(int x, int y) {
return x * y;
}
int Int__DIV_(int x, int y) {
return x / y;
}
bool Int__EQ_(int x, int y) {
return x == y;
}
bool Int__LT_(int x, int y) {
return x < y;
}
bool Int__GT_(int x, int y) {
return x > y;
}
int Int_neg(int x) {
return -x;
}
int Int_inc(int x) {
return x + 1;
}
int Int_dec(int x) {
return x - 1;
}
int Int_abs(int x) {
return x > 0 ? x : -x;
}
int Int_bit_MINUS_shift_MINUS_left(int x, int y) {
return x << y;
}
int Int_bit_MINUS_shift_MINUS_right(int x, int y) {
return x >> y;
}
int Int_bit_MINUS_and(int x, int y) {
return x & y;
}
int Int_bit_MINUS_or(int x, int y) {
return x | y;
}
int Int_bit_MINUS_xor(int x, int y) {
return x ^ y;
}
int Int_bit_MINUS_not(int x) {
return ~x;
}
int Int_copy(const int *x) {
return *x;
}
int Int_mod(int x, int divider) {
return x % divider;
}
bool Int_mask(int a, int b) {
return a & b;
}