commit 16a904a8d19940f585c6d4c2e1b190a15dac983b
parent 2d2f1949531f6a688a5cc021cabce4e086f5de02
Author: Jared Tobin <jared@jtobin.io>
Date: Tue, 12 Nov 2024 12:23:12 +0400
lib: bit function inlines
These don't do anything for performance, but logically they feel reasonable.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/Crypto/Hash/RIPEMD160.hs b/lib/Crypto/Hash/RIPEMD160.hs
@@ -194,10 +194,15 @@ unsafe_parse bs =
-- nonlinear functions at bit level
f0, f1, f2, f3, f4 :: Word32 -> Word32 -> Word32 -> Word32
f0 x y z = x `B.xor` y `B.xor` z
+{-# INLINE f0 #-}
f1 x y z = (x .&. y) .|. ((B.complement x) .&. z)
+{-# INLINE f1 #-}
f2 x y z = (x .|. B.complement y) `B.xor` z
+{-# INLINE f2 #-}
f3 x y z = (x .&. z) .|. (y .&. B.complement z)
+{-# INLINE f3 #-}
f4 x y z = x `B.xor` (y .|. B.complement z)
+{-# INLINE f4 #-}
-- constants
k0, k1, k2, k3, k4 :: Word32