From 00dad0cfc02fdd78abe425aa29b41855a22dea1a Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Thu, 26 Apr 2012 20:40:26 -0400 Subject: Make hlint happy. --- Data/Digest/CRC24.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Data') diff --git a/Data/Digest/CRC24.hs b/Data/Digest/CRC24.hs index 4586177..87b3bc9 100644 --- a/Data/Digest/CRC24.hs +++ b/Data/Digest/CRC24.hs @@ -14,17 +14,17 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL import Data.Word (Word8, Word32) -crc24_init :: Word32 -crc24_init = 0xB704CE +crc24Init :: Word32 +crc24Init = 0xB704CE -crc24_poly :: Word32 -crc24_poly = 0x1864CFB +crc24Poly :: Word32 +crc24Poly = 0x1864CFB -crc24_update :: Word32 -> Word8 -> Word32 -crc24_update c b = (last . take 9 $ iterate (\x -> if (shiftL x 1) .&. 0x1000000 == 0x1000000 then shiftL x 1 `xor` crc24_poly else shiftL x 1) (c `xor` shiftL (fromIntegral b) 16)) .&. 0xFFFFFF +crc24Update :: Word32 -> Word8 -> Word32 +crc24Update c b = (last . take 9 $ iterate (\x -> if shiftL x 1 .&. 0x1000000 == 0x1000000 then shiftL x 1 `xor` crc24Poly else shiftL x 1) (c `xor` shiftL (fromIntegral b) 16)) .&. 0xFFFFFF crc24 :: B.ByteString -> Word32 crc24 bs = crc24Lazy . BL.fromChunks $ [bs] crc24Lazy :: ByteString -> Word32 -crc24Lazy bs = BL.foldl crc24_update crc24_init bs +crc24Lazy = BL.foldl crc24Update crc24Init -- cgit v1.2.3