Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
ab7a91ed
Commit
ab7a91ed
authored
Nov 01, 2011
by
Poul-Henning Kamp
Committed by
Tollef Fog Heen
Mar 06, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use scalbn(3) rather than exp2(3), it should be faster and more portable.
Fixes #1046
parent
29d126fd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
cache_dir_random.c
bin/varnishd/cache_dir_random.c
+3
-3
No files found.
bin/varnishd/cache_dir_random.c
View file @
ab7a91ed
...
@@ -97,7 +97,7 @@ vdi_random_sha(const char *input, ssize_t len)
...
@@ -97,7 +97,7 @@ vdi_random_sha(const char *input, ssize_t len)
SHA256_Init
(
&
ctx
);
SHA256_Init
(
&
ctx
);
SHA256_Update
(
&
ctx
,
input
,
len
);
SHA256_Update
(
&
ctx
,
input
,
len
);
SHA256_Final
(
sign
,
&
ctx
);
SHA256_Final
(
sign
,
&
ctx
);
return
(
vle32dec
(
sign
)
/
exp2
(
32
));
return
(
scalbn
(
vle32dec
(
sign
),
-
32
));
}
}
/*
/*
...
@@ -119,11 +119,11 @@ vdi_random_init_seed(const struct vdi_random *vs, const struct sess *sp)
...
@@ -119,11 +119,11 @@ vdi_random_init_seed(const struct vdi_random *vs, const struct sess *sp)
break
;
break
;
case
c_hash
:
case
c_hash
:
AN
(
sp
->
digest
);
AN
(
sp
->
digest
);
retval
=
vle32dec
(
sp
->
digest
)
/
exp2
(
32
);
retval
=
scalbn
(
vle32dec
(
sp
->
digest
),
-
32
);
break
;
break
;
case
c_random
:
case
c_random
:
default:
default:
retval
=
random
()
/
exp2
(
31
);
retval
=
scalbn
(
random
(),
-
31
);
break
;
break
;
}
}
return
(
retval
);
return
(
retval
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment