mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This code has only been tested on x86_64, but is designed to work on the other platforms supported by Apple. Swift SVN r11561
18 lines
479 B
Swift
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))
|
|
}
|