Files
Chris Lattner af30ae3222 Remove the last parts of the Boolean protocol, finishing up:
SE-0109: Remove the Boolean protocol.

We still love you George, even if we forgot your e.
2016-07-17 22:18:17 -07:00

40 lines
1018 B
Swift

@_exported import Darwin // Clang module
//===----------------------------------------------------------------------===//
// MacTypes.h
//===----------------------------------------------------------------------===//
public let noErr: OSStatus = 0
/// The `Boolean` type declared in MacTypes.h and used throughout Core
/// Foundation.
///
/// The C type is a typedef for `unsigned char`.
public struct DarwinBoolean : ExpressibleByBooleanLiteral {
var value: UInt8
public init(_ value: Bool) {
self.value = value ? 1 : 0
}
/// The value of `self`, expressed as a `Bool`.
public var boolValue: Bool {
return value != 0
}
/// Create an instance initialized to `value`.
@_transparent
public init(booleanLiteral value: Bool) {
self.init(value)
}
}
public // COMPILER_INTRINSIC
func _convertBoolToDarwinBoolean(_ x: Bool) -> DarwinBoolean {
return DarwinBoolean(x)
}
public // COMPILER_INTRINSIC
func _convertDarwinBooleanToBool(_ x: DarwinBoolean) -> Bool {
return x.boolValue
}