Files
swift-mirror/stdlib/core/Builtin.swift
Dave Abrahams afbbbd1287 [stdlib] Add a facility for calling "C" functions that take va_list arguments
This code has only been tested on x86_64, but is designed to work on
the other platforms supported by Apple.

Swift SVN r11561
2013-12-22 02:37:33 +00:00

18 lines
479 B
Swift

/// \brief Definitions that make elements of Builtin usable in real
/// code without gobs of boilerplate. These APIs will probably *not*
/// be exposed outside the stdlib.
func sizeof<T>(_:T.metatype) -> Int {
return Int(Word(Builtin.sizeof(T)))
}
func sizeof<T>(_:T) -> Int {
return Int(Word(Builtin.sizeof(T)))
}
// FIXME: should be a constructor of UnsafePointer
func addressof<T>(x: @inout T) -> UnsafePointer<T> {
return UnsafePointer<T>(Builtin.addressof(&x))
}