aboutsummaryrefslogtreecommitdiff
path: root/tests/stubs.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-11-13 22:31:18 -0800
committerGarrett D'Amore <garrett@damore.org>2020-11-14 21:31:43 -0800
commiteb328da56c3fc7167b536dcb206df0abb0f4a9b9 (patch)
treec92e3dd3db6a0f1b0efc6a027e7e4db6442068f0 /tests/stubs.h
parent7c1ff5ed1e48af413494b9070cccf79f3858b749 (diff)
downloadnng-eb328da56c3fc7167b536dcb206df0abb0f4a9b9.tar.gz
nng-eb328da56c3fc7167b536dcb206df0abb0f4a9b9.tar.bz2
nng-eb328da56c3fc7167b536dcb206df0abb0f4a9b9.zip
fixes #1087 CMakeLists structural improvements desired
This doesn't modularize all the tests yet, but it goes a long way in the right direction.
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);
}