change cast to cast_ptr, take in ptr types

This commit is contained in:
Nathan Braswell
2015-06-28 21:26:13 -04:00
parent d0223c41b3
commit b81abee459
2 changed files with 4 additions and 4 deletions

View File

@@ -18,10 +18,10 @@ fun to_int<T>(in: T) : int {
}
return out;
}
fun cast<T,U>(in: T*):U* {
var out:U*
fun cast_ptr<T,U>(in: T):U {
var out:U
simple_passthrough(in:out:) """
void* out = (void*)in;
void* out = in;
"""
return out
}

View File

@@ -7,7 +7,7 @@ fun main():int {
var a = 1337
var b = &a
var c = cast<int, char>(b)
var c = cast_ptr<int*, char*>(b)
//var d = c + 1
//var e = 1 + c
println(to_int(*(c+0)))