aboutsummaryrefslogtreecommitdiffstats
path: root/executor/test.h
diff options
context:
space:
mode:
authorAlexander Egorenkov <Alexander.Egorenkov@ibm.com>2020-07-04 13:54:43 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-07-10 10:25:58 +0200
commit56d01184e3b69688dec04bd97a3017df9462f4fc (patch)
tree791934110ceb23e2e45aae0b76242c240003b3f4 /executor/test.h
parentedf162e8c360dd578d20a86c4ad79b54747a2d64 (diff)
executor: fix bitfields for big-endian arch
Add bitfield tests for big-endian arch Issue: #1885 Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
Diffstat (limited to 'executor/test.h')
-rw-r--r--executor/test.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/executor/test.h b/executor/test.h
index 0d3587b84..cec0228e2 100644
--- a/executor/test.h
+++ b/executor/test.h
@@ -14,7 +14,7 @@ static int test_copyin()
if (x[0] != 0 || x[1] != 0 ||
x[2] != 0x34 || x[3] != 0x12 ||
x[4] != 0 || x[5] != 0) {
- printf("bad result of STORE_BY_BITMASK(0, 0): %x %x %x %x %x %x\n",
+ printf("bad result of STORE_BY_BITMASK(le16, 0x1234, 0, 16): %x %x %x %x %x %x\n",
x[0], x[1], x[2], x[3], x[4], x[5]);
return 1;
}
@@ -23,7 +23,16 @@ static int test_copyin()
if (x[0] != 0 || x[1] != 0 ||
x[2] != 0x54 || x[3] != 0x13 ||
x[4] != 0 || x[5] != 0) {
- printf("bad result of STORE_BY_BITMASK(7, 3): %x %x %x %x %x %x\n",
+ printf("bad result of STORE_BY_BITMASK(le16, 0x555a, 5, 4): %x %x %x %x %x %x\n",
+ x[0], x[1], x[2], x[3], x[4], x[5]);
+ return 1;
+ }
+ STORE_BY_BITMASK(uint16, htobe16, &buf[1], 0x4567, 13, 3);
+ memcpy(x, buf, sizeof(x));
+ if (x[0] != 0 || x[1] != 0 ||
+ x[2] != 0xf4 || x[3] != 0x13 ||
+ x[4] != 0 || x[5] != 0) {
+ printf("bad result of STORE_BY_BITMASK(be16, 0x4567, 13, 3): %x %x %x %x %x %x\n",
x[0], x[1], x[2], x[3], x[4], x[5]);
return 1;
}