Skip to content

Commit

Permalink
[stdlib] _lowUWord => _lowWord
Browse files Browse the repository at this point in the history
  • Loading branch information
lorentey committed Jul 10, 2017
1 parent 6ae2040 commit 826f8da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion stdlib/public/core/DoubleWidth.swift.gyb
Expand Up @@ -235,7 +235,7 @@ public struct DoubleWidth<Base : FixedWidthInteger> :
if Base.bitWidth < UInt.bitWidth {
_precondition(i == Index(.low(_low.startIndex)), "Invalid index")
_sanityCheck(2 * Base.bitWidth <= UInt.bitWidth)
return _low.first! | (_high.first! &<< Base.bitWidth._lowUWord)
return _low.first! | (_high.first! &<< Base.bitWidth._lowWord)
}
switch i._value {
case let .low(li): return _low[li]
Expand Down
20 changes: 10 additions & 10 deletions stdlib/public/core/Integers.swift.gyb
Expand Up @@ -1441,7 +1441,7 @@ public protocol BinaryInteger :
var words: Words { get }

/// The least significant word in this value's binary representation.
var _lowUWord: UInt { get }
var _lowWord: UInt { get }

/// The number of bits in the current binary representation of this value.
///
Expand Down Expand Up @@ -1539,7 +1539,7 @@ extension BinaryInteger {
}

@_transparent
public var _lowUWord: UInt {
public var _lowWord: UInt {
var it = words.makeIterator()
return it.next() ?? 0
}
Expand Down Expand Up @@ -2295,13 +2295,13 @@ ${unsafeOperationComment(x.operator)}
@_transparent
public init<T : BinaryInteger>(extendingOrTruncating source: T) {
if Self.bitWidth <= ${word_bits} || source.bitWidth <= ${word_bits} {
self = Self.init(_truncatingBits: source._lowUWord)
self = Self.init(_truncatingBits: source._lowWord)
}
else {
let neg = source < (0 as T)
var result: Self = neg ? ~0 : 0
var shift: Self = 0
let width = Self(_truncatingBits: Self.bitWidth._lowUWord)
let width = Self(_truncatingBits: Self.bitWidth._lowWord)
for word in source.words {
guard shift < width else { break }
// masking shift is OK here because we have already ensured
Expand Down Expand Up @@ -2751,23 +2751,23 @@ ${assignmentOperatorComment(x.operator, True)}
return Int(
${Self}(
Builtin.int_ctlz_Int${bits}(self._value, false._value)
)._lowUWord._value)
)._lowWord._value)
}

@_transparent
public var trailingZeroBitCount: Int {
return Int(
${Self}(
Builtin.int_cttz_Int${bits}(self._value, false._value)
)._lowUWord._value)
)._lowWord._value)
}

@_transparent
public var nonzeroBitCount: Int {
return Int(
${Self}(
Builtin.int_ctpop_Int${bits}(self._value)
)._lowUWord._value)
)._lowWord._value)
}

% if Self == 'UInt' or (bits > word_bits and not signed):
Expand Down Expand Up @@ -2810,7 +2810,7 @@ ${assignmentOperatorComment(x.operator, True)}
_precondition(position < endIndex, "Word index out of range")
let shift = UInt(position._value) &* ${word_bits}
_sanityCheck(shift < UInt(_value.bitWidth._value))
return (_value &>> ${Self}(_truncatingBits: shift))._lowUWord
return (_value &>> ${Self}(_truncatingBits: shift))._lowWord
}
}
}
Expand All @@ -2831,13 +2831,13 @@ ${assignmentOperatorComment(x.operator, True)}

@_transparent
public var words: Words {
return Words(self._lowUWord)
return Words(self._lowWord)
}
% end

@_transparent
public // transparent
var _lowUWord: UInt {
var _lowWord: UInt {
% truncOrExt = z + 'ext' if bits <= word_bits else 'trunc'
return UInt(
Builtin.${truncOrExt}OrBitCast_Int${bits}_Int${word_bits}(_value)
Expand Down

0 comments on commit 826f8da

Please sign in to comment.