2004-05-31 02:36:47 +00:00
|
|
|
#include "test.h"
|
|
|
|
|
2004-08-06 16:42:41 +00:00
|
|
|
/* Test store/load macros with offsets */
|
2004-05-31 02:36:47 +00:00
|
|
|
int store_test(void)
|
|
|
|
{
|
2004-08-06 16:42:41 +00:00
|
|
|
unsigned char buf[24];
|
|
|
|
unsigned long L, L1;
|
|
|
|
int y;
|
|
|
|
ulong64 LL, LL1;
|
2004-05-31 02:36:47 +00:00
|
|
|
|
|
|
|
L = 0x12345678UL;
|
2004-08-06 16:42:41 +00:00
|
|
|
for (y = 0; y < 4; y++) {
|
|
|
|
STORE32L(L, buf + y);
|
|
|
|
LOAD32L(L1, buf + y);
|
|
|
|
if (L1 != L) {
|
|
|
|
fprintf(stderr, "\n32L failed at offset %d\n", y);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
STORE32H(L, buf + y);
|
|
|
|
LOAD32H(L1, buf + y);
|
|
|
|
if (L1 != L) {
|
|
|
|
fprintf(stderr, "\n32H failed at offset %d\n", y);
|
|
|
|
return 1;
|
|
|
|
}
|
2004-05-31 02:36:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LL = CONST64 (0x01020304050607);
|
2004-08-06 16:42:41 +00:00
|
|
|
for (y = 0; y < 8; y++) {
|
|
|
|
STORE64L(LL, buf + y);
|
|
|
|
LOAD64L(LL1, buf + y);
|
|
|
|
if (LL1 != LL) {
|
|
|
|
fprintf(stderr, "\n64L failed at offset %d\n", y);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
STORE64H(LL, buf + y);
|
|
|
|
LOAD64H(LL1, buf + y);
|
|
|
|
if (LL1 != LL) {
|
|
|
|
fprintf(stderr, "\n64H failed at offset %d\n", y);
|
|
|
|
return 1;
|
|
|
|
}
|
2004-05-31 02:36:47 +00:00
|
|
|
}
|
2004-08-06 16:42:41 +00:00
|
|
|
|
2004-05-31 02:36:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|