summaryrefslogtreecommitdiff
path: root/lib/Data/Packed
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/Packed')
-rw-r--r--lib/Data/Packed/Internal/Vector.hs10
1 files changed, 10 insertions, 0 deletions
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
201 201
202subVector = Vector.slice 202subVector = Vector.slice
203 203
204{-
205subVector k l v
206 | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range"
207 | otherwise = unsafeFromForeignPtr fp (i+k) l
208 where
209 (fp, i, n) = unsafeToForeignPtr v
210-}
211
204#else 212#else
205 213
206subVector k l v@V{idim = n, ioff = i} 214subVector k l v@V{idim = n, ioff = i}
207 | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range" 215 | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range"
208 | otherwise = v {idim = l, ioff = i+k} 216 | otherwise = v {idim = l, ioff = i+k}
209 217
218{-
210subVectorCopy k l (v@V {idim=n}) 219subVectorCopy k l (v@V {idim=n})
211 | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range" 220 | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range"
212 | otherwise = unsafePerformIO $ do 221 | otherwise = unsafePerformIO $ do
@@ -214,6 +223,7 @@ subVectorCopy k l (v@V {idim=n})
214 let f _ s _ d = copyArray d (advancePtr s k) l >> return 0 223 let f _ s _ d = copyArray d (advancePtr s k) l >> return 0
215 app2 f vec v vec r "subVector" 224 app2 f vec v vec r "subVector"
216 return r 225 return r
226-}
217 227
218#endif 228#endif
219 229