Skip to content

Commit a18c875

Browse files
authored
Merge pull request #7 from Bodigrim/patch-1
Support bytestring-0.11
2 parents 88a926a + 28b4296 commit a18c875

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Data/Digest/Pure/MD5.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,15 @@ performMD5Update par@(MD5Par !a !b !c !d) !bs =
141141
{-# INLINE performMD5Update #-}
142142

143143
isAligned :: ByteString -> Bool
144+
#if !MIN_VERSION_bytestring(0,11,0)
144145
isAligned (PS _ off _) = off `rem` 4 == 0
146+
#else
147+
isAligned = const True
148+
-- This is semantically equivalent to the definition above, because
149+
-- in bytestring-0.11 offset is always 0. Note that neither definition checks
150+
-- that a pointer (the first field of 'PS') is aligned. Anyways 'isAligned'
151+
-- is used for optimization purposes only and does not affect correctness.
152+
#endif
145153

146154
applyMD5Rounds :: MD5Partial -> ByteString -> MD5Partial
147155
applyMD5Rounds (MD5Par a b c d) w = {-# SCC "applyMD5Rounds" #-}

pureMD5.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ stability: stable
1212
build-type: Simple
1313
cabal-version: >= 1.10
1414
tested-with: GHC == 7.10.3
15-
extra-source-files: Test/MD5.hs
1615

1716
flag test
1817
description: Build a test program

0 commit comments

Comments
 (0)