Make os2ip loop argument strict

This commit is contained in:
Olivier Chéron 2019-05-04 15:06:07 +02:00
parent 393aeac8cd
commit 6893eae70a
2 changed files with 2 additions and 2 deletions

View File

@ -69,7 +69,7 @@ os2ip ptr ptrSz
| otherwise = gmpImportInteger ptrSz ptr `onGmpUnsupported` loop 0 0 ptr | otherwise = gmpImportInteger ptrSz ptr `onGmpUnsupported` loop 0 0 ptr
where where
loop :: Integer -> Int -> Ptr Word8 -> IO Integer loop :: Integer -> Int -> Ptr Word8 -> IO Integer
loop !acc i p loop !acc i !p
| i == ptrSz = return acc | i == ptrSz = return acc
| otherwise = do | otherwise = do
w <- peekByteOff p i :: IO Word8 w <- peekByteOff p i :: IO Word8

View File

@ -68,7 +68,7 @@ os2ip ptr ptrSz
| otherwise = gmpImportIntegerLE ptrSz ptr `onGmpUnsupported` loop 0 (ptrSz-1) ptr | otherwise = gmpImportIntegerLE ptrSz ptr `onGmpUnsupported` loop 0 (ptrSz-1) ptr
where where
loop :: Integer -> Int -> Ptr Word8 -> IO Integer loop :: Integer -> Int -> Ptr Word8 -> IO Integer
loop !acc i p loop !acc i !p
| i < 0 = return acc | i < 0 = return acc
| otherwise = do | otherwise = do
w <- peekByteOff p i :: IO Word8 w <- peekByteOff p i :: IO Word8