aboutsummaryrefslogtreecommitdiff
path: root/tests/stubs.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stubs.h')
-rw-r--r--tests/stubs.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/stubs.h b/tests/stubs.h
index 56193cb3..8b230705 100644
--- a/tests/stubs.h
+++ b/tests/stubs.h
@@ -84,9 +84,10 @@ fdready(int fd)
uint16_t
test_htons(uint16_t in)
{
-#ifdef NNG_LITTLE_ENDIAN
- in = ((in >> 8) & 0xff) | ((in & 0xff) << 8);
-#endif
+ short one = 1;
+ if (*((char *)(void *)&one) == 1) {
+ in = ((in / 256) + ((in % 256) * 256));
+ }
return (in);
}