r3733 - branches/2.0/varnish-cache/lib/libvarnish

tfheen at projects.linpro.no tfheen at projects.linpro.no
Wed Feb 11 08:17:45 CET 2009


Author: tfheen
Date: 2009-02-11 08:17:45 +0100 (Wed, 11 Feb 2009)
New Revision: 3733

Modified:
   branches/2.0/varnish-cache/lib/libvarnish/vsha256.c
Log:
Merge r3564: Move mybe{32,64}enc definitions outside of ifdef so we work on 64 bit BE platforms too.



Modified: branches/2.0/varnish-cache/lib/libvarnish/vsha256.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvarnish/vsha256.c	2009-02-11 07:13:12 UTC (rev 3732)
+++ branches/2.0/varnish-cache/lib/libvarnish/vsha256.c	2009-02-11 07:17:45 UTC (rev 3733)
@@ -45,6 +45,26 @@
 #include "libvarnish.h"
 #include "vsha256.h"
 
+static __inline void
+mybe32enc(void *pp, uint32_t u)
+{
+        unsigned char *p = (unsigned char *)pp;
+
+        p[0] = (u >> 24) & 0xff;
+        p[1] = (u >> 16) & 0xff;
+        p[2] = (u >> 8) & 0xff;
+        p[3] = u & 0xff;
+}
+
+static __inline void
+mybe64enc(void *pp, uint64_t u)
+{
+	unsigned char *p = (unsigned char *)pp;
+
+	mybe32enc(p, u >> 32);
+	mybe32enc(p + 4, u & 0xffffffff);
+}
+
 #if defined(VBYTE_ORDER) && VBYTE_ORDER == VBIG_ENDIAN
 
 /* Copy a vector of big-endian uint32_t into a vector of bytes */
@@ -65,26 +85,6 @@
         return (((unsigned)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
 }
 
-static __inline void
-mybe32enc(void *pp, uint32_t u)
-{
-        unsigned char *p = (unsigned char *)pp;
-
-        p[0] = (u >> 24) & 0xff;
-        p[1] = (u >> 16) & 0xff;
-        p[2] = (u >> 8) & 0xff;
-        p[3] = u & 0xff;
-}
-
-static __inline void
-mybe64enc(void *pp, uint64_t u)
-{
-	unsigned char *p = (unsigned char *)pp;
-
-	mybe32enc(p, u >> 32);
-	mybe32enc(p + 4, u & 0xffffffff);
-}
-
 /*
  * Encode a length len/4 vector of (uint32_t) into a length len vector of
  * (unsigned char) in big-endian form.  Assumes len is a multiple of 4.



More information about the varnish-commit mailing list