@import("operator.felan"); libc :: @c_library("/usr/lib/libc.so.6"); malloc :: @c_function(libc,"malloc",(i64)->(*void)); realloc :: @c_function(libc,"realloc",(*void,i64)->(*void)); free :: @c_function(libc,"free",(*void)->void); malloc :: (size:i64,comptime t:type) -> (*t) { return @cast(malloc(size*@cast(@size_of(t),i64)),*t); }; realloc :: (ptr:*anytype,size:u64) -> (@type_of(ptr)) { return @cast( realloc( @cast(ptr,*void), @cast(size*@size_of(@type_of(ptr.*)),i64), ), @type_of(ptr) ); }; free :: (ptr:*anytype) -> void { free(@cast(ptr,*void)); };