{-# LANGUAGE CPP #-}
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE UnliftedFFITypes #-}
module Foreign.Prim.C.LtGHC802
(
compareByteArrays#
, CBool(..)
, isByteArrayPinned#
, isMutableByteArrayPinned#
, getSizeofMutableByteArray#
) where
import GHC.Exts
#if __GLASGOW_HASKELL__ < 802
import Data.Bits (Bits, FiniteBits)
import Data.Word
import Foreign.Storable (Storable)
import Control.DeepSeq
#include "MachDeps.h"
#include "HsBaseConfig.h"
#include "primal_compat.h"
newtype {-# CTYPE "bool" #-} CBool = CBool HTYPE_BOOL
deriving (Eq, Ord, Num, Enum, Storable, Real, Bounded, Integral, Bits, FiniteBits, NFData, Read, Show)
foreign import ccall unsafe "primal_compat.c primal_is_byte_array_pinned"
isByteArrayPinned# :: ByteArray# -> Int#
foreign import ccall unsafe "primal_compat.c primal_is_byte_array_pinned"
isMutableByteArrayPinned# :: MutableByteArray# s -> Int#
#if __GLASGOW_HASKELL__ < 800
getSizeofMutableByteArray# :: MutableByteArray# s -> State# s -> (# State# s, Int# #)
getSizeofMutableByteArray# mba# s = (# s, sizeofMutableByteArray# mba# #)
{-# INLINE getSizeofMutableByteArray# #-}
#endif /* __GLASGOW_HASKELL__ < 800 */
#else
import Foreign.C.Types (CBool(..))
#endif /* __GLASGOW_HASKELL__ < 802 */
#if __GLASGOW_HASKELL__ < 804
foreign import ccall unsafe "primal.c primal_memcmp"
compareByteArrays# :: ByteArray# -> Int# -> ByteArray# -> Int# -> Int# -> Int#
#endif /* __GLASGOW_HASKELL__ < 804 */