diff --git a/documentation/intrinsics.md b/documentation/intrinsics.md index 7758ee8..56d943c 100644 --- a/documentation/intrinsics.md +++ b/documentation/intrinsics.md @@ -11,10 +11,10 @@ for the binary operators, because there are hundreds of those). #### `::sizeof() -> u64` -Simply returns the size of type `T` in bits. +Simply returns the size of type `T` in bytes. ```rust -i32::sizeof(); // Returns 32 +i32::sizeof(); // Returns 4 ``` #### `::null() -> *T` @@ -25,9 +25,9 @@ Returns a null-pointer of type `T`. i32::null(); // Returns *i32 (null-ptr) ``` -#### `::alloca(size: u64) -> *T` +#### `::malloc(size: u64) -> *T` -Allocates `T::sizeof() * size` bits and returns a pointer to `T`. +Allocates `T::sizeof() * size` bytes and returns a pointer to `T`. **Note:** This does not seem to work correctly currently. diff --git a/examples/associated_functions.reid b/examples/associated_functions.reid index 4e94035..c31bbec 100644 --- a/examples/associated_functions.reid +++ b/examples/associated_functions.reid @@ -25,7 +25,7 @@ fn main() -> u32 { print(from_str("sizeof i32: ") + i32::sizeof()); let nullptr = i32::null(); - let mut list = u64::alloca(15); + let mut list = u64::malloc(15); list[4] = 17; print(from_str("value: ") + list[4]);