commit ghc-scientific for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-scientific for openSUSE:Factory checked in at 2015-10-14 16:45:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-scientific (Old) and /work/SRC/openSUSE:Factory/.ghc-scientific.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-scientific" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-scientific/ghc-scientific.changes 2015-10-08 08:24:40.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-scientific.new/ghc-scientific.changes 2015-10-14 16:45:22.000000000 +0200 @@ -1,0 +2,6 @@ +Mon Oct 12 18:53:43 UTC 2015 - mimi.vx@gmail.com + +- update to 0.3.4.2 +* build fixes + +------------------------------------------------------------------- Old: ---- scientific-0.3.4.0.tar.gz New: ---- scientific-0.3.4.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-scientific.spec ++++++ --- /var/tmp/diff_new_pack.uBKYcs/_old 2015-10-14 16:45:24.000000000 +0200 +++ /var/tmp/diff_new_pack.uBKYcs/_new 2015-10-14 16:45:24.000000000 +0200 @@ -19,7 +19,7 @@ %global pkg_name scientific Name: ghc-scientific -Version: 0.3.4.0 +Version: 0.3.4.2 Release: 0 Summary: Numbers represented using scientific notation License: BSD-3-Clause ++++++ scientific-0.3.4.0.tar.gz -> scientific-0.3.4.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scientific-0.3.4.0/changelog new/scientific-0.3.4.2/changelog --- old/scientific-0.3.4.0/changelog 2015-09-30 09:16:10.000000000 +0200 +++ new/scientific-0.3.4.2/changelog 2015-10-10 10:42:48.000000000 +0200 @@ -1,3 +1,10 @@ +0.3.4.2 + * Fix build on GHC-7.4. + Courtesy of Adam Bergmark.. + +0.3.4.1 + * Fix build on GHC-7.0.4 + 0.3.4.0 * Added fromRationalRepetend & toRationalRepetend for safely converting from and to rationals diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scientific-0.3.4.0/scientific.cabal new/scientific-0.3.4.2/scientific.cabal --- old/scientific-0.3.4.0/scientific.cabal 2015-09-30 09:16:10.000000000 +0200 +++ new/scientific-0.3.4.2/scientific.cabal 2015-10-10 10:42:48.000000000 +0200 @@ -1,5 +1,5 @@ name: scientific -version: 0.3.4.0 +version: 0.3.4.2 synopsis: Numbers represented using scientific notation description: @Data.Scientific@ provides the number type 'Scientific'. Scientific numbers are @@ -63,6 +63,7 @@ exposed-modules: Data.Scientific Data.Text.Lazy.Builder.Scientific other-modules: Math.NumberTheory.Logarithms + GHC.Integer.Logarithms.Compat Utils other-extensions: DeriveDataTypeable, BangPatterns ghc-options: -Wall @@ -72,7 +73,7 @@ , text >= 0.8 && < 1.3 , hashable >= 1.1.2 && < 1.3 , vector >= 0.5 && < 0.12 - , containers >= 0.5 && < 0.6 + , containers >= 0.1 && < 0.6 , binary >= 0.4.1 && < 0.8 if flag(integer-simple) @@ -88,9 +89,6 @@ exposed-modules: Data.ByteString.Builder.Scientific build-depends: bytestring >= 0.10 && < 0.11 - if impl(ghc >= 7.2.1) - cpp-options: -DGENERICS - test-suite test-scientific type: exitcode-stdio-1.0 hs-source-dirs: test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scientific-0.3.4.0/src/Data/ByteString/Builder/Scientific.hs new/scientific-0.3.4.2/src/Data/ByteString/Builder/Scientific.hs --- old/scientific-0.3.4.0/src/Data/ByteString/Builder/Scientific.hs 2015-09-30 09:16:10.000000000 +0200 +++ new/scientific-0.3.4.2/src/Data/ByteString/Builder/Scientific.hs 2015-10-10 10:42:48.000000000 +0200 @@ -22,6 +22,8 @@ import Data.ByteString.Builder.Extra (byteStringCopy) #endif +import Utils (roundTo, i2d) + #if !MIN_VERSION_base(4,8,0) import Data.Monoid (mempty) #endif @@ -35,7 +37,6 @@ infixr 6 <> #endif -import Utils (roundTo, i2d) -- | A @ByteString@ @Builder@ which renders a scientific number to full -- precision, using standard decimal notation for arguments whose diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scientific-0.3.4.0/src/Data/Scientific.hs new/scientific-0.3.4.2/src/Data/Scientific.hs --- old/scientific-0.3.4.0/src/Data/Scientific.hs 2015-09-30 09:16:10.000000000 +0200 +++ new/scientific-0.3.4.2/src/Data/Scientific.hs 2015-10-10 10:42:48.000000000 +0200 @@ -5,10 +5,6 @@ {-# LANGUAGE UnboxedTuples #-} {-# LANGUAGE PatternGuards #-} -#ifdef GENERICS -{-# LANGUAGE DeriveGeneric #-} -#endif - -- | -- Module : Data.Scientific -- Copyright : Bas van Dijk 2013 @@ -102,7 +98,7 @@ import Data.Data (Data) import Data.Function (on) import Data.Hashable (Hashable(..)) -import qualified Data.Map.Strict as M (Map, empty, insert, lookup) +import qualified Data.Map as M (Map, empty, insert, lookup) import Data.Ratio ((%), numerator, denominator) import Data.Typeable (Typeable) import qualified Data.Vector as V @@ -127,10 +123,16 @@ import Data.Bits (shiftR) #endif -import GHC.Integer (quotRemInteger, divInteger, quotInteger) +import GHC.Integer (quotRemInteger, quotInteger) import Utils (roundTo) +#if MIN_VERSION_integer_gmp(0,5,1) +import GHC.Integer (divInteger) +#else +divInteger :: Integer -> Integer -> Integer +divInteger = div +#endif ---------------------------------------------------------------------- -- Type @@ -983,5 +985,6 @@ normalizePositive :: Integer -> Int -> (Integer, Int) normalizePositive c !e = case quotRemInteger c 10 of - (# c', 0 #) -> normalizePositive c' (e+1) - _ -> (c, e) + (# c', r #) + | r == 0 -> normalizePositive c' (e+1) + | otherwise -> (c, e) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scientific-0.3.4.0/src/Data/Text/Lazy/Builder/Scientific.hs new/scientific-0.3.4.2/src/Data/Text/Lazy/Builder/Scientific.hs --- old/scientific-0.3.4.0/src/Data/Text/Lazy/Builder/Scientific.hs 2015-09-30 09:16:10.000000000 +0200 +++ new/scientific-0.3.4.2/src/Data/Text/Lazy/Builder/Scientific.hs 2015-10-10 10:42:48.000000000 +0200 @@ -14,6 +14,8 @@ import Data.Text.Lazy.Builder (Builder, fromString, singleton, fromText) import Data.Text.Lazy.Builder.Int (decimal) import qualified Data.Text as T (replicate) +import Utils (roundTo, i2d) + #if MIN_VERSION_base(4,5,0) import Data.Monoid ((<>)) #else @@ -23,8 +25,6 @@ infixr 6 <> #endif -import Utils (roundTo, i2d) - -- | A @Text@ @Builder@ which renders a scientific number to full -- precision, using standard decimal notation for arguments whose -- absolute value lies between @0.1@ and @9,999,999@, and scientific diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scientific-0.3.4.0/src/GHC/Integer/Logarithms/Compat.hs new/scientific-0.3.4.2/src/GHC/Integer/Logarithms/Compat.hs --- old/scientific-0.3.4.0/src/GHC/Integer/Logarithms/Compat.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/scientific-0.3.4.2/src/GHC/Integer/Logarithms/Compat.hs 2015-10-10 10:42:48.000000000 +0200 @@ -0,0 +1,120 @@ +{-# LANGUAGE CPP, MagicHash, UnboxedTuples #-} + +module GHC.Integer.Logarithms.Compat + ( integerLog2# + , wordLog2# + ) where + +#if __GLASGOW_HASKELL__ >= 702 +import GHC.Integer.Logarithms (integerLog2#, wordLog2#) +#else +#include "MachDeps.h" + +import GHC.Integer.GMP.Internals (Integer(S#, J#)) + +import GHC.Base ( indexWordArray#, uncheckedIShiftL#, indexInt8Array# + , word2Int#, ByteArray#, newByteArray#, writeInt8Array# + , (==#), (<#), (+#), (*#) + , unsafeFreezeByteArray#, realWorld# + , neWord#, (-#), uncheckedShiftRL# + , Int#, Word#, int2Word# + ) + +#if (WORD_SIZE_IN_BITS != 32) && (WORD_SIZE_IN_BITS != 64) +#error Only word sizes 32 and 64 are supported. +#endif + + +#if WORD_SIZE_IN_BITS == 32 + +#define WSHIFT 5 +#define MMASK 31 + +#else + +#define WSHIFT 6 +#define MMASK 63 + +#endif + +-- | Calculate the integer base 2 logarithm of an 'Integer'. +-- The calculation is much more efficient than for the general case. +-- +-- The argument must be strictly positive, that condition is /not/ checked. +integerLog2# :: Integer -> Int# +integerLog2# (S# i) = wordLog2# (int2Word# i) +integerLog2# (J# s ba) = check (s -# 1#) + where + check i = case indexWordArray# ba i of + 0## -> check (i -# 1#) + w -> wordLog2# w +# (uncheckedIShiftL# i WSHIFT#) + +-- | This function calculates the integer base 2 logarithm of a 'Word#'. +-- @'wordLog2#' 0## = -1#@. +{-# INLINE wordLog2# #-} +wordLog2# :: Word# -> Int# +wordLog2# w = + case leadingZeros of + BA lz -> + let zeros u = indexInt8Array# lz (word2Int# u) in +#if WORD_SIZE_IN_BITS == 64 + case uncheckedShiftRL# w 56# of + a -> + if a `neWord#` 0## + then 64# -# zeros a + else + case uncheckedShiftRL# w 48# of + b -> + if b `neWord#` 0## + then 56# -# zeros b + else + case uncheckedShiftRL# w 40# of + c -> + if c `neWord#` 0## + then 48# -# zeros c + else + case uncheckedShiftRL# w 32# of + d -> + if d `neWord#` 0## + then 40# -# zeros d + else +#endif + case uncheckedShiftRL# w 24# of + e -> + if e `neWord#` 0## + then 32# -# zeros e + else + case uncheckedShiftRL# w 16# of + f -> + if f `neWord#` 0## + then 24# -# zeros f + else + case uncheckedShiftRL# w 8# of + g -> + if g `neWord#` 0## + then 16# -# zeros g + else 8# -# zeros w + +-- Lookup table +data BA = BA ByteArray# + +leadingZeros :: BA +leadingZeros = + let mkArr s = + case newByteArray# 256# s of + (# s1, mba #) -> + case writeInt8Array# mba 0# 9# s1 of + s2 -> + let fillA lim val idx st = + if idx ==# 256# + then st + else if idx <# lim + then case writeInt8Array# mba idx val st of + nx -> fillA lim val (idx +# 1#) nx + else fillA (2# *# lim) (val -# 1#) idx st + in case fillA 2# 8# 1# s2 of + s3 -> case unsafeFreezeByteArray# mba s3 of + (# _, ba #) -> ba + in case mkArr realWorld# of + b -> BA b +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scientific-0.3.4.0/src/Math/NumberTheory/Logarithms.hs new/scientific-0.3.4.2/src/Math/NumberTheory/Logarithms.hs --- old/scientific-0.3.4.0/src/Math/NumberTheory/Logarithms.hs 2015-09-30 09:16:10.000000000 +0200 +++ new/scientific-0.3.4.2/src/Math/NumberTheory/Logarithms.hs 2015-10-10 10:42:48.000000000 +0200 @@ -20,117 +20,7 @@ #endif ) -#if __GLASGOW_HASKELL__ >= 702 -import GHC.Integer.Logarithms (integerLog2#, wordLog2#) -#else -#include "MachDeps.h" - -import GHC.Integer.GMP.Internals (Integer(S#, J#)) - -import GHC.Base ( indexWordArray#, uncheckedIShiftL#, indexInt8Array# - , word2Int#, ByteArray#, newByteArray#, writeInt8Array# - , (==#), (<#), (+#), (*#) - , unsafeFreezeByteArray#, realWorld# - ) - -#if (WORD_SIZE_IN_BITS != 32) && (WORD_SIZE_IN_BITS != 64) -#error Only word sizes 32 and 64 are supported. -#endif - - -#if WORD_SIZE_IN_BITS == 32 - -#define WSHIFT 5 -#define MMASK 31 - -#else - -#define WSHIFT 6 -#define MMASK 63 - -#endif - --- | Calculate the integer base 2 logarithm of an 'Integer'. --- The calculation is much more efficient than for the general case. --- --- The argument must be strictly positive, that condition is /not/ checked. -integerLog2# :: Integer -> Int# -integerLog2# (S# i) = wordLog2# (int2Word# i) -integerLog2# (J# s ba) = check (s -# 1#) - where - check i = case indexWordArray# ba i of - 0## -> check (i -# 1#) - w -> wordLog2# w +# (uncheckedIShiftL# i WSHIFT#) - --- | This function calculates the integer base 2 logarithm of a 'Word#'. --- @'wordLog2#' 0## = -1#@. -{-# INLINE wordLog2# #-} -wordLog2# :: Word# -> Int# -wordLog2# w = - case leadingZeros of - BA lz -> - let zeros u = indexInt8Array# lz (word2Int# u) in -#if WORD_SIZE_IN_BITS == 64 - case uncheckedShiftRL# w 56# of - a -> - if a `neWord#` 0## - then 64# -# zeros a - else - case uncheckedShiftRL# w 48# of - b -> - if b `neWord#` 0## - then 56# -# zeros b - else - case uncheckedShiftRL# w 40# of - c -> - if c `neWord#` 0## - then 48# -# zeros c - else - case uncheckedShiftRL# w 32# of - d -> - if d `neWord#` 0## - then 40# -# zeros d - else -#endif - case uncheckedShiftRL# w 24# of - e -> - if e `neWord#` 0## - then 32# -# zeros e - else - case uncheckedShiftRL# w 16# of - f -> - if f `neWord#` 0## - then 24# -# zeros f - else - case uncheckedShiftRL# w 8# of - g -> - if g `neWord#` 0## - then 16# -# zeros g - else 8# -# zeros w - --- Lookup table -data BA = BA ByteArray# - -leadingZeros :: BA -leadingZeros = - let mkArr s = - case newByteArray# 256# s of - (# s1, mba #) -> - case writeInt8Array# mba 0# 9# s1 of - s2 -> - let fillA lim val idx st = - if idx ==# 256# - then st - else if idx <# lim - then case writeInt8Array# mba idx val st of - nx -> fillA lim val (idx +# 1#) nx - else fillA (2# *# lim) (val -# 1#) idx st - in case fillA 2# 8# 1# s2 of - s3 -> case unsafeFreezeByteArray# mba s3 of - (# _, ba #) -> ba - in case mkArr realWorld# of - b -> BA b -#endif +import GHC.Integer.Logarithms.Compat (integerLog2#, wordLog2#) -- | Only defined for positive inputs! integerLog10' :: Integer -> Int
participants (1)
-
root@hilbert.suse.de