mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
stdlib: remove Word and UWord
These types are leftovers from the early pre-1.0 times when Int and UInt were always 64-bit on all platforms. They serve no useful purpose today. Int and UInt are defined to be word-sized and should be used instead. rdar://18693488 Swift SVN r30564
This commit is contained in:
@@ -75,7 +75,7 @@ public struct StaticString
|
||||
_precondition(
|
||||
!hasPointerRepresentation,
|
||||
"StaticString should have Unicode scalar representation")
|
||||
return UnicodeScalar(UInt32(unsafeBitCast(_startPtrOrData, UWord.self)))
|
||||
return UnicodeScalar(UInt32(unsafeBitCast(_startPtrOrData, UInt.self)))
|
||||
}
|
||||
|
||||
/// If `self` stores a pointer to ASCII or UTF-8 code units, the
|
||||
@@ -84,11 +84,11 @@ public struct StaticString
|
||||
/// If `self` stores a single Unicode scalar value, the value of
|
||||
/// `byteSize` is unspecified.
|
||||
@transparent
|
||||
public var byteSize: Word {
|
||||
public var byteSize: Int {
|
||||
_precondition(
|
||||
hasPointerRepresentation,
|
||||
"StaticString should have pointer representation")
|
||||
return Word(_byteSize)
|
||||
return Int(_byteSize)
|
||||
}
|
||||
|
||||
/// `true` iff `self` stores a pointer to ASCII or UTF-8 code units.
|
||||
@@ -158,7 +158,7 @@ public struct StaticString
|
||||
unicodeScalar: Builtin.Int32
|
||||
) {
|
||||
self._startPtrOrData =
|
||||
unsafeBitCast(UWord(UInt32(unicodeScalar)), COpaquePointer.self)._rawValue
|
||||
unsafeBitCast(UInt(UInt32(unicodeScalar)), COpaquePointer.self)._rawValue
|
||||
self._byteSize = 0._builtinWordValue
|
||||
self._flags = UnicodeScalar(unicodeScalar).isASCII()
|
||||
? (0x3 as UInt8).value
|
||||
|
||||
Reference in New Issue
Block a user