AC_MSG_RESULT([$have_htoll])
AM_CONDITIONAL([BUILD_BYTEORDER],[test "x$have_htoll" == "xno"])
- if test "x$have_htoll" == "xno"
- then
- AC_MSG_CHECKING([byteorder])
- have_htoll="no"
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([
+ AC_MSG_CHECKING([byteorder])
+ have_htoll="no"
+ AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([
#include <sys/types.h>
#include <netinet/in.h>
#include <inttypes.h>
- ], [
+ ], [
if (htonl(5) != 5) {
return 1;
}
- ])
- ], [
- AC_MSG_RESULT([big endian])
- AC_DEFINE([BYTEORDER_BIG_ENDIAN], [1], [Enable big endian byteorder])
- ], AC_MSG_RESULT([little endian]))
- fi
+ ])
+ ], [
+ AC_MSG_RESULT([big endian])
+ AC_DEFINE([BYTEORDER_BIG_ENDIAN], [1], [Enable big endian byteorder])
+ ], [
+ AC_MSG_RESULT([little endian])
+ AC_DEFINE([BYTEORDER_LITTLE_ENDIAN], [1], [Enable little endian byteorder])
+ ])
])
DETECT_BYTEORDER
a = b = c = 0xdeadbeef + ((uint32_t)length) + initval;
u.ptr = key;
+#ifdef BYTEORDER_LITTLE_ENDIAN
if ((u.i & 0x3) == 0)
{
const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */
}
else
{ /* need to read the key one byte at a time */
+#endif /* little endian */
const uint8_t *k = (const uint8_t *)key;
/*--------------- all but the last block: affect some 32 bits of (a,b,c) */
break;
case 0 : return c;
}
+#ifdef BYTEORDER_LITTLE_ENDIAN
}
+#endif
final(a,b,c);
return c;