summaryrefslogtreecommitdiff
path: root/packages/base/src/Internal/Vector.hs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base/src/Internal/Vector.hs')
-rw-r--r--packages/base/src/Internal/Vector.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/base/src/Internal/Vector.hs b/packages/base/src/Internal/Vector.hs
index 6271bb6..3037019 100644
--- a/packages/base/src/Internal/Vector.hs
+++ b/packages/base/src/Internal/Vector.hs
@@ -32,7 +32,7 @@ import Foreign.ForeignPtr
32import Foreign.Ptr 32import Foreign.Ptr
33import Foreign.Storable 33import Foreign.Storable
34import Foreign.C.Types(CInt) 34import Foreign.C.Types(CInt)
35import Data.Int(Int64) 35import Data.Int
36import Data.Complex 36import Data.Complex
37import System.IO.Unsafe(unsafePerformIO) 37import System.IO.Unsafe(unsafePerformIO)
38import GHC.ForeignPtr(mallocPlainForeignPtrBytes) 38import GHC.ForeignPtr(mallocPlainForeignPtrBytes)
@@ -46,18 +46,18 @@ import Control.Monad(replicateM)
46import qualified Data.ByteString.Internal as BS 46import qualified Data.ByteString.Internal as BS
47import Data.Vector.Storable.Internal(updPtr) 47import Data.Vector.Storable.Internal(updPtr)
48 48
49type I = CInt 49type I = Int32
50type Z = Int64 50type Z = Int64
51type R = Double 51type R = Double
52type C = Complex Double 52type C = Complex Double
53 53
54 54
55-- | specialized fromIntegral 55-- | specialized fromIntegral
56fi :: Int -> CInt 56fi :: Int -> Int32
57fi = fromIntegral 57fi = fromIntegral
58 58
59-- | specialized fromIntegral 59-- | specialized fromIntegral
60ti :: CInt -> Int 60ti :: Int32 -> Int
61ti = fromIntegral 61ti = fromIntegral
62 62
63 63
@@ -69,7 +69,7 @@ dim = Vector.length
69 69
70-- C-Haskell vector adapter 70-- C-Haskell vector adapter
71{-# INLINE avec #-} 71{-# INLINE avec #-}
72avec :: Storable a => Vector a -> (f -> IO r) -> ((CInt -> Ptr a -> f) -> IO r) 72avec :: Storable a => Vector a -> (f -> IO r) -> ((Int32 -> Ptr a -> f) -> IO r)
73avec v f g = unsafeWith v $ \ptr -> f (g (fromIntegral (Vector.length v)) ptr) 73avec v f g = unsafeWith v $ \ptr -> f (g (fromIntegral (Vector.length v)) ptr)
74 74
75-- allocates memory for a new vector 75-- allocates memory for a new vector