From eb328da56c3fc7167b536dcb206df0abb0f4a9b9 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 13 Nov 2020 22:31:18 -0800 Subject: fixes #1087 CMakeLists structural improvements desired This doesn't modularize all the tests yet, but it goes a long way in the right direction. --- tests/stubs.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tests/stubs.h') 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); } -- cgit v1.2.3-70-g09d2