You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
579 B
37 lines
579 B
#include <wasm_simd128.h> |
|
|
|
extern char __heap_base; |
|
|
|
static int allocated; |
|
|
|
void |
|
set_sp(char *sp) |
|
{ |
|
__asm__ __volatile__( |
|
".globaltype __stack_pointer, i32\n" |
|
"local.get %0\n" |
|
"global.set __stack_pointer\n" |
|
: : "r"(sp) |
|
); |
|
} |
|
|
|
void * |
|
alloc(int size) |
|
{ |
|
void *result = &__heap_base + allocated; |
|
allocated += size; |
|
return(result); |
|
} |
|
|
|
static void |
|
impl(int *buffer, int index, int number) |
|
{ |
|
buffer[index] = number; |
|
} |
|
|
|
void |
|
write_a_number(int *buffer, int index, int number) |
|
{ |
|
int n = number * 2; |
|
impl(buffer, index, n); |
|
}
|
|
|