add signature to compat popCount

This commit is contained in:
Vincent Hanquez 2015-02-08 14:41:07 +00:00
parent 410373ec26
commit 7c6adacef9

View File

@ -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)