Giter Club home page Giter Club logo

bigint's People

Contributors

andrew-valt avatar arkichek avatar arrrnas avatar bouke avatar dagerydoo avatar dankogai avatar fabiotacke avatar harlanhaskins avatar haydenmccabe avatar laurivers avatar liarprincess avatar lorentey avatar mau888 avatar mayoff avatar metalurgical avatar nvzqz avatar ratranqu avatar tg908 avatar tgymnich avatar tiza59 avatar xanderdunn avatar ypopovych avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bigint's Issues

Cannot compile against latest Swift 4.1 snapshot

There are some changes in Swift 4.1 that result in a breaking change for BigInt, it seems.

Compile Swift Module 'BigInt' (22 sources)
/Users/bouke/Library/Mobile Documents/com~apple~CloudDocs/Developer/SRP/.build/checkouts/BigInt.git--5127040856227023039/sources/Words and Bits.swift:90:19: error: type 'BigUInt.Words' does not conform to protocol 'BidirectionalCollection'
    public struct Words: RandomAccessCollection {
                  ^
Swift.RandomAccessCollection:16:17: note: candidate has non-matching type '<Self> (before: Self.Index) -> Self.Index' [with Element = BigUInt.Words.Element, Index = BigUInt.Words.Index, SubSequence = BigUInt.Words.SubSequence, Indices = BigUInt.Words.Indices]
    public func index(before i: Self.Index) -> Self.Index
                ^
Swift.BidirectionalCollection:36:17: note: protocol requires function 'index(before:)' with type '(BigUInt.Words.Index) -> BigUInt.Words.Index' (aka '(Int) -> Int'); do you want to add a stub?
    public func index(before i: Self.Index) -> Self.Index
                ^
/Users/bouke/Library/Mobile Documents/com~apple~CloudDocs/Developer/SRP/.build/checkouts/BigInt.git--5127040856227023039/sources/Words and Bits.swift:90:19: error: type 'BigUInt.Words' does not conform to protocol 'Collection'
    public struct Words: RandomAccessCollection {
                  ^
Swift.RandomAccessCollection:10:17: note: candidate has non-matching type '<Self> (after: Self.Index) -> Self.Index' [with Element = BigUInt.Words.Element, Index = BigUInt.Words.Index, Iterator = IndexingIterator<BigUInt.Words>, SubSequence = BigUInt.Words.SubSequence, Indices = BigUInt.Words.Indices]
    public func index(after i: Self.Index) -> Self.Index
                ^
Swift.Collection:589:17: note: protocol requires function 'index(after:)' with type '(BigUInt.Words.Index) -> BigUInt.Words.Index' (aka '(Int) -> Int'); do you want to add a stub?
    public func index(after i: Self.Index) -> Self.Index
                ^
/Users/bouke/Library/Mobile Documents/com~apple~CloudDocs/Developer/SRP/.build/checkouts/BigInt.git--5127040856227023039/sources/Words and Bits.swift:90:19: error: type 'BigUInt.Words' does not conform to protocol 'BidirectionalCollection'
    public struct Words: RandomAccessCollection {
                  ^
Swift.RandomAccessCollection:16:17: note: candidate has non-matching type '<Self> (before: Self.Index) -> Self.Index' [with Element = BigUInt.Words.Element, Index = BigUInt.Words.Index, SubSequence = BigUInt.Words.SubSequence, Indices = BigUInt.Words.Indices]
    public func index(before i: Self.Index) -> Self.Index
                ^
Swift.BidirectionalCollection:36:17: note: protocol requires function 'index(before:)' with type '(BigUInt.Words.Index) -> BigUInt.Words.Index' (aka '(Int) -> Int'); do you want to add a stub?
    public func index(before i: Self.Index) -> Self.Index
                ^
/Users/bouke/Library/Mobile Documents/com~apple~CloudDocs/Developer/SRP/.build/checkouts/BigInt.git--5127040856227023039/sources/Words and Bits.swift:90:19: error: type 'BigUInt.Words' does not conform to protocol 'Collection'
    public struct Words: RandomAccessCollection {
                  ^
Swift.RandomAccessCollection:10:17: note: candidate has non-matching type '<Self> (after: Self.Index) -> Self.Index' [with Element = BigUInt.Words.Element, Index = BigUInt.Words.Index, Iterator = IndexingIterator<BigUInt.Words>, SubSequence = BigUInt.Words.SubSequence, Indices = BigUInt.Words.Indices]
    public func index(after i: Self.Index) -> Self.Index
                ^
Swift.Collection:589:17: note: protocol requires function 'index(after:)' with type '(BigUInt.Words.Index) -> BigUInt.Words.Index' (aka '(Int) -> Int'); do you want to add a stub?
    public func index(after i: Self.Index) -> Self.Index
                ^
/Users/bouke/Library/Mobile Documents/com~apple~CloudDocs/Developer/SRP/.build/checkouts/BigInt.git--5127040856227023039/sources/Words and Bits.swift:90:19: error: type 'BigUInt.Words' does not conform to protocol 'BidirectionalCollection'
    public struct Words: RandomAccessCollection {
                  ^
Swift.RandomAccessCollection:16:17: note: candidate has non-matching type '<Self> (before: Self.Index) -> Self.Index' [with Element = BigUInt.Words.Element, Index = BigUInt.Words.Index, SubSequence = BigUInt.Words.SubSequence, Indices = BigUInt.Words.Indices]
    public func index(before i: Self.Index) -> Self.Index
                ^
Swift.BidirectionalCollection:36:17: note: protocol requires function 'index(before:)' with type '(BigUInt.Words.Index) -> BigUInt.Words.Index' (aka '(Int) -> Int'); do you want to add a stub?
    public func index(before i: Self.Index) -> Self.Index
                ^
/Users/bouke/Library/Mobile Documents/com~apple~CloudDocs/Developer/SRP/.build/checkouts/BigInt.git--5127040856227023039/sources/Words and Bits.swift:90:19: error: type 'BigUInt.Words' does not conform to protocol 'Collection'
    public struct Words: RandomAccessCollection {
                  ^
Swift.RandomAccessCollection:10:17: note: candidate has non-matching type '<Self> (after: Self.Index) -> Self.Index' [with Element = BigUInt.Words.Element, Index = BigUInt.Words.Index, Iterator = IndexingIterator<BigUInt.Words>, SubSequence = BigUInt.Words.SubSequence, Indices = BigUInt.Words.Indices]
    public func index(after i: Self.Index) -> Self.Index
                ^
Swift.Collection:589:17: note: protocol requires function 'index(after:)' with type '(BigUInt.Words.Index) -> BigUInt.Words.Index' (aka '(Int) -> Int'); do you want to add a stub?
    public func index(after i: Self.Index) -> Self.Index
                ^
/Users/bouke/Library/Mobile Documents/com~apple~CloudDocs/Developer/SRP/.build/checkouts/BigInt.git--5127040856227023039/sources/Words and Bits.swift:90:19: error: type 'BigUInt.Words' does not conform to protocol 'BidirectionalCollection'
    public struct Words: RandomAccessCollection {
                  ^
Swift.RandomAccessCollection:16:17: note: candidate has non-matching type '<Self> (before: Self.Index) -> Self.Index' [with Element = BigUInt.Words.Element, Index = BigUInt.Words.Index, SubSequence = BigUInt.Words.SubSequence, Indices = BigUInt.Words.Indices]
    public func index(before i: Self.Index) -> Self.Index
                ^
Swift.BidirectionalCollection:36:17: note: protocol requires function 'index(before:)' with type '(BigUInt.Words.Index) -> BigUInt.Words.Index' (aka '(Int) -> Int'); do you want to add a stub?
    public func index(before i: Self.Index) -> Self.Index
                ^
/Users/bouke/Library/Mobile Documents/com~apple~CloudDocs/Developer/SRP/.build/checkouts/BigInt.git--5127040856227023039/sources/Words and Bits.swift:90:19: error: type 'BigUInt.Words' does not conform to protocol 'Collection'
    public struct Words: RandomAccessCollection {
                  ^
Swift.RandomAccessCollection:10:17: note: candidate has non-matching type '<Self> (after: Self.Index) -> Self.Index' [with Element = BigUInt.Words.Element, Index = BigUInt.Words.Index, Iterator = IndexingIterator<BigUInt.Words>, SubSequence = BigUInt.Words.SubSequence, Indices = BigUInt.Words.Indices]
    public func index(after i: Self.Index) -> Self.Index
                ^
Swift.Collection:589:17: note: protocol requires function 'index(after:)' with type '(BigUInt.Words.Index) -> BigUInt.Words.Index' (aka '(Int) -> Int'); do you want to add a stub?
    public func index(after i: Self.Index) -> Self.Index
                ^

Add support for Swift 3.2 (Xcode 9)

I know that it's a bit early now, but being able to compile with Xcode 9 (and Swift 3.2) would be really cool (since code completion and the editor in general is SO much nicer in the new Xcode).

DYLIB_COMPATIBILITY_VERSION mismatch between Carthage and CocoaPods

I have an admittedly niche scenario, where some parts of my project pull in BigInt via Carthage, but others use CocoaPods.

Carthage picks up DYLIB_COMPATIBILITY_VERSION set in BigInt.xcodeproj with BUILD_NUMBER from your xcconfig, but CocoaPods doesn't use the xcodeproj in your repo. So the mismatched DYLIB_COMPATIBILITY_VERSION values in the various load commands causes a runtime crash in one of my apps.

There are some options for making the build outputs of both package managers more similar:

  1. Include the following in your podspec:
spec.pod_target_xcconfig = { "DYLIB_COMPATIBILITY_VERSION" => "<build-number>"}

You'd probably want to automate injecting the xcconfig's value into that; less ideally, you'd need to manually update it in both places each release.

  1. Alternatively, you could consider not setting the DYLIB_COMPATIBILITY_VERSION at all in your xcodeproj, so that you get the same build output from Carthage that you get from CocoaPods today, with a value of 1.

I'm currently working around this issue with a post_install hook that sets the same value, hardcoded to the value I look up in your releases.

πŸ™ I'm totally fine with this issue being closed as #wontfix because this really comes down to the difference in how the package managers work, not just your library. Anyways, thank you for your time and for your code!

Please push `5.0.0` to cocoapods repo

Hello, first of all, thank you for amazing work on the library!

Is it possible to push changes to cocoapods repo? We'd like to update our dependencies with Swift 5 version.

Thank you

crash if send string or invalid data to BigInt

i found crash if send invalid data to BigInt.
i think shouldn't use force unwrap inside your method and check value before use.

Screen Shot 2562-08-21 at 09 59 27

/// Initialize a new big integer from a decimal number represented by a string literal of arbitrary length.
/// The string must contain only decimal digits.

public init(stringLiteral value: StringLiteralType) {
    self = BigInt(value, radix: 10)!
}

Random BigInt Generation

Because I'm working on the RandomKitBigInt extension, I feel as though having the randomInteger() functions of BigUInt is slightly repetitive.

If removed, this would be a breaking change. However, the switch should be pretty seamless for library users.

The functions don't conflict, so there's no real problem with keeping them in the next major version of BigInt.

Convert BigInt division to decimal?

I'm trying to convert the result of dividing two BigInt values into Decimal. For example, I'm trying to represent 10 / 1,000 into Decimal (i.e. 0.01). How can that be achieved?

ShiftOperations Exposure

I like the idea of a ShiftOperations protocol that's essentially a cousin of BitwiseOperations. However, I feel as though the ShiftOperations protocol is outside of the scope of BigInt.

I made a separate module that simply contains this protocol. I make good use of it in nvzqz/RandomKit@4fdd456. Perhaps BigInt can import this module to satisfy that protocol?

If that isn't the direction you'd want to go, I feel as though ShiftOperations should at least have an internal access level rather than public because it is only used by BigDigit.

The initializer assumes to have a big endian UInt8 array and the `makeBytes` function creates a big endian UInt8 array

The initializer assumes to have a big endian UInt8 array and the makeBytes function creates a big endian UInt8 array

when l use the func in swift4, it shows error "Value of type 'BigUInt.Word' (aka 'UInt') has no member 'makeBytes'" and "Argument labels '(bytes:)' do not match any available overloads" . But l don't know how to solve the problem

Originally posted by @Ybrin in #39 (comment)

Remove dependency of Siphash

It would be very nice if the dependency of Siphash could be removed and replaced by the hasher you built into the Swift stdlib. Thanks for this great piece of software.

BigInt 3.0.3 crash in xcode 9 swift 4

include by carthage
in cartfile: github "attaswift/BigInt" ~> 3.0

yld: Library not loaded: @rpath/SipHash.framework/SipHash
Referenced from: /Users//Library/Developer/CoreSimulator/Devices/0A76CB65-0F98-4808-99A4-2C0B940D4C4F/data/Containers/Bundle/Application/153658BC-FB63-4CCA-B9F0-1E7AAE8ED4D5//Frameworks/BigInt.framework/BigInt
Reason: image not found
(lldb)

Xcode 9, swift 3

The new version (3.0.0) of BigInt doesn't compile on Xcode 9, are there any chance for support swift 3.2 ?

Can't build against Xcode 12.3

macOS 10.15.7
Xcode 12.3 RC

Using Carthage

$ carthage update
*** Fetching BigInt
*** Checking out BigInt at "v5.2.1"
*** xcodebuild output can be found in /var/folders/76/q9_yh34j5wd23ksxl7b70ssm0000gn/T/carthage-xcodebuild.sNVTfc.log
*** Building scheme "BigInt-macOS" in BigInt.xcworkspace
*** Building scheme "BigInt-tvOS" in BigInt.xcworkspace
Build Failed
	Task failed with exit code 1:
	/usr/bin/xcrun lipo -create /Users/joejoe/Library/Caches/org.carthage.CarthageKit/DerivedData/12.3_12C33/BigInt/v5.2.1/Build/Intermediates.noindex/ArchiveIntermediates/BigInt-tvOS/IntermediateBuildFilesPath/UninstalledProducts/appletvos/BigInt.framework/BigInt /Users/joejoe/Library/Caches/org.carthage.CarthageKit/DerivedData/12.3_12C33/BigInt/v5.2.1/Build/Products/Release-appletvsimulator/BigInt.framework/BigInt -output /Users/joejoe/Documents/CodeProjects/MyProject1/Carthage/Build/tvOS/BigInt.framework/BigInt

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/76/q9_yh34j5wd23ksxl7b70ssm0000gn/T/carthage-xcodebuild.sNVTfc.log

When I try to run the above command manually, I get this:

/usr/bin/xcrun lipo -create /Users/joejoe/Library/Caches/org.carthage.CarthageKit/DerivedData/12.3_12C33/BigInt/v5.2.1/Build/Intermediates.noindex/ArchiveIntermediates/BigInt-tvOS/IntermediateBuildFilesPath/UninstalledProducts/appletvos/BigInt.framework/BigInt /Users/joejoe/Library/Caches/org.carthage.CarthageKit/DerivedData/12.3_12C33/BigInt/v5.2.1/Build/Products/Release-appletvsimulator/BigInt.framework/BigInt -output /Users/joejoe/Documents/CodeProjects/MyProject1/Carthage/Build/tvOS/BigInt.framework/BigInt
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: /Users/joejoe/Library/Caches/org.carthage.CarthageKit/DerivedData/12.3_12C33/BigInt/v5.2.1/Build/Intermediates.noindex/ArchiveIntermediates/BigInt-tvOS/IntermediateBuildFilesPath/UninstalledProducts/appletvos/BigInt.framework/BigInt and /Users/joejoe/Library/Caches/org.carthage.CarthageKit/DerivedData/12.3_12C33/BigInt/v5.2.1/Build/Products/Release-appletvsimulator/BigInt.framework/BigInt have the same architectures (arm64) and can't be in the same fat output file

The last line in the log file carthage-xcodebuild.sNVTfc.log noted above says "*** BUILD SUCCEEDED ***"

Not sure what's going on here. This is my first Xcode project and I just installed Carthage 10m ago.

Possibly deprecating some initializers.

Howdy.

I'm curious if some of the initializers should be deprecated:

For BigInt:

    public init?<T>(exactly source: T) where T : BinaryInteger {
        self.init(source)
    }

This optional initializer should never return nil, as any value that can be represented by a BinaryInteger can be represented as a BigInt, as BigInt has a wider possible range than any fixed-size integer type.

    public init<T>(clamping source: T) where T : BinaryInteger {
        self.init(source)
    }

Similarly, clamping is not needed, as BigInt has the needed range to cover any fixed-width BinaryInteger type.

    public init<T>(truncatingIfNeeded source: T) where T : BinaryInteger {
        self.init(source)
    }

Truncating doesn't seem to apply to the case of initializing a BigInt from another Integer value

For BigUInt:

    public init<T: BinaryInteger>(truncatingIfNeeded source: T) {
        self.init(words: source.words)
    }

As for BigInt, it seems there won't be a case where truncating would be needed.

  public init?<T: BinaryInteger>(exactly source: T) {
       guard source >= (0 as T) else { return nil }
       if source.bitWidth <= 2 * Word.bitWidth {
           var it = source.words.makeIterator()
           self.init(low: it.next() ?? 0, high: it.next() ?? 0)
           precondition(it.next() == nil, "Length of BinaryInteger.words is greater than its bitWidth")
       }
       else {
           self.init(words: source.words)
       }
   }

   public init<T: BinaryInteger>(_ source: T) {
       precondition(source >= (0 as T), "BigUInt cannot represent negative values")
       self.init(exactly: source)!
   }

With this pair of initializers, the first, optional initializer seems like it would correctly return nil for negative values, and an exact value for a non-negative argument. The second initializer, however, gives the same results, with the code crashing if a negative value is used. Perhaps they could be consolidated into a single optional initializer without precondition.

In debug mode, taking too much time to calculate exponential comparable to Android native BigInteger.

Below exponential calculation (2048 bits) is taking around 5s whereas same calculation using Android native BigInteger is taking around 100ms.

        let N = BigUInt("AC6BDB41324A9A9BF166DE5E1389582FAF72B6651987EE07FC3192943DB56050A37329CBB4A099ED8193E0757767A13DD52312AB4B03310DCD7F48A9DA04FD50E8083969EDB767B0CF6095179A163AB3661A05FBD5FAAAE82918A9962F0B93B855F97993EC975EEAA80D740ADBF4FF747359D041D5C33EA71D281E446B14773BCA97B43A23FB801676BD207A436C6481F1D2B9078717461A5B9D32E688F87748544523B524B0D57D5EA77A2775D2ECFA032CFBDBF52FB3786160279004E57AE6AF874E7303CE53299CCC041C7BC308D82A5698F3A8D0C38271AE35F8E9DBFBB694B5C803D89F7AE435DE236D525F54759B65E372FCD68EF20FA7111F9E4AFF73", radix: 16)!
        let g = BigUInt(2)
        let a = BigUInt("601e4cdbc9ceadbd116fff9331c689b03d9770f5d4da80f8e0fe826f01104e9bb52d68a7bc38519d77d0463f4bc67cf9d13588e03324c7c79a6931dfc3d5b4b3b4014ec08820be1af9f9a056350ccaada53f063568671bd717217be2f90e948d037e00ea348f1bb4f99ca16ca4f11a889529afe80229127b10e85001c6654fbdb805f1122dc1b10679334228ab86ab65a3192f0368ca21f45e966e65adab6bf752844828b25923ad98da909c1b2ffae21625ce6095f0d15601475edd44a7a6979a48339f0265fabe7cb864a56e583c35f838eaa00e676658df7e091a5a3cf346f4df3ce65ed5633b7bb3ea7c2dec982a4ec9c7c6ad9eb3da33cf635ed6094c24", radix: 16)!
        let start = Date()
        let A = g.power(a, modulus: N)
        print("Elapsed time: \(Date().timeIntervalSince(start))")

Hi. I Made extension for BigInt to Data and reverse.

extension BigInt {
    
    public func serialize() -> Data {
        var array = Array(BigUInt.init(self.magnitude).serialize())
        
        if array.count > 0 {
            if self.sign == BigInt.Sign.plus {
                if array[0] >= 128 {
                    array.insert(0, at: 0)
                }
            } else if self.sign == BigInt.Sign.minus {
                if array[0] <= 127 {
                    array.insert(255, at: 0)
                }
            }
        }
        
        return Data.init(bytes: array)
    }
    
    public init(_ data: Data) {
        var dataArray = Array(data)
        var sign: BigInt.Sign = BigInt.Sign.plus
        
        if dataArray.count > 0 {
            if dataArray[0] >= 128 {
                sign = BigInt.Sign.minus
                
                if dataArray.count > 1 {
                    if dataArray[0] == 255, dataArray.count > 1 {
                        dataArray.remove(at: 0)
                    } else {
                        dataArray[0] = UInt8(256 - Int(dataArray[0]))
                    }
                }
            }
        }
        
        let magnitude = BigUInt.init(Data.init(bytes: dataArray))
        
        self .init(sign: sign, magnitude: magnitude)
    }
}

Computational overhead

hello,

Thank you for open source this Arbitrary-precision arithmetic.
When I use this to test paillier algorithm computational overhead, this function

func power(exponent: BigUInt, modulus: BigUInt) -> BigUInt{}

, the Java modPower computational overhead about 45ms but this function about 2.7s, cause some distortion.
The overhead test code at here: https://github.com/SummonY/Paillier_iOS

Can you help to optimize this function?

Thanks,
Summon Yang

Code signing issue with generate-docs.sh

generate-docs.sh is being included in the framework bundle.

This causes a failed validation when preparing for an app store upload.

is generate-docs.sh really needed int the bundle?

to [UInt8] array?

Will a function be added to cast a BigInt to a byte array like in Java's BigInteger?

Consistent "Comparable"?

This is a minor point which doesn't affect functionality at all, but does slightly affect the API documentation, and it confused me for a little while.

In BigInt/Comparable.swift, it's extension BigUInt: Comparable, but extension BigInt (with no conformances listed). Both extensions define < and ==, and in fact both types are Comparable. It took me a little while to figure out how.

(BigInt/BigUInt -> SignedInteger/UnsignedInteger -> BinaryInteger -> Strideable -> Comparable)

Declaring BigUInt: Comparable is technically redundant. (It's a nice reminder, though, that this type is Comparable.) It would be less confusing if either both types were marked Comparable, or neither were. Thanks!

Duplicate product 'BigInt'

In the product definition there are two products named "BigInt". As seen on the latest snapshot of Swift and this bug, this is probably an invalid declaration.

swift package show-dependencies
.
β”œβ”€β”€ Cryptor<https://github.com/IBM-Swift/[email protected].21>
β”‚   └── CommonCrypto<https://github.com/IBM-Swift/[email protected].5>
└── BigInt<https://github.com/attaswift/[email protected].1>
    └── SipHash<https://github.com/attaswift/[email protected].0>
'BigInt' /Users/bouke/Library/Mobile Documents/com~apple~CloudDocs/Developer/SRP/.build/checkouts/BigInt.git--5127040856227023039: warning: Ignoring duplicate product 'BigInt' (static)

Cannot assign to property: 'kind' setter is inaccessible

After upgrading from 2.1.2 to 3.0.0 (and upgrading from Xcode 8.3.3 to 9.0), I am getting the error "Cannot assign to property: 'kind' setter is inaccessible, Cannot assign to property: 'storage' setter is inaccessible".

It is better for you that change "private" to β€œfileprivate” because the code you input always show as error on laptop.

big double?

Hi,

Any plan to support big double? Say, to count division up to n digit precision. You know, like digit of pi calculation but more natural.

Thank you.

-Bee

Release 5.1.0 cocoapod

Hi there, i saw that you made a release 5.1 for BigInt.
Unfortunately, it does not seem to be available via cocoapods.

None of your spec sources contain a spec satisfying the dependency: BigInt (= 5.1.0)

Could you push it to cocoapods?

BigInt 2.1.2 with Xcode 9.2 and Swift 3.2

Hello,

Currently I'm using BigInit 2.1 with Xcode 8.3 and Swift 3.2 without any problem. However, after upgrading to BigInt 2.1.2 with Xcode 9.2 and Swift 3.2, I got the following error

image

Can you help to take a look to see if it's a known issue or if something wrong in my configuration?

Last but not least, thanks a lot for writing a great lib to work with big integer.

version 2.1.2 and SipHash

There is an issue with pod spec for version 2.1.2, it contains SipHash dependency with version ~> 1.1 which means version 1.2 on pod update, but version 1.2 is for swift 4.0.

Edit:
it's an issue till version 2.1.0 included

Build Causes Swift Compiler Crash on Latest Swift Trunk

I am developing machine learning models on Ubuntu 18.04 using the Swift for Tensorflow v0.11 toolchain.

$ which swift
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift
$ swift --version
Swift version 5.3-dev (LLVM db8896f3f345af2, Swift 61684f62a6132c0)
Target: x86_64-unknown-linux-gnu
$ swift build
swift-frontend: /swift-base/swift/lib/AST/GenericSignature.cpp:251: static swift::CanGenericSignature swift::CanGenericSignature::getCanonical(TypeArrayView<swift::GenericTypeParamType>, ArrayRef<swift::Requirement>, bool): Assertion `isCanonicalAnchor(secondType)' failed.
Stack dump:
0.	Program arguments: /home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend -frontend -c /home/xander/dev/BigInt/Sources/Addition.swift /home/xander/dev/BigInt/Sources/BigInt.swift /home/xander/dev/BigInt/Sources/BigUInt.swift /home/xander/dev/BigInt/Sources/Bitwise Ops.swift /home/xander/dev/BigInt/Sources/Codable.swift /home/xander/dev/BigInt/Sources/Comparable.swift -primary-file /home/xander/dev/BigInt/Sources/Data Conversion.swift -primary-file /home/xander/dev/BigInt/Sources/Division.swift -primary-file /home/xander/dev/BigInt/Sources/Exponentiation.swift -primary-file /home/xander/dev/BigInt/Sources/Floating Point Conversion.swift -primary-file /home/xander/dev/BigInt/Sources/GCD.swift -primary-file /home/xander/dev/BigInt/Sources/Hashable.swift /home/xander/dev/BigInt/Sources/Integer Conversion.swift /home/xander/dev/BigInt/Sources/Multiplication.swift /home/xander/dev/BigInt/Sources/Prime Test.swift /home/xander/dev/BigInt/Sources/Random.swift /home/xander/dev/BigInt/Sources/Shifts.swift /home/xander/dev/BigInt/Sources/Square Root.swift /home/xander/dev/BigInt/Sources/Strideable.swift /home/xander/dev/BigInt/Sources/String Conversion.swift /home/xander/dev/BigInt/Sources/Subtraction.swift /home/xander/dev/BigInt/Sources/Words and Bits.swift -supplementary-output-file-map /tmp/supplementaryOutputs-9577c2 -target x86_64-unknown-linux-gnu -disable-objc-interop -I /home/xander/dev/BigInt/.build/x86_64-unknown-linux-gnu/debug -color-diagnostics -enable-testing -g -module-cache-path /home/xander/dev/BigInt/.build/x86_64-unknown-linux-gnu/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -enable-anonymous-context-mangled-names -parse-as-library -module-name BigInt -o /home/xander/dev/BigInt/.build/x86_64-unknown-linux-gnu/debug/BigInt.build/Data Conversion.swift.o -o /home/xander/dev/BigInt/.build/x86_64-unknown-linux-gnu/debug/BigInt.build/Division.swift.o -o /home/xander/dev/BigInt/.build/x86_64-unknown-linux-gnu/debug/BigInt.build/Exponentiation.swift.o -o /home/xander/dev/BigInt/.build/x86_64-unknown-linux-gnu/debug/BigInt.build/Floating Point Conversion.swift.o -o /home/xander/dev/BigInt/.build/x86_64-unknown-linux-gnu/debug/BigInt.build/GCD.swift.o -o /home/xander/dev/BigInt/.build/x86_64-unknown-linux-gnu/debug/BigInt.build/Hashable.swift.o -index-store-path /home/xander/dev/BigInt/.build/x86_64-unknown-linux-gnu/debug/index/store -index-system-modules
1.	Swift version 5.3-dev (LLVM db8896f3f345af2, Swift 61684f62a6132c0)
2.	While evaluating request TypeCheckSourceFileRequest(source_file "/home/xander/dev/BigInt/Sources/Division.swift")
3.	While type-checking extension of FixedWidthInteger (at /home/xander/dev/BigInt/Sources/Division.swift:11:1)
4.	While type-checking declaration 0x8acfa30 (at /home/xander/dev/BigInt/Sources/Division.swift:12:13)
5.	While evaluating request PatternBindingEntryRequest((unknown decl), 0)
6.	While evaluating request PatternTypeRequest((pattern @ 0x8acf618))
7.	While canonicalizing generic signature <Ο„_0_0 where Ο„_0_0 : FixedWidthInteger, Ο„_0_0 == Ο„_0_0.Magnitude, Ο„_0_0.Magnitude == Ο„_0_0.Magnitude.Magnitude.Magnitude> in requirement #2
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x5214dc4]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x52129be]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x521509c]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x128a0)[0x7f6d86e128a0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7f6d856b4f47]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7f6d856b68b1]
/lib/x86_64-linux-gnu/libc.so.6(+0x3042a)[0x7f6d856a642a]
/lib/x86_64-linux-gnu/libc.so.6(+0x304a2)[0x7f6d856a64a2]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x193f72e]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x193e98d]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x193e87c]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x193fb27]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x18805a5]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x1418ecf]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x13a2636]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x13f4788]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x13a8cb7]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x13a87b6]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x13a1f61]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x13a1f34]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x1400212]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x137a793]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x137a4af]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x136cc71]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x14d180f]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x14d0871]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x14d3fab]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x14d0871]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x14d07a1]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x142b995]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x142cc70]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x142c9a7]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x142c8b1]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x142b6de]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x142b6b4]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x63d3c9]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x63d296]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x4fd485]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x490dd8]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f6d85697b97]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x49098a]

This occurs on all the tags I tried: v5.1.0,v5.2.0, v5.0.0, and v4.0.0.

Note that I do not have this issue on the previous version of Swift for Tensorflow, v0.10. This issue is new to v0.11.

Note also that I do not have this issue when building on macOS 10.15.6 with Swift for Tensorflow v0.11 when linking against the Xcode 12 beta macOS SDK.

Note also that this does not occur with the official Swift v5.3 development snapshot for Ubuntu 18.04:

$ which swift
/home/xander/swift-5.3-DEVELOPMENT-SNAPSHOT-2020-08-31-a-ubuntu18.04/usr/bin/swift
$ swift --version
Swift version 5.3-dev (LLVM 3fa9679add, Swift d24649a4d6)
Target: x86_64-unknown-linux-gnu

It appears to be specific to Ubuntu 18.04 + Swift for Tensorflow v0.11. Issue I filed against the Swift for Tensorflow project: tensorflow/swift#522.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.