Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support integer-simple #2

Merged
merged 2 commits into from
Jan 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1.0.1
-----

- Add support for `integer-simple`
19 changes: 15 additions & 4 deletions integer-logarithms.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: integer-logarithms
version: 1
version: 1.0.1
cabal-version: >= 1.10
author: Daniel Fischer
copyright: (c) 2011 Daniel Fischer
Expand Down Expand Up @@ -31,7 +31,12 @@ tested-with :
GHC==7.10.3,
GHC==8.0.1

extra-source-files : readme.md
extra-source-files : readme.md changelog.md

flag integer-gmp
description: integer-gmp or integer-simple
default: True
manual: False

flag check-bounds
description: Replace unsafe array operations with safe ones
Expand All @@ -44,13 +49,19 @@ library
build-depends:
base >= 4.3 && < 4.10,
array >= 0.3 && < 0.6,
ghc-prim < 0.6,
integer-gmp < 1.1
ghc-prim < 0.6
if impl(ghc >= 7.10)
cpp-options: -DBase48
else
build-depends: nats >= 1.1 && <1.2

if flag(integer-gmp)
build-depends:
integer-gmp < 1.1
else
build-depends:
integer-simple

exposed-modules:
Math.NumberTheory.Logarithms
Math.NumberTheory.Powers.Integer
Expand Down
4 changes: 2 additions & 2 deletions src/Math/NumberTheory/Logarithms.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import Data.Array.Unboxed
import Numeric.Natural

import GHC.Integer.Logarithms.Compat
#if Base48
#if Base48 && defined(MIN_VERSION_integer_gmp)
import GHC.Integer.GMP.Internals (Integer (..))
import GHC.Natural
#endif
Expand Down Expand Up @@ -316,7 +316,7 @@ fromNatural :: Num a => Natural -> a
fromNatural = fromIntegral

naturalLog2# :: Natural -> Int#
#if Base48
#if Base48 && defined(MIN_VERSION_integer_gmp)
naturalLog2# (NatS# b) = wordLog2# b
naturalLog2# (NatJ# n) = integerLog2# (Jp# n)
#else
Expand Down