mkStdGen32: Avoid infinite recursion when applied to minBound
authorJohan Kiviniemi <devel@johan.kiviniemi.name>
Fri, 21 Jan 2011 07:02:58 +0000 (07:02 +0000)
committerJohan Kiviniemi <devel@johan.kiviniemi.name>
Fri, 21 Jan 2011 07:02:58 +0000 (07:02 +0000)
commitd8e406fd6c3617d35b1abc4dab5b439b070ad623
treed04275b32d0d5dedbef76b3e4ab41af74b640543
parentb78ab23d7e5e82614aacbe8370f9e30eec9cf37b
mkStdGen32: Avoid infinite recursion when applied to minBound

"mkStdGen32 s" would call itself with "negate s" if "s" is negative. Alas,
(minBound :: Int32) == negate minBound. "mkStdGen32 minBound" would thus
recurse infinitely.

Compute "sMaybeNegative .&. maxBound" instead. That clears the most significant
bit in signed types.
System/Random.hs