Closed oscbyspro closed 1 month ago
I'll hoist init(_: some Sequence, repeating: Bit) to an extension on ArbitraryInteger (#42) from InfiniInt\<T>. Previously, you'd have to perform this weird dance to access it in generic code:
func doArbitraryIntegerStuff_v070<T>(_ type: T.Type) where T: ArbitraryInteger {
let x = T([1, 2, 3] as [UX], repeating: 0)
}
func doArbitraryIntegerStuff_v060<E>(_ element: E.Type) where E: SystemsInteger {
let x = InfiniInt<E>([1, 2, 3] as [UX], repeating: 0)
}
I looked at ContiguousArray\<T>'s hash(into:) implementation and it's about 2x faster to call withUnsafeBytes(_:) for big integers. I might settle on something other than a ContiguousArray\<T> in the future, but still. The withUnsafeBytes(_:) method appears to always be available, so perhaps it's worth suggesting an isPOD(\:) fast path? But would an isPOD(\:) fast path always work? I know it works for contiguous systems integers, but floating-point equalities are weird, for example. I'd have to read Hashable's fine print again. In any case, InfiniInt/hash(into:) goes brrr.
Edit: Hm. I don't think isPOD(\:) is a sufficient constraint.
I'll add a few metadata getters corresponding to the various binary integer conformances:
1. BinaryInteger.isArbitrary // ArbitraryInteger, T.size.isInfinite
2. BinaryInteger.isEdgy // EdgyInteger, !T.size.isInfinite || !T.isSigned
3. BinaryInteger.isFinite // FiniteInteger, !T.size.isInfinite || T.isSigned
I'll rename RootInt as LiteralInt. As much as I enjoy playing Tetris with my model names, that name was dumb. Lmao.
I'll make both operands in *
and &*
borrowing
.
I'll use this thread to document various minor changes.