From b8ac3f201ddfd20c820ae46f7a96a1b1812b02a4 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Sun, 29 May 2016 16:39:28 +0000 Subject: [PATCH] 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 --- lib/libc/stdlib/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c index 5b8b5cf9fcf4..fe8fc86696fb 100644 --- a/lib/libc/stdlib/random.c +++ b/lib/libc/stdlib/random.c @@ -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;