aboutsummaryrefslogtreecommitdiff
path: root/tests/testutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testutil.c')
-rw-r--r--tests/testutil.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/testutil.c b/tests/testutil.c
index ef748b99..1c65c996 100644
--- a/tests/testutil.c
+++ b/tests/testutil.c
@@ -123,6 +123,18 @@ testutil_htons(uint16_t in)
return (in);
}
+uint32_t
+testutil_htonl(uint32_t in)
+{
+#ifdef NNG_LITTLE_ENDIAN
+ in = ((in >> 24u) & 0xffu) |
+ ((in >> 8u) & 0xff00u) |
+ ((in << 8u) & 0xff0000u) |
+ ((in << 24u) & 0xff000000u);
+#endif
+ return (in);
+}
+
// testutil_next_port returns a "next" allocation port.
// Ports are chosen by starting from a random point within a
// range (normally 38000-40000, but other good places to choose