Author: ache
Date: Sun May 29 16:39:28 2016
New Revision: 300965
URL: https://svnweb.freebsd.org/changeset/base/300965

Log:
  Micro optimize: C standard guarantees that right shift for unsigned value
  fills left bits with zero, and we have exact 32bit unsigned value
  (uint32_t), so there is no reason to add "& 0x7fffffff" here.
  
  MFC after:      1 week

Modified:
  head/lib/libc/stdlib/random.c

Modified: head/lib/libc/stdlib/random.c
==============================================================================
--- head/lib/libc/stdlib/random.c       Sun May 29 16:32:56 2016        
(r300964)
+++ head/lib/libc/stdlib/random.c       Sun May 29 16:39:28 2016        
(r300965)
@@ -430,7 +430,7 @@ random(void)
                 */
                f = fptr; r = rptr;
                *f += *r;
-               i = (*f >> 1) & 0x7fffffff;     /* chucking least random bit */
+               i = *f >> 1;    /* chucking least random bit */
                if (++f >= end_ptr) {
                        f = state;
                        ++r;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to