From 7c6adacef93e23f436515596504362b1489d47d2 Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Sun, 8 Feb 2015 14:41:07 +0000 Subject: [PATCH] add signature to compat popCount --- Crypto/KDF/Scrypt.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/Crypto/KDF/Scrypt.hs b/Crypto/KDF/Scrypt.hs index c9956f7..a1f3980 100644 --- a/Crypto/KDF/Scrypt.hs +++ b/Crypto/KDF/Scrypt.hs @@ -45,6 +45,7 @@ foreign import ccall "cryptonite_scrypt_smix" ccryptonite_scrypt_smix :: Ptr Word8 -> Word32 -> Word64 -> Ptr Word8 -> Ptr Word8 -> IO () #if !(MIN_VERSION_base(4,5,0)) +popCount :: Word64 -> Int popCount n = loop 0 n where loop c 0 = c loop c i = loop (c + if testBit c 0 then 1 else 0) (i `shiftR` 1)