equal
deleted
inserted
replaced
|
1 #include <stdio.h> |
|
2 #include <stdlib.h> |
|
3 #include <stdint.h> |
|
4 #include "sys.h" |
|
5 #include "crisutils.h" |
|
6 |
|
7 |
|
8 extern inline int64_t add64(const int64_t a, const int64_t b) { |
|
9 return a + b; |
|
10 } |
|
11 |
|
12 extern inline int64_t sub64(const int64_t a, const int64_t b) { |
|
13 return a - b; |
|
14 } |
|
15 |
|
16 int main(void) |
|
17 { |
|
18 int64_t a = 1; |
|
19 int64_t b = 2; |
|
20 |
|
21 /* FIXME: add some tests. */ |
|
22 a = add64(a, b); |
|
23 if (a != 3) |
|
24 err(); |
|
25 |
|
26 a = sub64(a, b); |
|
27 if (a != 1) |
|
28 err(); |
|
29 |
|
30 a = add64(a, -4); |
|
31 if (a != -3) |
|
32 err(); |
|
33 |
|
34 a = add64(a, 3); |
|
35 if (a != 0) |
|
36 err(); |
|
37 |
|
38 a = 0; |
|
39 a = sub64(a, 1); |
|
40 if (a != -1) |
|
41 err(); |
|
42 |
|
43 pass(); |
|
44 return 0; |
|
45 } |