on master help sign in
Fix readByteString for LB with offset=0
commitbf33730ff13283e9cd53538a8606872928e16951 authorSylvain HENRY <hsyl20@gmail.com> dateMon 2 Mar 2015, 00:48 (12 years ago) parent47cca38
1 file changed+4−1
Data/Binary/Bits/Get.hs+4−1
Data/Binary/Bits/Get.hs+4−1
@@ -276,7 +276,10 @@ readWordChecked m n s
276276-- LB: NOPQRxxx FGHIJKLM xxxABCDE -> ABCDEFGH IJKLMNOP QRxxxxxx
277277readByteString :: Int -> S -> ByteString
278278readByteString n (S bs o bo)
279− | o == 0 = unsafeTake n bs
279+ | o == 0 = case bo of
280+ BB -> unsafeTake n bs
281+ LB -> B.reverse (unsafeTake n bs)
282+
280283 | otherwise = unsafePerformIO $ do
281284 let len = n+1
282285 ptr <- mallocBytes len