
17 Oct
2021
17 Oct
'21
7:53 a.m.
Hi, Am Donnerstag, dem 14.10.2021 um 20:05 +0000 schrieb Keith:
As currently defined, `shift x minBound` calls `shiftR` with a negative displacement.
This would avoid that: ``` shift x n | n >= 0 = shiftL x n | n == minBound = shiftR (shiftR x maxBound) 1 | otherwise = shiftR x (-n) ```
thanks, yes, this looks like a bug to me: ghci> shift (-2) (-20000) :: Integer -1 ghci> shift (-2) minBound :: Integer -2 ghci> shift (-2) (-20000) :: Int -1 ghci> shift (-2) minBound :: Int -2 Maybe report it at https://gitlab.haskell.org/ghc/ghc/issues/new (once the gitlab is up again), or even supply a patch. Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.de http://www.joachim-breitner.de/