Operators compile

This commit is contained in:
Max Moiseev
2016-07-22 17:17:03 -07:00
committed by Maxim Moiseev
parent 1867ca4a0f
commit 28a252e33d
13 changed files with 212 additions and 39 deletions

View File

@@ -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> {