r3439 - in trunk/varnish-cache: . lib/libvarnish

phk at projects.linpro.no phk at projects.linpro.no
Tue Nov 25 13:02:10 CET 2008


Author: phk
Date: 2008-11-25 13:02:10 +0100 (Tue, 25 Nov 2008)
New Revision: 3439

Modified:
   trunk/varnish-cache/configure.ac
   trunk/varnish-cache/lib/libvarnish/vsha256.c
Log:
Try to get the endianess optimization working, by including an assortment
of possibly relevant headers and only go with the fast path if we have
credible information that this is a big-endian platform.



Modified: trunk/varnish-cache/configure.ac
===================================================================
--- trunk/varnish-cache/configure.ac	2008-11-25 11:45:59 UTC (rev 3438)
+++ trunk/varnish-cache/configure.ac	2008-11-25 12:02:10 UTC (rev 3439)
@@ -70,11 +70,13 @@
 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])

Modified: trunk/varnish-cache/lib/libvarnish/vsha256.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/vsha256.c	2008-11-25 11:45:59 UTC (rev 3438)
+++ trunk/varnish-cache/lib/libvarnish/vsha256.c	2008-11-25 12:02:10 UTC (rev 3439)
@@ -26,10 +26,22 @@
  * From: $FreeBSD: head/lib/libmd/sha256c.c 154479 2006-01-17 15:35:57Z phk $
  */
 
+#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



More information about the varnish-commit mailing list