-
Notifications
You must be signed in to change notification settings - Fork 178
/
carp_byte.h
68 lines (61 loc) · 1.26 KB
/
carp_byte.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
68
typedef uint8_t byte;
uint8_t Byte__PLUS_(uint8_t x, uint8_t y) {
return x + y;
}
uint8_t Byte__MINUS_(uint8_t x, uint8_t y) {
return x - y;
}
uint8_t Byte__MUL_(uint8_t x, uint8_t y) {
return x * y;
}
uint8_t Byte__DIV_(uint8_t x, uint8_t y) {
return x / y;
}
bool Byte__EQ_(uint8_t x, uint8_t y) {
return x == y;
}
bool Byte__LT_(uint8_t x, uint8_t y) {
return x < y;
}
bool Byte__GT_(uint8_t x, uint8_t y) {
return x > y;
}
uint8_t Byte_inc(uint8_t x) {
return x + 1;
}
uint8_t Byte_dec(uint8_t x) {
return x - 1;
}
uint8_t Byte_bit_MINUS_shift_MINUS_left(uint8_t x, uint8_t y) {
return x << y;
}
uint8_t Byte_bit_MINUS_shift_MINUS_right(uint8_t x, uint8_t y) {
return x >> y;
}
uint8_t Byte_bit_MINUS_and(uint8_t x, uint8_t y) {
return x & y;
}
uint8_t Byte_bit_MINUS_or(uint8_t x, uint8_t y) {
return x | y;
}
uint8_t Byte_bit_MINUS_xor(uint8_t x, uint8_t y) {
return x ^ y;
}
uint8_t Byte_bit_MINUS_not(uint8_t x) {
return ~x;
}
uint8_t Byte_copy(const uint8_t *x) {
return *x;
}
uint8_t Byte_mod(uint8_t x, uint8_t divider) {
return x % divider;
}
bool Byte_mask(uint8_t a, uint8_t b) {
return a & b;
}
int Byte_to_MINUS_int(uint8_t a) {
return a;
}
uint8_t Byte_from_MINUS_int(int a) {
return a;
}