Skip to content

Commit

Permalink
[NBKCoreKit] Namespace aliases (#85).
Browse files Browse the repository at this point in the history
  • Loading branch information
oscbyspro committed Sep 23, 2023
1 parent 006780e commit 50e0e8a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 6 deletions.
48 changes: 48 additions & 0 deletions Sources/NBKCoreKit/Private/NBK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,51 @@
/// An integer split into three parts.
public typealias Wide3<T> = (high: T, mid: T.Magnitude, low: T.Magnitude) where T: NBKFixedWidthInteger
}

//*============================================================================*
// MARK: * NBK x Namespaces x Aliases
//*============================================================================*
// NOTE: * Package level access control does not exist in Swift 5.7.
//=----------------------------------------------------------------------------=

/// A namespace for `Numberick` development.
///
/// - Warning: Do not use this namespace outside of `Numberick` development.
///
public typealias SBI<Base> = NBK.StrictBinaryInteger<Base> where
Base: RandomAccessCollection, Base.Element: NBKCoreInteger & NBKUnsignedInteger

/// A namespace for `Numberick` development.
///
/// - Warning: Do not use this namespace outside of `Numberick` development.
///
public typealias SBISS<Base> = NBK.StrictBinaryInteger<Base>.SubSequence where
Base: RandomAccessCollection, Base.Element: NBKCoreInteger & NBKUnsignedInteger

/// A namespace for `Numberick` development.
///
/// - Warning: Do not use this namespace outside of `Numberick` development.
///
public typealias SSI<Base> = NBK.StrictSignedInteger<Base> where
Base: RandomAccessCollection, Base.Element: NBKCoreInteger & NBKUnsignedInteger

/// A namespace for `Numberick` development.
///
/// - Warning: Do not use this namespace outside of `Numberick` development.
///
public typealias SSISS<Base> = NBK.StrictSignedInteger<Base>.SubSequence where
Base: RandomAccessCollection, Base.Element: NBKCoreInteger & NBKUnsignedInteger

/// A namespace for `Numberick` development.
///
/// - Warning: Do not use this namespace outside of `Numberick` development.
///
public typealias SUI<Base> = NBK.StrictUnsignedInteger<Base> where
Base: RandomAccessCollection, Base.Element: NBKCoreInteger & NBKUnsignedInteger

/// A namespace for `Numberick` development.
///
/// - Warning: Do not use this namespace outside of `Numberick` development.
///
public typealias SUISS<Base> = NBK.StrictUnsignedInteger<Base>.SubSequence where
Base: RandomAccessCollection, Base.Element: NBKCoreInteger & NBKUnsignedInteger
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ extension NBK.StrictUnsignedInteger.SubSequence where Base: MutableCollection {
///
@inlinable public static func incrementInIntersection(
_ base: inout Base, by elements: some Collection<Base.Element>, plus bit: inout Bool, at index: inout Base.Index) {
for elementIndex in elements.indices {
self.incrementInIntersection(&base, by: elements[elementIndex], plus: &bit, at: &index)
for elementsIndex in elements.indices {
self.incrementInIntersection(&base, by: elements[elementsIndex], plus: &bit, at: &index)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ extension NBKDoubleWidth where High == High.Magnitude {
/// - Note: The `high` and `low` parts contain the entire `overflow` from `low` to `high`.
///
@_disfavoredOverload @inlinable public mutating func multiplyFullWidth(by other: Digit, add carry: Digit) -> Digit {
SBI.Unsigned.SubSequence.multiplyFullWidth(&self, by: other, add: carry)
SUISS.multiplyFullWidth(&self, by: other, add: carry)
}

/// Returns the `low` and `high` parts of multiplication and addition.
Expand Down
3 changes: 0 additions & 3 deletions Sources/NBKDoubleWidthKit/NBKDoubleWidth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ High: NBKFixedWidthInteger, High.Digit: NBKCoreInteger<UInt> {
/// The bit pattern of this type.
public typealias BitPattern = NBKDoubleWidth<High.Magnitude>

/// The namespace with appropriate algorithms for this type.
@usableFromInline typealias SBI = NBK.StrictBinaryInteger<Self>

//=------------------------------------------------------------------------=
// MARK: Accessors
//=------------------------------------------------------------------------=
Expand Down

0 comments on commit 50e0e8a

Please sign in to comment.