Added math.h, stdlib.h, float.h, and stbool.h to std folder (and all their implementations). Opted to NOT implement malloc/free/etc. in favor of having our own functions init_mem, grow_mem, and get_mem.

This commit is contained in:
Taylor Robbins (Piggybank Studios)
2025-08-28 13:20:08 -07:00
parent deae3ccd12
commit d0aa7a1d0e
13 changed files with 4868 additions and 2 deletions

View File

@@ -10,8 +10,13 @@ Description:
#include "std/src/std_main.c"
WASM_EXPORT(HelloFromWasm) int HelloFromWasm(int value)
WASM_EXPORT(HelloFromWasm) float HelloFromWasm(float value, float value2)
{
printf("Called HelloFromWasm(%d)!\n", value);
printf("Called HelloFromWasm(%g)!\n", fmodf(value, value2));
for (int iIndex = 0; iIndex < 1024; iIndex++)
{
void* newMem = grow_mem(1024);
printf("mem[%d] = %p\n", iIndex, newMem);
}
return value*(value+1)*2;
}