Skip to content

Commit 638cded

Browse files
authored
Merge pull request #10481 from xwu/patch-1
2 parents 3131da6 + 93e76cd commit 638cded

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

stdlib/public/core/DoubleWidth.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ public struct DoubleWidth<Base : FixedWidthInteger> :
176176
}
177177

178178
// TODO: move to Int128 just like init(_builtinIntegerLiteral:) ?
179-
return (n < _storage.low.countRepresentedWords) ?
179+
return (n < _storage.low._countRepresentedWords) ?
180180
_storage.low._word(at: n) :
181-
_storage.high._word(at: n - _storage.low.countRepresentedWords)
181+
_storage.high._word(at: n - _storage.low._countRepresentedWords)
182182
}
183183
}
184184

stdlib/public/core/Integers.swift.gyb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ extension BinaryInteger {
15481548
///
15491549
/// This property is a constant for instances of fixed-width integer types.
15501550
@_transparent
1551-
public var countRepresentedWords: Int {
1551+
public var _countRepresentedWords: Int {
15521552
return (self.bitWidth + ${word_bits} - 1) / ${word_bits}
15531553
}
15541554

@@ -1896,11 +1896,11 @@ extension BinaryInteger {
18961896
}
18971897

18981898
// FIXME(integers): inefficient. Should get rid of _word(at:) and
1899-
// countRepresentedWords, and make `words` the basic operation.
1899+
// _countRepresentedWords, and make `words` the basic operation.
19001900
public var words: [UInt] {
19011901
var result = [UInt]()
1902-
result.reserveCapacity(countRepresentedWords)
1903-
for i in 0..<self.countRepresentedWords {
1902+
result.reserveCapacity(_countRepresentedWords)
1903+
for i in 0..<self._countRepresentedWords {
19041904
result.append(_word(at: i))
19051905
}
19061906
return result
@@ -2328,7 +2328,7 @@ ${unsafeOperationComment(x.operator)}
23282328
else {
23292329
var result: Self = source < (0 as T) ? ~0 : 0
23302330
// start with the most significant word
2331-
var n = source.countRepresentedWords
2331+
var n = source._countRepresentedWords
23322332
while n >= 0 {
23332333
// masking is OK here because this we have already ensured
23342334
// that Self.bitWidth > ${word_bits}. Not masking results in
@@ -2801,7 +2801,7 @@ ${assignmentOperatorComment(x.operator, True)}
28012801
@_transparent
28022802
public func _word(at n: Int) -> UInt {
28032803
_precondition(n >= 0, "Negative word index")
2804-
if _fastPath(n < countRepresentedWords) {
2804+
if _fastPath(n < _countRepresentedWords) {
28052805
let shift = UInt(n._value) &* ${word_bits}
28062806
let bitWidth = UInt(self.bitWidth._value)
28072807
_sanityCheck(shift < bitWidth)

test/Prototypes/BigInt.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public struct _BigInt<Word: FixedWidthInteger & UnsignedInteger> :
121121
// FIXME: This is broken on 32-bit arch w/ Word = UInt64
122122
let wordRatio = UInt.bitWidth / Word.bitWidth
123123
_sanityCheck(wordRatio != 0)
124-
for i in 0..<source.countRepresentedWords {
124+
for i in 0..<source._countRepresentedWords {
125125
var sourceWord = source._word(at: i)
126126
for _ in 0..<wordRatio {
127127
_data.append(Word(extendingOrTruncating: sourceWord))

0 commit comments

Comments
 (0)