Update documentation
This commit is contained in:
		
							parent
							
								
									89850d7b4f
								
							
						
					
					
						commit
						014ba2f638
					
				| @ -11,10 +11,10 @@ for the binary operators, because there are hundreds of those). | ||||
| 
 | ||||
| #### `<T>::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 | ||||
| ``` | ||||
| 
 | ||||
| #### `<T>::null() -> *T` | ||||
| @ -25,9 +25,9 @@ Returns a null-pointer of type `T`. | ||||
| i32::null(); // Returns *i32 (null-ptr) | ||||
| ``` | ||||
| 
 | ||||
| #### `<T>::alloca(size: u64) -> *T` | ||||
| #### `<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. | ||||
| 
 | ||||
|  | ||||
| @ -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]); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user