diff --git a/Sources/_TestSupport/DoubleWidth.swift b/Sources/_TestSupport/DoubleWidth.swift index ebbab51..23e9d1e 100644 --- a/Sources/_TestSupport/DoubleWidth.swift +++ b/Sources/_TestSupport/DoubleWidth.swift @@ -48,19 +48,30 @@ public struct DoubleWidth { public typealias Low = Base.Magnitude internal var _storage: (low: Low, high: High) +} - /// The high part of the value. +extension DoubleWidth { + /// The "high word" of this value. + /// + /// Equivalent to `Base(self >> Base.bitWidth)`. public var high: High { return _storage.high } - /// The low part of the value. + /// The "low word" of the value. + /// + /// Equivalent to`Base.Magnitude(truncatingIfNecessary: self)`. public var low: Low { return _storage.low } /// Creates a new instance from the given tuple of high and low parts. /// + /// Equivalent to + /// ``` + /// DoubleWidth(high) << Base.bitWidth + DoubleWidth(low) + /// ``` + /// /// - Parameter value: The tuple to use as the source of the new instance's /// high and low parts. public init(_ value: (high: High, low: Low)) { @@ -79,10 +90,18 @@ public struct DoubleWidth { // // For that reason, we'll include an internal initializer that takes two // separate arguments. + + /// Creates a new instance from the given tuple of high and low parts. + /// + /// Equivalent to + /// ``` + /// DoubleWidth(high) << Base.bitWidth + DoubleWidth(low) + /// ``` internal init(_ _high: High, _ low: Low) { self.init((_high, low)) } - + + /// Zero. public init() { self.init(0, 0) }