From 11b5d06fba6105b5da1306569a298ebdde51af79 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Tue, 22 Feb 2011 09:10:40 +0000 Subject: minor change and thanks --- lib/Data/Packed/Internal/Vector.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib') diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs index b68d16a..078cb36 100644 --- a/lib/Data/Packed/Internal/Vector.hs +++ b/lib/Data/Packed/Internal/Vector.hs @@ -201,12 +201,21 @@ subVector :: Storable t => Int -- ^ index of the starting element subVector = Vector.slice +{- +subVector k l v + | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range" + | otherwise = unsafeFromForeignPtr fp (i+k) l + where + (fp, i, n) = unsafeToForeignPtr v +-} + #else subVector k l v@V{idim = n, ioff = i} | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range" | otherwise = v {idim = l, ioff = i+k} +{- subVectorCopy k l (v@V {idim=n}) | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range" | otherwise = unsafePerformIO $ do @@ -214,6 +223,7 @@ subVectorCopy k l (v@V {idim=n}) let f _ s _ d = copyArray d (advancePtr s k) l >> return 0 app2 f vec v vec r "subVector" return r +-} #endif -- cgit v1.2.3