add gmpSizeInBits
This commit is contained in:
parent
efedb38570
commit
27dacbfb21
@ -20,6 +20,7 @@ module Crypto.Number.Compat
|
||||
, gmpNextPrime
|
||||
, gmpTestPrimeMillerRabin
|
||||
, gmpSizeInBytes
|
||||
, gmpSizeInBits
|
||||
, gmpExportInteger
|
||||
, gmpImportInteger
|
||||
) where
|
||||
@ -123,6 +124,13 @@ gmpSizeInBytes n = GmpSupported (I# (word2Int# (sizeInBaseInteger n 256#)))
|
||||
gmpSizeInBytes _ = GmpUnsupported
|
||||
#endif
|
||||
|
||||
gmpSizeInBits :: Integer -> GmpSupported Int
|
||||
#if MIN_VERSION_integer_gmp(0,5,1)
|
||||
gmpSizeInBits n = GmpSupported (I# (word2Int# (sizeInBaseInteger n 2#)))
|
||||
#else
|
||||
gmpSizeInBits _ = GmpUnsupported
|
||||
#endif
|
||||
|
||||
-- | Export an integer to a memory
|
||||
gmpExportInteger :: Integer -> Ptr Word8 -> GmpSupported (IO ())
|
||||
#if MIN_VERSION_integer_gmp(1,0,0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user