On Tue, Jul 30, 2013 at 05:07:46PM -0700, David O'Brien (@FreeBSD) wrote:
> I believe you're talking about this code in
> sys/libkern/arc4random.c:arc4rand()
> 
>       if (atomic_cmpset_int(&arc4rand_iniseed_state, ARC4_ENTR_HAVE,
>           ARC4_ENTR_SEED) || reseed ||
>          (arc4_numruns > ARC4_RESEED_BYTES) ||
>          (tv.tv_sec > arc4_t_reseed))
>               arc4_randomstir();

Looking at this, seems to me that it would be more optimized if we tested
the things that are most likely to be TRUE first instead of those things
most likely to be FALSE?  ARC4_ENTR_HAVE->ARC4_ENTR_SEED can only happen
once per boot, and the 'reseed' flag is '0' in the majority of the
arc4rand() callers.

-- 
-- David    (obr...@freebsd.org)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to