ac969b37c1
- src/ ← compiler/selfhost/ (canonical Bux compiler) - bootstrap/ ← compiler/bootstrap/ (Nim bootstrap) - lib/ ← library/std/ (standard library) - rt/ ← library/runtime/ (C runtime) - tests/ ← compiler/tests/ (unit tests) - Remove _selfhost/ (built into build/selfhost/ now) - Update all path references (Makefile, cli.nim, cli.bux, docs) - Bump version to 0.3.0
30 lines
601 B
Plaintext
30 lines
601 B
Plaintext
module Std::Mem {
|
|
|
|
extern func bux_alloc(size: uint) -> *void;
|
|
extern func bux_realloc(ptr: *void, size: uint) -> *void;
|
|
extern func bux_free(ptr: *void);
|
|
extern func bux_mem_eq(a: *void, b: *void, size: uint) -> int;
|
|
|
|
func Alloc(size: uint) -> *void {
|
|
return bux_alloc(size);
|
|
}
|
|
|
|
func Realloc(ptr: *void, size: uint) -> *void {
|
|
return bux_realloc(ptr, size);
|
|
}
|
|
|
|
func Free(ptr: *void) {
|
|
bux_free(ptr);
|
|
}
|
|
|
|
func MemEq(a: *void, b: *void, size: uint) -> bool {
|
|
return bux_mem_eq(a, b, size) != 0;
|
|
}
|
|
|
|
func New<T>() -> *T {
|
|
let sz: uint = sizeof(T);
|
|
return bux_alloc(sz) as *T;
|
|
}
|
|
|
|
}
|