on master help sign in
Fix readByteString for LB with offset=0
bf33730Sylvain HENRY
Data/Binary/Bits/Get.hs+4−1
@@ -276,7 +276,10 @@ readWordChecked m n s
276-- LB: NOPQRxxx FGHIJKLM xxxABCDE -> ABCDEFGH IJKLMNOP QRxxxxxx
276-- LB: NOPQRxxx FGHIJKLM xxxABCDE -> ABCDEFGH IJKLMNOP QRxxxxxx
277readByteString :: Int -> S -> ByteString
277readByteString :: Int -> S -> ByteString
278readByteString n (S bs o bo)
278readByteString n (S bs o bo)
279+ | o == 0 = case bo of
279− | o == 0 = unsafeTake n bs
280+ BB -> unsafeTake n bs
281+ LB -> B.reverse (unsafeTake n bs)
282+
280 | otherwise = unsafePerformIO $ do
283 | otherwise = unsafePerformIO $ do
281 let len = n+1
284 let len = n+1
282 ptr <- mallocBytes len
285 ptr <- mallocBytes len