r4822 - trunk/varnish-cache/lib/libvarnish
phk at varnish-cache.org
phk at varnish-cache.org
Wed May 19 10:17:21 CEST 2010
Author: phk
Date: 2010-05-19 10:17:21 +0200 (Wed, 19 May 2010)
New Revision: 4822
Modified:
trunk/varnish-cache/lib/libvarnish/vsha256.c
Log:
Use vend.h version of endian macros.
Modified: trunk/varnish-cache/lib/libvarnish/vsha256.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/vsha256.c 2010-05-19 08:16:49 UTC (rev 4821)
+++ trunk/varnish-cache/lib/libvarnish/vsha256.c 2010-05-19 08:17:21 UTC (rev 4822)
@@ -47,27 +47,8 @@
#include "libvarnish.h"
#include "vsha256.h"
+#include "vend.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 */
@@ -80,14 +61,6 @@
#else /* BYTE_ORDER != BIG_ENDIAN or in doubt... */
-static inline uint32_t
-mybe32dec(const void *pp)
-{
- unsigned char const *p = (unsigned char const *)pp;
-
- return (((unsigned)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
-}
-
/*
* 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.
@@ -98,7 +71,7 @@
size_t i;
for (i = 0; i < len / 4; i++)
- mybe32enc(dst + i * 4, src[i]);
+ vbe32enc(dst + i * 4, src[i]);
}
/*
@@ -111,7 +84,7 @@
size_t i;
for (i = 0; i < len / 4; i++)
- dst[i] = mybe32dec(src + i * 4);
+ dst[i] = vbe32dec(src + i * 4);
}
#endif
@@ -251,7 +224,7 @@
* -- we do this now rather than later because the length
* will change after we pad.
*/
- mybe64enc(len, ctx->count << 3);
+ vbe64enc(len, ctx->count << 3);
/* Add 1--64 bytes so that the resulting length is 56 mod 64 */
r = ctx->count & 0x3f;
More information about the varnish-commit
mailing list