Skip to content

Commit 286e171

Browse files
authored
Support bytestring-0.11
1 parent 88a926a commit 286e171

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
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" #-}

0 commit comments

Comments
 (0)