on master help sign in
Fix bug in getWord32be and getWord64be
commit7ad3838d08a7be959f07ad9a735d97637ee654cd authorLennart Kolmodin <kolmodin@gentoo.org> dateFri 27 Aug 2010, 18:35 (16 years ago) parent7a56f9e
1 file changed+2−2
BitsGet.hs+2−2
BitsGet.hs+2−2
@@ -154,9 +154,9 @@ readWithoutOffset s@(S bs o) shifterL shifterR n
154154 bn 0 = fromIntegral (unsafeHead bs)
155155 bn n = (bn (n-1) `shifterL` 8) .|. fromIntegral (unsafeIndex bs n)
156156
157− msegs = bn segs `shifterL` o'
157+ msegs = bn (segs-1) `shifterL` o'
158158
159− last = (fromIntegral (unsafeIndex bs (segs + 1))) `shifterR` (8 - (bit_offset n))
159+ last = (fromIntegral (unsafeIndex bs segs)) `shifterR` (8 - o')
160160
161161 w = msegs .|. last
162162 in w :*: incS s n