r4442 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Fri Jan 8 19:26:09 CET 2010
Author: phk
Date: 2010-01-08 19:26:09 +0100 (Fri, 08 Jan 2010)
New Revision: 4442
Modified:
trunk/varnish-cache/bin/varnishd/cache_dir_random.c
Log:
Be hash-endianess-agnostic for the benefit of varnishtest on BE archs.
Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2010-01-08 17:13:10 UTC (rev 4441)
+++ trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2010-01-08 18:26:09 UTC (rev 4442)
@@ -97,7 +97,10 @@
* amongst the good set.
*/
if (vs->use_hash) {
- memcpy(&u, sp->digest, sizeof u);
+ u = sp->digest[3] << 24;
+ u |= sp->digest[2] << 16;
+ u |= sp->digest[1] << 8;
+ u |= sp->digest[0] << 0;
r = u / 4294967296.0;
r *= vs->tot_weight;
s1 = 0.0;
@@ -130,7 +133,10 @@
return (NULL);
if (vs->use_hash) {
- memcpy(&u, sp->digest, sizeof u);
+ u = sp->digest[3] << 24;
+ u |= sp->digest[2] << 16;
+ u |= sp->digest[1] << 8;
+ u |= sp->digest[0] << 0;
r = u / 4294967296.0;
} else {
/* Pick a random threshold in that interval */
More information about the varnish-commit
mailing list