aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_util_format.c
diff options
context:
space:
mode:
authorovercaffeinated <overcaffeinated@airmail.cc>2016-11-03 21:18:02 +0000
committerovercaffeinated <overcaffeinated@airmail.cc>2016-11-03 21:18:02 +0000
commitdce4603d9b55a51d8894972e443b4244fd5ae962 (patch)
treea2255182a4cbbbe0b539c50da69be35acbd3c34e /src/test/test_util_format.c
parentc613446ca2fa0d81fcf1f3169a2a6caa8e7a8ba3 (diff)
downloadtor-dce4603d9b55a51d8894972e443b4244fd5ae962.tar.gz
tor-dce4603d9b55a51d8894972e443b4244fd5ae962.zip
Use tor_htonll in test_util_format_unaligned_accessors
Remove the inline htonll, switch to tor_htonll for test_util_format_unaligned_accessors.
Diffstat (limited to 'src/test/test_util_format.c')
-rw-r--r--src/test/test_util_format.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/test/test_util_format.c b/src/test/test_util_format.c
index 63a668238c..1d58ba2bf8 100644
--- a/src/test/test_util_format.c
+++ b/src/test/test_util_format.c
@@ -11,25 +11,14 @@
#define NS_MODULE util_format
-#if !defined(HAVE_HTONLL) && !defined(htonll)
-#ifdef WORDS_BIGENDIAN
-#define htonll(x) (x)
-#else
-static uint64_t
-htonll(uint64_t a)
-{
- return htonl((uint32_t)(a>>32)) | (((uint64_t)htonl((uint32_t)a))<<32);
-}
-#endif
-#endif
-
static void
test_util_format_unaligned_accessors(void *ignored)
{
(void)ignored;
char buf[9] = "onionsoup"; // 6f6e696f6e736f7570
- tt_u64_op(get_uint64(buf+1), OP_EQ, htonll(U64_LITERAL(0x6e696f6e736f7570)));
+ tt_u64_op(get_uint64(buf+1), OP_EQ,
+ tor_htonll(U64_LITERAL(0x6e696f6e736f7570)));
tt_uint_op(get_uint32(buf+1), OP_EQ, htonl(0x6e696f6e));
tt_uint_op(get_uint16(buf+1), OP_EQ, htons(0x6e69));
tt_uint_op(get_uint8(buf+1), OP_EQ, 0x6e);
@@ -43,7 +32,7 @@ test_util_format_unaligned_accessors(void *ignored)
set_uint32(buf+1, htonl(0x78696465));
tt_mem_op(buf, OP_EQ, "oxidestop", 9);
- set_uint64(buf+1, htonll(U64_LITERAL(0x6266757363617465)));
+ set_uint64(buf+1, tor_htonll(U64_LITERAL(0x6266757363617465)));
tt_mem_op(buf, OP_EQ, "obfuscate", 9);
done:
;