@@ -276,15 +276,8 @@ extract bo bs o n
276readWord :: (Num a, Bits a, FastBits a) => Int -> S -> a
276readWord :: (Num a, Bits a, FastBits a) => Int -> S -> a
277readWord n (S bs o bo)
277readWord n (S bs o bo)
278 | n == 0 = 0
278 | n == 0 = 0
279− | o+n <= 8 = extract bo (unsafeTake 1 bs) o n
280− | o+n <= 16 = extract bo (unsafeTake 2 bs) o n
281− | o+n <= 24 = extract bo (unsafeTake 3 bs) o n
282− | o+n <= 32 = extract bo (unsafeTake 4 bs) o n
283− | o+n <= 40 = extract bo (unsafeTake 5 bs) o n
284− | o+n <= 48 = extract bo (unsafeTake 6 bs) o n
285− | o+n <= 56 = extract bo (unsafeTake 7 bs) o n
286− | o+n <= 64 = extract bo (unsafeTake 8 bs) o n
287− | otherwise = extract bo (unsafeTake ((o+n+7) `div` 8) bs) o n
279+ | otherwise = extract bo (unsafeTake nbytes bs) o n
280+ where nbytes = byte_offset (o+n+7)
289-- | Check that the number of bits to read is not greater than the first parameter
282-- | Check that the number of bits to read is not greater than the first parameter
290{-# INLINE readWordChecked #-}
283{-# INLINE readWordChecked #-}