View HeterogeneousCoresTest.swift
import Foundation
func machToNanoseconds(_ mach: UInt64) -> Double {
struct Static {
static var info: mach_timebase_info = {
var info = mach_timebase_info()
mach_timebase_info(&info)
return info
}()
}
View conditional-conformance.swift
protocol P {
func f()
}
struct S<T> {}
extension S: P where T: P {
func f() {
print(T.self)
View root-classes.swift
import Cocoa
var count: UInt32 = 0
let ptr = objc_copyClassList(&count)!
let strings = (0 ..< Int(count)).flatMap({
if class_getSuperclass(ptr[$0]) == nil {
return String(cString: class_getName(ptr[$0]))
} else {
View TSD.swift
protocol TSDKey {
associatedtype Value
static var defaultValue: Value { get }
}
struct TSD {
private var storage: [ObjectIdentifier: Any] = [:]
subscript<Key: TSDKey>(key: Key.Type) -> Key.Value {
View TSUD.swift
// SCROLL DOWN //
import Foundation
protocol TSUD {
associatedtype Value: Codable
init()
static var defaultValue: Value { get }
View nested-containers.swift
import Foundation
class MutableBox<T> {
var value: T
init(_ initialValue: T) {
value = initialValue
}
}
View compile-time-class.m
/*usr/bin/true
clang -framework Cocoa -g compile-time-class.m && ./a.out
exit;*/
#import <Foundation/Foundation.h>
#define COMPILE_TIME_CLASS(name) ^{ \
extern void *OBJC_CLASS_$_ ## name; \
View xcode.sh
#!/bin/bash
# Exit the script immediately on error
set -e
# We'll work in /tmp
cd /tmp
# Clone mach_override unless we already have it
if [ ! -d mach_override ]; then
View test.c
// xcrun -sdk iphoneos clang -O3 -arch arm64 -S test.c
#import <stdarg.h>
#import <stdio.h>
void normal(int a, int b, int c, int d, int e, int f, int g, int h) {
printf("%d %d %d %d %d %d %d %d", a, b, c, d, e, f, g, h);
}
void normal_target(int a, int b, int c, int d, int e, int f, int g, int h);
View ip.swift
import Darwin
typealias a = (UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, U