r3564 - trunk/varnish-cache/lib/libvarnish
tfheen at projects.linpro.no
tfheen at projects.linpro.no
Fri Jan 30 15:40:32 CET 2009
Author: tfheen
Date: 2009-01-30 15:40:32 +0100 (Fri, 30 Jan 2009)
New Revision: 3564
Modified:
trunk/varnish-cache/lib/libvarnish/vsha256.c
Log:
Move mybe{32,64}enc definitions outside of ifdef so we work on 64 bit BE platforms too.
Modified: trunk/varnish-cache/lib/libvarnish/vsha256.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/vsha256.c 2009-01-28 15:09:40 UTC (rev 3563)
+++ trunk/varnish-cache/lib/libvarnish/vsha256.c 2009-01-30 14:40:32 UTC (rev 3564)
@@ -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