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