hw-bits 0.0.0.7 → 0.0.0.8
raw patch · 2 files changed
+35/−5 lines, 2 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ HaskellWorks.Data.Bits.BitWise: instance HaskellWorks.Data.Bits.BitWise.BitWise GHC.Types.Int
+ HaskellWorks.Data.Bits.BitWise: instance HaskellWorks.Data.Bits.BitWise.Shift GHC.Types.Int
+ HaskellWorks.Data.Bits.BitWise: instance HaskellWorks.Data.Bits.BitWise.TestBit GHC.Types.Int
Files
- hw-bits.cabal +1/−1
- src/HaskellWorks/Data/Bits/BitWise.hs +34/−4
hw-bits.cabal view
@@ -1,5 +1,5 @@ name: hw-bits-version: 0.0.0.7+version: 0.0.0.8 synopsis: Conduits for tokenizing streams. description: Please see README.md homepage: http://github.com/haskell-works/hw-bits#readme
src/HaskellWorks/Data/Bits/BitWise.hs view
@@ -72,6 +72,10 @@ (.?.) v p = v !! fromIntegral p {-# INLINE (.?.) #-} +instance TestBit Int where+ (.?.) w n = B.testBit w (fromIntegral (getPosition n))+ {-# INLINE (.?.) #-}+ instance TestBit Word8 where (.?.) w n = B.testBit w (fromIntegral (getPosition n)) {-# INLINE (.?.) #-}@@ -120,6 +124,25 @@ (.?.) v n = let (q, r) = n `quotRem` elemBitEnd v in (v !!! q) .?. r {-# INLINE (.?.) #-} +instance BitWise Int where+ (.&.) = (B..&.)+ {-# INLINE (.&.) #-}++ (.|.) = (B..|.)+ {-# INLINE (.|.) #-}++ (.^.) = B.xor+ {-# INLINE (.^.) #-}++ comp = B.complement+ {-# INLINE comp #-}++ all0s = 0+ {-# INLINE all0s #-}++ all1s = -1+ {-# INLINE all1s #-}+ instance BitWise Word8 where (.&.) = (B..&.) {-# INLINE (.&.) #-}@@ -136,7 +159,7 @@ all0s = 0 {-# INLINE all0s #-} - all1s = 0+ all1s = 0xff {-# INLINE all1s #-} instance BitWise Word16 where@@ -155,7 +178,7 @@ all0s = 0 {-# INLINE all0s #-} - all1s = 0+ all1s = 0xffff {-# INLINE all1s #-} instance BitWise Word32 where@@ -174,7 +197,7 @@ all0s = 0 {-# INLINE all0s #-} - all1s = 0+ all1s = 0xffffffff {-# INLINE all1s #-} instance BitWise Word64 where@@ -193,8 +216,15 @@ all0s = 0 {-# INLINE all0s #-} - all1s = 0+ all1s = 0xffffffffffffffff {-# INLINE all1s #-}++instance Shift Int where+ (.<.) w n = B.shiftL w (fromIntegral n)+ {-# INLINE (.<.) #-}++ (.>.) w n = B.shiftR w (fromIntegral n)+ {-# INLINE (.>.) #-} instance Shift Word8 where (.<.) w n = B.shiftL w (fromIntegral n)