mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Operators compile
This commit is contained in:
committed by
Maxim Moiseev
parent
1867ca4a0f
commit
28a252e33d
@@ -151,8 +151,8 @@ public struct _StringCore {
|
||||
self._baseAddress = baseAddress
|
||||
|
||||
self._countAndFlags
|
||||
= (UInt(elementShift) << (UInt._sizeInBits - 1))
|
||||
| ((hasCocoaBuffer ? 1 : 0) << (UInt._sizeInBits - 2))
|
||||
= (UInt(elementShift) << (UInt.bitWidth - 1))
|
||||
| ((hasCocoaBuffer ? 1 : 0) << (UInt.bitWidth - 2))
|
||||
| UInt(count)
|
||||
|
||||
self._owner = owner
|
||||
@@ -199,7 +199,7 @@ public struct _StringCore {
|
||||
/// Left shift amount to apply to an offset N so that when
|
||||
/// added to a UnsafeMutableRawPointer, it traverses N elements.
|
||||
var elementShift: Int {
|
||||
return Int(_countAndFlags >> (UInt._sizeInBits - 1))
|
||||
return Int(_countAndFlags >> (UInt.bitWidth - 1))
|
||||
}
|
||||
|
||||
/// The number of bytes per element.
|
||||
@@ -220,7 +220,7 @@ public struct _StringCore {
|
||||
|
||||
/// Are we using an `NSString` for storage?
|
||||
public var hasCocoaBuffer: Bool {
|
||||
return Int((_countAndFlags << 1)._value) < 0
|
||||
return Int((_countAndFlags << 1)._storage) < 0
|
||||
}
|
||||
|
||||
public var startASCII: UnsafeMutablePointer<UTF8.CodeUnit> {
|
||||
|
||||
Reference in New Issue
Block a user