Commit 3f11e60c authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Be hash-endianess-agnostic for the benefit of varnishtest on BE archs.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4442 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 9aed2f91
......@@ -97,7 +97,10 @@ vdi_random_getfd(const struct director *d, struct sess *sp)
* 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 @@ vdi_random_getfd(const struct director *d, struct sess *sp)
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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment