Swiftpack.co - Package - Jitsusama/UInt128

UInt128

A Swift 128-bit Unsigned Integer Data Type conforming to the UnsignedInteger, FixedWidth, BinaryInteger, Hashable, Numeric, Equatable, ExpressibleByIntegerLiteral, CustomStringConvertible, CustomDebugStringConvertible, Comparable, ExpressibleByStringLiteral and Codable (thanks @adamnemecek) Protocols, as well as extending the BinaryFloatingPoint and String types to support operating with its new type.

Carthage compatible

Installation

This library includes Carthage, CocoaPods and SPM support out of the box. Reference this git repository in a Podfile, Cartfile or Package.swift file in order to easily include this library while also being able to easily track changes.

You can also manually copy over the Sources/UInt128.swift file into your project and it should work great. I've purposely kept this library constrained to a single file in order to support this use case.

Usage

Since this library fully implements the UnsignedInteger protocol, you can use this data type just like any other native UInt data type. For numbers larger than UIntMax, you'll either want to call the init(upperBits: UInt64, lowerBits: UInt64) initializer, or, use the init(stringLiteral: String) initializer to create an instance with a string. The string can be in binary, octal, decimal or hexadecimal.

For example:

let uInt128ByString: UInt128 = "0xffaabbcc00129823fa9a12d4aa87f498"
let uInt128ByInteger: UInt128 = 1234

Building

This project includes an example Xcode project for building the framework that also includes a playground that can be utilized for testing things out. This Xcode project can build from one target a iphone, iphonesimulator or macos build. It also includes unit testing and code coverage.

Github

link
Stars: 32
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

0.8.0 - Apr 15, 2018

This release introduces CocoaPods support as well as resolving some annoying warnings that Xcode has started giving out recently related to the bitWidth property.

v0.7.0 - Oct 8, 2017

Introduces Swift 4.0 support.

v0.6.0 - May 29, 2017

Deprecates the advancedBy(), distanceTo(), successor() and predecessor() methods, while introducing the advanced(by:) and distance(to:) methods.

Also includes a number of code cleanups under the hood.

v0.5.0 - May 29, 2017

This release includes support for the Swift Package Manager (SPM).

v0.4.0 - May 6, 2017

This release includes prebuilt framework support for Carthage dependency manager, while also including a shared build scheme for building the project via Carthage. It also updates the Xcode project version compatibility to Xcode 8.0.