word24 1.0.3 → 1.0.4
raw patch · 5 files changed
+69/−52 lines, 5 filesdep +criteriondep +deepseqdep +word24dep ~basedep ~test-frameworkdep ~test-framework-quickcheck2
Dependencies added: criterion, deepseq, word24
Dependency ranges changed: base, test-framework, test-framework-quickcheck2
Files
- bench/Benchmark.hs +34/−0
- src/Data/Int/Int24.hs +3/−0
- src/Data/Word/Word24.hs +3/−0
- tests/QCUtils.hs +0/−26
- word24.cabal +29/−26
+ bench/Benchmark.hs view
@@ -0,0 +1,34 @@+module Main where++import Criterion.Main+import Control.DeepSeq+import Data.Int.Int24+import Data.Word.Word24+import Data.Word+import Data.List++main = defaultMain+ [ bgroup "Int24" intses+ , bgroup "Word24" wordses+ , bgroup "Int" baseses+ , bgroup "Word64" basessW+ ]++benches :: (Enum i, Num i, NFData i, Integral i) => i -> [Benchmark]+benches x =+ [ bench "Add" $ nf (\i -> foldl' (+) i [1..100]) x+ , bench "Mul" $ nf (\i -> foldl' (*) i [1..100]) x+ , bench "quot" $ nf (\i -> map (flip quot i) [1..25]) x+ , bench "rem" $ nf (\i -> map (flip rem i) [1..25]) x+ , bench "div" $ nf (\i -> map (flip div i) [1..25]) x+ , bench "mod" $ nf (\i -> map (flip mod i) [1..25]) x+ ]+{-# INLINE benches #-}++intses = benches (1 :: Int24)+wordses = benches (1 :: Word24)+baseses = benches (1 :: Int)+basessW = benches (1 :: Word64)++instance NFData Int24+instance NFData Word24
src/Data/Int/Int24.hs view
@@ -164,6 +164,9 @@ {-# INLINE shiftR #-} -- same as the default definition, but we want it inlined (#2376) x `shiftR` i = x `shift` (-i)+ bit = bitDefault+ testBit = testBitDefault+ popCount = popCountDefault {-# RULES "fromIntegral/Word8->Int24" fromIntegral = \(W8# x#) -> I24# (word2Int# x#)
src/Data/Word/Word24.hs view
@@ -124,6 +124,9 @@ !(I# i'#) = i `mod` 24 bitSize _ = 24 isSigned _ = False+ bit = bitDefault+ testBit (W24# x) n = testBit (W32# x) n+ popCount (W24# x) = popCount (W32# x) {-# INLINE shiftR #-} x `shiftR` i = x `shift` (-i)
− tests/QCUtils.hs
@@ -1,26 +0,0 @@-module QCUtils where--import Test.QuickCheck-import Test.QuickCheck.Arbitrary-import Test.QuickCheck.Gen--import Data.Int-import Data.Int.Int24-import Data.Word-import Data.Word.Word24---- Arbitrary/CoArbitrary instances for Int24 and Word24--instance Arbitrary Int24 where- arbitrary = arbitraryBoundedIntegral- shrink = shrinkIntegral--instance CoArbitrary Int24 where- coarbitrary = coarbitraryIntegral--instance Arbitrary Word24 where- arbitrary = arbitraryBoundedIntegral- shrink = shrinkIntegral--instance CoArbitrary Word24 where- coarbitrary = coarbitraryIntegral
word24.cabal view
@@ -1,5 +1,5 @@ name: word24-version: 1.0.3+version: 1.0.4 synopsis: 24-bit word and int types for GHC description: 24-bit Word and Int data types. category: Data@@ -11,20 +11,16 @@ tested-with: GHC == 7.0.4, GHC == 7.2.1, GHC == 7.4.2 stability: stable -cabal-version: >= 1.6+cabal-version: >= 1.10 build-type: Simple extra-source-files: README LICENSE -flag buildTests- description: Build test executables.- default: False- library- hs-source-dirs:- src+ default-language: Haskell2010+ hs-source-dirs: src build-depends: base >= 3 && < 5@@ -33,30 +29,37 @@ Data.Int.Int24 Data.Word.Word24 - ghc-options: -O2 -Wall+ ghc-options: -Wall if impl(ghc >= 6.8) ghc-options: -fwarn-tabs -executable testWord24- hs-source-dirs:- src- tests-+Test-Suite test+ default-language: Haskell2010+ type: exitcode-stdio-1.0 main-is: testword24.hs+ hs-source-dirs: tests src+ ghc-options: -fhpc -hpcdir dist/hpc/mix/word24-1.0.4 - other-modules:- QCUtils+ build-depends:+ base,+ word24,+ QuickCheck >= 2 && < 3,+ test-framework >= 0.2 && < 0.7,+ test-framework-quickcheck2 >= 0.2 && < 0.7 - if flag(buildTests)- build-depends:- QuickCheck >= 2 && < 3,- test-framework >= 0.2 && < 0.3,- test-framework-quickcheck2 >= 0.2 && < 0.3- else- buildable: False+benchmark bench24+ default-language: Haskell2010+ type: exitcode-stdio-1.0+ hs-source-dirs: bench+ main-is: Benchmark.hs - build-depends: base >= 3 && < 5+ build-depends:+ base,+ word24,+ criterion >= 0.6 && < 0.9,+ deepseq >= 1.2 && < 2+ ghc-options: -O2 source-repository head- type: darcs- location: http://www.tiresiaspress.us/haskell/word24+ type: git+ location: git@github.com:JohnLato/word24.git