 -- -----------------------------------------------------------------------------
 import Foreign( Ptr )
 import Foreign.C.Types
-import Data.Maybe( fromMaybe, mapMaybe )
 import Data.List( foldl' )
-import Data.Bits( shiftL, complement, (.|.) )
-import System.GPU.OpenCL.Util( testMask )
+import Data.Bits( Bits, shiftL, (.|.), (.&.) )
 
 #include <CL/cl.h>
 

time counter in nanoseconds when the command identified by event has finished 
execution on the device.
-}
{#enum CLProfilingInfo {}#}

getProfilingInfoValue :: CLProfilingInfo -> CLProfilingInfo_
getProfilingInfoValue = fromIntegral . fromEnum

-- -----------------------------------------------------------------------------
bitmaskToDeviceTypes :: CLDeviceType_ -> [CLDeviceType]
bitmaskToDeviceTypes mask = map fst . filter (testMask mask) $ deviceTypeValues

bitmaskFromDeviceTypes :: [CLDeviceType] -> CLDeviceType_
bitmaskFromDeviceTypes = foldl' (.|.) 0 . mapMaybe (`lookup` deviceTypeValues)
  
bitmaskToCommandQueueProperties :: CLCommandQueueProperty_ -> [CLCommandQueueProperty]
bitmaskToCommandQueueProperties mask = map fst . filter (testMask mask) $ commandQueueProperties
      
bitmaskFromCommandQueueProperties :: [CLCommandQueueProperty] -> CLCommandQueueProperty_
bitmaskFromCommandQueueProperties = foldl' (.|.) 0 . mapMaybe (`lookup` commandQueueProperties)

bitmaskToFPConfig :: CLDeviceFPConfig_ -> [CLDeviceFPConfig]
bitmaskToFPConfig mask = map fst . filter (testMask mask) $ deviceFPValues

bitmaskToExecCapability :: CLDeviceExecCapability_ -> [CLDeviceExecCapability]
bitmaskToExecCapability mask = map fst . filter (testMask mask) $ deviceExecValues

-- -----------------------------------------------------------------------------

  CLDeviceMemCacheType(..), CLDeviceExecCapability(..), CLDeviceLocalMemType(..),
  CLPlatformID, CLDeviceID, CLContext, CLCommandQueue, CLContextProperty_,
  CLDeviceType(..), CLCommandQueueProperty(..), CLCommandQueueInfo_, 
  CLEventInfo_, CLProfilingInfo_, CLCommandType(..), CLCommandType_, 
  CLCommandExecutionStatus(..), CLProfilingInfo(..), getProfilingInfoValue,
  CLCommandQueueProperty_, getDeviceTypeValue, getDeviceLocalMemType, 
  getDeviceMemCacheType, getCommandType, getCommandExecutionStatus, 
