Actually flip the sign of the value (1 -> -1)
PATCH 9/12 Actually flip the sign of the value (1 -> -1)
From: Tyson Smith <[email protected]>
I believe this is what was intended, previously the high bit was just being set. Perhaps it was meant to be toggled? If that is the case we can add that too.
--- random.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
random.c +3 -3
@@ -130,7 +130,7 @@ unsigned int rand32(void)/* Sometimes flip sign */ if (rand_bool ()) - r |= (1L <<31 ); + r = ~r +1 ;/* we might get lucky if something is counting ints/longs etc. */ if (ONE_IN (4 )) {
@@ -206,9 +206,9 @@ u64 rand64(void) r |= (1UL << ((__WORDSIZE -1 ) - (rand () %8 ))); } -/* randomly flip sign bit. */ +/* Sometimes flip sign */ if (rand_bool ()) - r |= (1UL << (__WORDSIZE -1 )); + r = ~r +1 ;return r; }
Signature · 1 line
1.9.1