Permalink
Browse files

refs #10: move withMaybeArray to own function

  • Loading branch information...
zhensydow committed Jan 23, 2012
1 parent 13adfa2 commit 201881b7feb199598ef5576782681e09aeb6c601
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/Control/Parallel/OpenCL/CommandQueue.chs
@@ -112,6 +112,11 @@ foreign import CALLCONV "clFlush" raw_clFlush ::
foreign import CALLCONV "clFinish" raw_clFinish ::
CLCommandQueue -> IO CLint
+-- -----------------------------------------------------------------------------
+withMaybeArray :: Storable a => [a] -> (Ptr a -> IO b) -> IO b
+withMaybeArray [] = ($ nullPtr)
+withMaybeArray xs = withArray xs
+
-- -----------------------------------------------------------------------------
{-| Create a command-queue on a specific device.
@@ -1259,9 +1264,7 @@ clEnqueueNDRangeKernel cq krn gws lws events = withArray (map fromIntegral gws)
clEnqueue (raw_clEnqueueNDRangeKernel cq krn num nullPtr pgws plws) events
where
num = fromIntegral $ length gws
- withMaybeArray [] = ($ nullPtr)
- withMaybeArray xs = withArray xs
-
+
{-| Enqueues a command to execute a kernel on a device. The kernel is executed
using a single work-item.

0 comments on commit 201881b

Please sign in to comment.