r3639 - in branches/2.0/varnish-cache: . lib/libvarnish

tfheen at projects.linpro.no tfheen at projects.linpro.no
Fri Feb 6 10:55:39 CET 2009


Author: tfheen
Date: 2009-02-06 10:55:39 +0100 (Fri, 06 Feb 2009)
New Revision: 3639

Modified:
   branches/2.0/varnish-cache/configure.ac
   branches/2.0/varnish-cache/lib/libvarnish/vsha256.c
Log:
Merge r3439: Endianness optimisation

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: branches/2.0/varnish-cache/configure.ac
===================================================================
--- branches/2.0/varnish-cache/configure.ac	2009-02-06 09:51:51 UTC (rev 3638)
+++ branches/2.0/varnish-cache/configure.ac	2009-02-06 09:55:39 UTC (rev 3639)
@@ -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: branches/2.0/varnish-cache/lib/libvarnish/vsha256.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvarnish/vsha256.c	2009-02-06 09:51:51 UTC (rev 3638)
+++ branches/2.0/varnish-cache/lib/libvarnish/vsha256.c	2009-02-06 09:55:39 UTC (rev 3639)
@@ -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