summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClint Adams <clint@debian.org>2019-06-30 11:02:27 -0400
committerClint Adams <clint@debian.org>2019-06-30 11:02:27 -0400
commit0734e5bbe64e1daeaea74cc29a6631d84cf6c3e1 (patch)
treef04168e87f1d72b7a6af64bbd34e20a599548ffa
parenta0c6bb0a02b0dc89ae4e6a1b971fa43b2bf68af0 (diff)
switch crc24Lazy to use foldl'
-rw-r--r--Data/Digest/CRC24.hs4
-rw-r--r--bench/mark.hs6
2 files changed, 6 insertions, 4 deletions
diff --git a/Data/Digest/CRC24.hs b/Data/Digest/CRC24.hs
index e8eec92..4fbb9b1 100644
--- a/Data/Digest/CRC24.hs
+++ b/Data/Digest/CRC24.hs
@@ -1,5 +1,5 @@
1-- CRC24.hs: OpenPGP (RFC4880) CRC24 implementation 1-- CRC24.hs: OpenPGP (RFC4880) CRC24 implementation
2-- Copyright © 2012 Clint Adams 2-- Copyright © 2012-2019 Clint Adams
3-- This software is released under the terms of the ISC license. 3-- This software is released under the terms of the ISC license.
4-- (See the LICENSE file). 4-- (See the LICENSE file).
5 5
@@ -27,4 +27,4 @@ crc24 :: B.ByteString -> Word32
27crc24 bs = crc24Lazy . BL.fromChunks $ [bs] 27crc24 bs = crc24Lazy . BL.fromChunks $ [bs]
28 28
29crc24Lazy :: ByteString -> Word32 29crc24Lazy :: ByteString -> Word32
30crc24Lazy = BL.foldl crc24Update crc24Init 30crc24Lazy = BL.foldl' crc24Update crc24Init
diff --git a/bench/mark.hs b/bench/mark.hs
index 8251823..cf1f20f 100644
--- a/bench/mark.hs
+++ b/bench/mark.hs
@@ -1,5 +1,5 @@
1-- mark.hs: openpgp-asciiarmor benchmark suite 1-- mark.hs: openpgp-asciiarmor benchmark suite
2-- Copyright © 2018 Clint Adams 2-- Copyright © 2018-2019 Clint Adams
3-- This software is released under the terms of the ISC license. 3-- This software is released under the terms of the ISC license.
4-- (See the LICENSE file). 4-- (See the LICENSE file).
5 5
@@ -11,6 +11,8 @@ import Data.Digest.CRC24
11 11
12main :: IO () 12main :: IO ()
13main = defaultMain [ 13main = defaultMain [
14 bgroup "crc" [ bench "crc24" $ whnf crc24 "test" 14 bgroup "crc" [
15 bench "crc24" $ whnf crc24 "test"
16 , bench "crc24Lazy" $ whnf crc24Lazy "test"
15 ] 17 ]
16 ] 18 ]