{-# LANGUAGE CPP #-}
{-# LANGUAGE NoImplicitPrelude #-}
module Data.NumberLength.Internal
where
import Prelude (error)
#if MIN_VERSION_base(4,7,0)
import Data.Bits (FiniteBits(finiteBitSize))
#else
import Data.Bits (Bits(bitSize))
#endif
import Data.Function (($))
import Data.Monoid ((<>))
import Data.Word (Word)
import Text.Show (Show(show))
either32or64
:: a
-> a
-> a
either32or64 on32bit on64bit = case wordSize (0 :: Word) of
32 -> on32bit
64 -> on64bit
bs -> error $ "Data.NumberLength.either32or64: " <> show bs
<> ": System uses Word size not supported by this library."
where
wordSize =
#if MIN_VERSION_base(4,7,0)
finiteBitSize
#else
bitSize
#endif
{-# INLINE either32or64 #-}