From 06e4e4310f4ec7530e2ac8421e95d5eb846297b5 Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 29 May 2016 16:39:28 +0000 Subject: 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(-) (limited to 'lib/libc') diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c index 5b8b5cf..fe8fc86 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; -- cgit v1.1