Update documentation
This commit is contained in:
parent
014ba2f638
commit
ea6458dddc
@ -7,6 +7,16 @@ pre-existing binary-operators, but also some regular functions and associated
|
|||||||
functions (that every type has by-default). This document lists them all (except
|
functions (that every type has by-default). This document lists them all (except
|
||||||
for the binary operators, because there are hundreds of those).
|
for the binary operators, because there are hundreds of those).
|
||||||
|
|
||||||
|
### Global Intrinsics
|
||||||
|
|
||||||
|
#### `malloc(size: u64) -> *u8`
|
||||||
|
|
||||||
|
Allocates `size` bytes and returns a pointer of `u8` of length `size`.
|
||||||
|
|
||||||
|
```rust
|
||||||
|
i32::malloc(40); // Reserves 40 bytes
|
||||||
|
```
|
||||||
|
|
||||||
### Associated Intrinsics
|
### Associated Intrinsics
|
||||||
|
|
||||||
#### `<T>::sizeof() -> u64`
|
#### `<T>::sizeof() -> u64`
|
||||||
@ -32,5 +42,8 @@ Allocates `T::sizeof() * size` bytes and returns a pointer to `T`.
|
|||||||
**Note:** This does not seem to work correctly currently.
|
**Note:** This does not seem to work correctly currently.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
i32::alloca(30); // Returns *i32
|
i32::malloc(30); // Returns *i32
|
||||||
|
|
||||||
|
// Equivalent to
|
||||||
|
malloc(i32::sizeof() * 30) as *i32
|
||||||
```
|
```
|
Loading…
Reference in New Issue
Block a user