comparison demos/test/store_test.c @ 15:6362d3854bb4 libtomcrypt-orig

0.96 release of LibTomCrypt
author Matt Johnston <matt@ucc.asn.au>
date Tue, 15 Jun 2004 14:07:21 +0000
parents
children 5d99163f7e32
comparison
equal deleted inserted replaced
3:7faae8f46238 15:6362d3854bb4
1 #include "test.h"
2
3 int store_test(void)
4 {
5 unsigned char buf[8];
6 unsigned long L;
7 ulong64 LL;
8
9 L = 0x12345678UL;
10 STORE32L (L, &buf[0]);
11 L = 0;
12 LOAD32L (L, &buf[0]);
13 if (L != 0x12345678UL) {
14 printf ("LOAD/STORE32 Little don't work");
15 return 1;
16 }
17 LL = CONST64 (0x01020304050607);
18 STORE64L (LL, &buf[0]);
19 LL = 0;
20 LOAD64L (LL, &buf[0])
21 if (LL != CONST64 (0x01020304050607)) {
22 printf ("LOAD/STORE64 Little don't work");
23 return 1;
24 }
25
26 L = 0x12345678UL;
27 STORE32H (L, &buf[0]);
28 L = 0;
29 LOAD32H (L, &buf[0]);
30 if (L != 0x12345678UL) {
31 printf ("LOAD/STORE32 High don't work, %08lx", L);
32 return 1;
33 }
34 LL = CONST64 (0x01020304050607);
35 STORE64H (LL, &buf[0]);
36 LL = 0;
37 LOAD64H (LL, &buf[0])
38 if (LL != CONST64 (0x01020304050607)) {
39 printf ("LOAD/STORE64 High don't work");
40 return 1;
41 }
42 return 0;
43 }