arrayfire-haskell icon indicating copy to clipboard operation
arrayfire-haskell copied to clipboard

Investigate Bits instance on Array CBool

Open dmjio opened this issue 6 years ago • 1 comments

Theoretically, there's no reason this can't be supported.

instance Bits (ArrayFire CBool) where
  (.&.) = A.and
  (.|.) = A.or
  xor = A.bitXor
  shiftL x n = A.shiftL x (scalar n)
  shiftR x n = A.shiftR x (scalar n)

Still need to look into implementing the following:

(rotate | rotateL, rotateR), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount

dmjio avatar Nov 07 '19 23:11 dmjio

Regarding popCount, af_count (i.e. count) can be used on CBool to act like a pop count. But the dimension must be specified as well... so we might need to use countAll.

dmjio avatar Nov 09 '19 21:11 dmjio