 getDeviceLocalMemType val = lookup val deviceLocalMemTypes
 
 -- -----------------------------------------------------------------------------
-bitmaskToDeviceTypes :: CULong -> [CLDeviceType]
+bitmaskToDeviceTypes :: CLDeviceType_ -> [CLDeviceType]
 bitmaskToDeviceTypes mask = map fst . filter (testMask mask) $ deviceTypeValues
 
-bitmaskFromDeviceTypes :: [CLDeviceType] -> CULong
+bitmaskFromDeviceTypes :: [CLDeviceType] -> CLDeviceType_
 bitmaskFromDeviceTypes = foldl' (.|.) 0 . mapMaybe (`lookup` deviceTypeValues)
   
-bitmaskToCommandQueueProperties :: CULong -> [CLCommandQueueProperty]
+bitmaskToCommandQueueProperties :: CLCommandQueueProperty_ -> [CLCommandQueueProperty]
 bitmaskToCommandQueueProperties mask = map fst . filter (testMask mask) $ commandQueueProperties
       
-bitmaskFromCommandQueueProperties :: [CLCommandQueueProperty] -> CULong
+bitmaskFromCommandQueueProperties :: [CLCommandQueueProperty] -> CLCommandQueueProperty_
 bitmaskFromCommandQueueProperties = foldl' (.|.) 0 . mapMaybe (`lookup` commandQueueProperties)
 
 bitmaskToFPConfig :: CLDeviceFPConfig_ -> [CLDeviceFPConfig]

                    -- ^ All OpenCL devices available in the system.
                  deriving( Eq, Show )

deviceTypeValues :: [(CLDeviceType,CULong)]
deviceTypeValues = [ 
  (CL_DEVICE_TYPE_CPU, 1 `shiftL` 1), (CL_DEVICE_TYPE_GPU, 1 `shiftL` 2), 
  (CL_DEVICE_TYPE_ACCELERATOR, 1 `shiftL` 3), (CL_DEVICE_TYPE_DEFAULT, 1 `shiftL` 0),
  (CL_DEVICE_TYPE_ALL, complement 0) ]
getDeviceTypeValue :: CLDeviceType -> CULong
getDeviceTypeValue info = fromMaybe 0 (lookup info deviceTypeValues)

data CLCommandQueueProperty = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE	


-- -----------------------------------------------------------------------------
import Foreign( Ptr )
import Foreign.C.Types
import Data.Maybe( fromMaybe, mapMaybe )
import Data.List( foldl' )
import Data.Bits( shiftL, complement, (.|.) )
