diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2019-03-14 09:53:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-14 09:53:29 -0700 |
commit | 9cd426495e9ce11e8896a576601fab97052276c4 (patch) | |
tree | 21ceb38f639c8e96fd11d180b5985b478a263072 /tests/pb/test_varint.c | |
parent | ed9faae0993704b033c594b072d65e1bf19207fa (diff) | |
parent | 17db3722678f2ea11edbe2aeb34efdbce030c07f (diff) |
Merge pull request #151 from linux-on-ibm-z/master
Adding support for big endian platform (s390x)
Diffstat (limited to 'tests/pb/test_varint.c')
-rw-r--r-- | tests/pb/test_varint.c | 19 |
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)); |