@@ -237,16 +237,16 @@ extension DoubleWidth {
237
237
self._low = value._storage.low.words
238
238
_sanityCheck(!_low.isEmpty)
239
239
}
240
-
241
- internal enum _WordsIndexValue: Equatable {
242
- case low(Low.Words.Index)
243
- case high(High.Words.Index)
244
- }
245
240
}
246
241
}
247
242
248
- extension DoubleWidth.Words {
243
+ extension DoubleWidth.Words {
249
244
public struct Index {
245
+ internal enum _WordsIndexValue: Equatable {
246
+ case low(DoubleWidth.Low.Words.Index)
247
+ case high(DoubleWidth.High.Words.Index)
248
+ }
249
+
250
250
internal var _value: _WordsIndexValue
251
251
252
252
internal init(_ _value: _WordsIndexValue) { self._value = _value }
@@ -259,8 +259,8 @@ extension DoubleWidth.Words.Index: Comparable {
259
259
public static func <(lhs: DoubleWidth.Words.Index, rhs: DoubleWidth.Words.Index) -> Bool {
260
260
switch (lhs._value, rhs._value) {
261
261
case let (.low(l), .low(r)): return l < r
262
- case (.low(_) , .high(_) ): return true
263
- case (.high(_) , .low(_) ): return false
262
+ case (.low, .high): return true
263
+ case (.high, .low): return false
264
264
case let (.high(l), .high(r)): return l < r
265
265
}
266
266
}
@@ -282,15 +282,15 @@ extension DoubleWidth.Words: Collection {
282
282
283
283
public func index(after i: Index) -> Index {
284
284
switch i._value {
285
+ case let .low(li) where Base.bitWidth < UInt.bitWidth:
286
+ return Index(.high(_high.endIndex))
285
287
case let .low(li):
286
- if Base.bitWidth < UInt.bitWidth {
287
- return Index(.high(_high.endIndex))
288
- }
289
288
let next = _low.index(after: li)
290
289
if next == _low.endIndex {
291
290
return Index(.high(_high.startIndex))
291
+ } else {
292
+ return Index(.low(next))
292
293
}
293
- return Index(.low(next))
294
294
case let .high(hi):
295
295
return Index(.high(_high.index(after: hi)))
296
296
}
0 commit comments