Take advantage of smaller integer load and store ops

This commit is contained in:
dcodeIO
2018-01-23 15:44:25 +01:00
parent 5d142ba647
commit 2fa7fc7885
13 changed files with 719 additions and 124 deletions

4
std/assembly.d.ts vendored
View File

@ -155,9 +155,9 @@ declare function sqrt<T = f32 | f64>(value: T): T;
/** Rounds to the nearest integer towards zero of a 32-bit or 64-bit float. */
declare function trunc<T = f32 | f64>(value: T): T;
/** Loads a value of the specified type from memory. Equivalent to dereferncing a pointer in other languages. */
declare function load<T>(ptr: usize, constantOffset?: usize): T;
declare function load<T>(ptr: usize, constantOffset?: usize): any;
/** Stores a value of the specified type to memory. Equivalent to dereferencing a pointer in other languages when assigning a value. */
declare function store<T>(ptr: usize, value: T, constantOffset?: usize): void;
declare function store<T>(ptr: usize, value: any, constantOffset?: usize): void;
/** Returns the current memory size in units of pages. One page is 64kb. */
declare function current_memory(): i32;
/** Grows linear memory by a given unsigned delta of pages. One page is 64kb. Returns the previous memory size in units of pages or `-1` on failure. */