word24 1.0.5 → 1.0.6
raw patch · 5 files changed
+43/−35 lines, 5 files
Files
- README +0/−28
- README.md +30/−0
- src/Data/Int/Int24.hs +2/−2
- tests/testword24.hs +8/−2
- word24.cabal +3/−3
− README
@@ -1,28 +0,0 @@-This library implements 24-bit word and int types suitable for use in vector-processing.--Storable implementations are provided, however as they use a size and alignment-of 3 bytes care should be taken to ensure they are compatible if used in-conjunction with the FFI.--These types use unboxed data and GHC primitives, and are unlikely to be-compatible with other Haskell compilers.--INSTALLATION INSTRUCTIONS--This library uses the Hackage/Cabal build system. You will need a working-Haskell compiler and appropriate build system. This is most easily met-by installing the Haskell Platform. The following command will install-the library:--cabal install iteratee--This library is pure Haskell, and should install on any system with a suitable-Haskell compiler with no extra steps required. In particular, POSIX-compatible,-Mac OSX, and Windows should all be supported.--INSTALLATION OPTIONS:--This library supports the following cabal flags:- splitBase (default enabled): use the split-up base package.-
+ README.md view
@@ -0,0 +1,30 @@+[](http://travis-ci.org/JohnLato/word24)++This library implements 24-bit word and int types suitable for use in vector+processing.++Storable implementations are provided, however as they use a size and alignment+of 3 bytes care should be taken to ensure they are compatible if used in+conjunction with the FFI.++These types use unboxed data and GHC primitives, and are unlikely to be+compatible with other Haskell compilers.++INSTALLATION INSTRUCTIONS++This library uses the Hackage/Cabal build system. You will need a working+Haskell compiler and appropriate build system. This is most easily met+by installing the Haskell Platform. The following command will install+the library:++cabal install iteratee++This library is pure Haskell, and should install on any system with a suitable+Haskell compiler with no extra steps required. In particular, POSIX-compatible,+Mac OSX, and Windows should all be supported.++INSTALLATION OPTIONS:++This library supports the following cabal flags:+ splitBase (default enabled): use the split-up base package.+
src/Data/Int/Int24.hs view
@@ -166,8 +166,8 @@ x `shiftR` i = x `shift` (-i) bit n = case bit n of I32# x -> I24# (narrow24Int# x)- testBit = testBitDefault- popCount = popCountDefault+ testBit x i = (x .&. bit i) /= 0+ popCount (I24# x#) = popCount (W# (narrow24Word# (int2Word# x#))) {-# RULES "fromIntegral/Word8->Int24" fromIntegral = \(W8# x#) -> I24# (word2Int# x#)
tests/testword24.hs view
@@ -133,9 +133,13 @@ prop_comp a = complement (complement a) == a where types = a :: Word24 -prop_bit_ident q (NonNegative j) k =- testBit (bit j `asTypeOf` q) k == (j == k)+prop_bit_ident q (NonNegative j) = testBit (bit j `asTypeOf` q) j == (j < 24) +prop_popCount s t a = if a >= 0+ then popCount (a `asTypeOf` s) == popCount (fromIntegral a `asTypeOf` t)+ else+ bitSize s - popCount (a `asTypeOf` s) == bitSize t - popCount (fromIntegral a `asTypeOf` t)+ -- Word Storable properties prop_sizeOf a = sizeOf a == 3 where types = a :: Word24@@ -312,6 +316,7 @@ ,testProperty "binary rotate" prop_rotate ,testProperty "binary complement" prop_comp ,testProperty "bit/testBit" (prop_bit_ident (0::Word24))+ ,testProperty "popCount" (prop_popCount (0::Word24) (0::Word)) ] ,testGroup "Storable instance" [ testProperty "sizeOf Word24" prop_sizeOf@@ -359,6 +364,7 @@ ,testProperty "binary rotate" prop_rotateI ,testProperty "binary complement" prop_compI ,testProperty "bit/testBit" (prop_bit_ident (0::Int24))+ ,testProperty "popCount" (prop_popCount (0::Int24) (0::Int)) ] ,testGroup "Storable instance" [ testProperty "sizeOf Int24" prop_sizeOfI
word24.cabal view
@@ -1,5 +1,5 @@ name: word24-version: 1.0.5+version: 1.0.6 synopsis: 24-bit word and int types for GHC description: 24-bit Word and Int data types. category: Data@@ -15,7 +15,7 @@ build-type: Simple extra-source-files:- README+ README.md LICENSE library@@ -38,7 +38,7 @@ type: exitcode-stdio-1.0 main-is: testword24.hs hs-source-dirs: tests src- ghc-options: -fhpc -hpcdir dist/hpc/mix/word24-1.0.5+ ghc-options: -fhpc -hpcdir dist/hpc/mix/word24-1.0.6 build-depends: base,