15
|
1 #include "test.h" |
|
2 |
143
|
3 /* Test store/load macros with offsets */ |
15
|
4 int store_test(void) |
|
5 { |
143
|
6 unsigned char buf[24]; |
|
7 unsigned long L, L1; |
|
8 int y; |
|
9 ulong64 LL, LL1; |
15
|
10 |
|
11 L = 0x12345678UL; |
143
|
12 for (y = 0; y < 4; y++) { |
|
13 STORE32L(L, buf + y); |
|
14 LOAD32L(L1, buf + y); |
|
15 if (L1 != L) { |
|
16 fprintf(stderr, "\n32L failed at offset %d\n", y); |
|
17 return 1; |
|
18 } |
|
19 STORE32H(L, buf + y); |
|
20 LOAD32H(L1, buf + y); |
|
21 if (L1 != L) { |
|
22 fprintf(stderr, "\n32H failed at offset %d\n", y); |
|
23 return 1; |
|
24 } |
15
|
25 } |
|
26 |
143
|
27 LL = CONST64 (0x01020304050607); |
|
28 for (y = 0; y < 8; y++) { |
|
29 STORE64L(LL, buf + y); |
|
30 LOAD64L(LL1, buf + y); |
|
31 if (LL1 != LL) { |
|
32 fprintf(stderr, "\n64L failed at offset %d\n", y); |
|
33 return 1; |
|
34 } |
|
35 STORE64H(LL, buf + y); |
|
36 LOAD64H(LL1, buf + y); |
|
37 if (LL1 != LL) { |
|
38 fprintf(stderr, "\n64H failed at offset %d\n", y); |
|
39 return 1; |
|
40 } |
15
|
41 } |
143
|
42 |
15
|
43 return 0; |
|
44 } |