summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorShahid <shahid@us.ibm.com>2019-02-02 00:43:08 +0530
committerGitHub <noreply@github.com>2019-02-02 00:43:08 +0530
commitafaa22eb3d5a5b80d7a0a4909df789d25a7b4783 (patch)
tree03169d6ce64258eedc50fd799020f42f380ba07a /tests
parentc7870e0f77d6331babfdb89f8c83e4e0279b5e70 (diff)
Update test_varint.c
Diffstat (limited to 'tests')
-rw-r--r--tests/pb/test_varint.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/pb/test_varint.c b/tests/pb/test_varint.c
index f77eebd..7b2fe41 100644
--- a/tests/pb/test_varint.c
+++ b/tests/pb/test_varint.c
@@ -20,6 +20,25 @@ static void test_varint_for_num(upb_decoderet (*decoder)(const char*),
memset(buf2, 0, sizeof(buf2));
memcpy(&buf2, &encoded, 8);
+#ifdef UPB_BIG_ENDIAN
+ char swap[8];
+ swap[0] = buf2[7];
+ swap[1] = buf2[6];
+ swap[2] = buf2[5];
+ swap[3] = buf2[4];
+ swap[4] = buf2[3];
+ swap[5] = buf2[2];
+ swap[6] = buf2[1];
+ swap[7] = buf2[0];
+ buf2[0] = swap[0];
+ buf2[1] = swap[1];
+ buf2[2] = swap[2];
+ buf2[3] = swap[3];
+ buf2[4] = swap[4];
+ buf2[5] = swap[5];
+ buf2[6] = swap[6];
+ buf2[7] = swap[7];
+#endif
r = decoder(buf2);
ASSERT(r.val == num);
ASSERT(r.p == buf2 + upb_value_size(encoded));
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback