]> err.no Git - varnish/commitdiff
Try to get the endianess optimization working, by including an assortment
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 25 Nov 2008 12:02:10 +0000 (12:02 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 25 Nov 2008 12:02:10 +0000 (12:02 +0000)
of possibly relevant headers and only go with the fast path if we have
credible information that this is a big-endian platform.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3439 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/configure.ac
varnish-cache/lib/libvarnish/vsha256.c

index b32f64bdfbac8029a7d1ee7eb54630399acfe6ba..853a6fc6da8eab2233d47f65d32d74a1dfba582c 100644 (file)
@@ -70,11 +70,13 @@ AC_SUBST(LIBM)
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_HEADER_TIME
+AC_CHECK_HEADERS([sys/endian.h])
 AC_CHECK_HEADERS([sys/filio.h])
 AC_CHECK_HEADERS([sys/mount.h])
 AC_CHECK_HEADERS([sys/socket.h])
 AC_CHECK_HEADERS([sys/statvfs.h])
 AC_CHECK_HEADERS([sys/vfs.h])
+AC_CHECK_HEADERS([endian.h])
 AC_CHECK_HEADERS([netinet/in.h])
 AC_CHECK_HEADERS([pthread_np.h])
 AC_CHECK_HEADERS([stddef.h])
index 99d5f28144cc5c8bfec184d7edceaa6b1bcbff1f..72bd21427adc1b36b53cbaa8e71b50e38bac9bcc 100644 (file)
  * From: $FreeBSD: head/lib/libmd/sha256c.c 154479 2006-01-17 15:35:57Z phk $
  */
 
-#include <stdint.h>
+#include "config.h"
 
+#include <stdint.h>
 #include <string.h>
 
+#ifdef HAVE_ENDIAN_H
+#include <endian.h>
+#define BYTE_ORDER     __BYTE_ORDER
+#define BIG_ENDIAN     __BIG_ENDIAN
+#endif
+#ifdef HAVE_SYS_ENDIAN_H
+#include <sys/endian.h>
+#define BYTE_ORDER     _BYTE_ORDER
+#define BIG_ENDIAN     _BIG_ENDIAN
+#endif
+
 #include "vsha256.h"
 
 #if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN