On Mon, Aug 10, 2020 at 12:01:11PM +0000, David Laight wrote:
> > /*
> > * On 32-bit machines, we use HSipHash, a reduced-width version of SipHash.
> > * This is weaker, but 32-bit machines are not used for high-traffic
> > @@ -375,6 +377,12 @@ static u32 siprand_u32(struct siprand_state *s)
> > {
> > unsigned long v0 = s->v[0], v1 = s->v[1], v2 = s->v[2], v3 = s->v[3];
> >
> > + if (++s->count >= 8) {
> > + v3 ^= s->noise;
> > + s->noise += random_get_entropy();
> > + s->count = 0;
> > + }
> > +
>
> Using:
> if (s->count-- <= 0) {
> ...
> s->count = 8;
> }
> probably generates better code.
> Although you may want to use a 'signed int' instead of 'unsigned long'.
Yeah I know, it's just because I only slightly changed the previous code
there. I had an earlier version that kept the rand state fully padded
when storing intermediate values. That's among the final cleanups I'll
bring if we go down that route.
Thanks!
Willy