r4824 - trunk/varnish-cache/bin/varnishd
phk at varnish-cache.org
phk at varnish-cache.org
Wed May 19 10:18:57 CEST 2010
Author: phk
Date: 2010-05-19 10:18:57 +0200 (Wed, 19 May 2010)
New Revision: 4824
Modified:
trunk/varnish-cache/bin/varnishd/cache_dir_random.c
Log:
Use vend.h version of endian conversion.
Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2010-05-19 08:17:57 UTC (rev 4823)
+++ trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2010-05-19 08:18:57 UTC (rev 4824)
@@ -58,6 +58,7 @@
#include "cache_backend.h"
#include "vrt.h"
#include "vsha256.h"
+#include "vend.h"
/*--------------------------------------------------------------------*/
@@ -90,7 +91,7 @@
struct vbe_conn *vbe;
struct director *d2;
struct SHA256Context ctx;
- unsigned char sign[SHA256_LEN], *hp;
+ uint8_t sign[SHA256_LEN], *hp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
@@ -124,10 +125,7 @@
* amongst the healthy set.
*/
if (vs->criteria != c_random) {
- u = hp[3] << 24;
- u |= hp[2] << 16;
- u |= hp[1] << 8;
- u |= hp[0] << 0;
+ u = vle32dec(hp);
r = u / 4294967296.0;
assert(r >= 0.0 && r < 1.0);
r *= vs->tot_weight;
More information about the varnish-commit
mailing list