Files
swift-mirror/stdlib/core/Availability.swift
Graham Batty 373414864d Revert "Use config directives to carve out a 'portable' kernel stdlib."
This reverts commit r23202 pending further discussion.

Swift SVN r23205
2014-11-10 18:46:42 +00:00

33 lines
1.1 KiB
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
import SwiftShims
/// Returns 1 if the running OS version is greater than or equal to
/// major.minor.patchVersion and 0 otherwise.
/// This is a magic entrypoint known to the compiler. It is called in
/// generated code for API availability checking.
public func _stdlib_isOSVersionAtLeast(
major: Builtin.Word,
minor: Builtin.Word,
patch: Builtin.Word
) -> Builtin.Int1 {
let version = _swift_stdlib_operatingSystemVersion()
let result =
(version.majorVersion >= Int(major)) &&
(version.minorVersion >= Int(minor)) &&
(version.patchVersion >= Int(patch))
return result.value
}