Update wasm2c.c

This commit is contained in:
BreadTom 2025-07-24 10:52:27 -04:00 committed by Andrew Kelley
parent f0fec952d2
commit d407c4e52b

View File

@ -316,10 +316,10 @@ int main(int argc, char **argv) {
"}\n" "}\n"
"\n" "\n"
"static uint32_t memory_grow(uint8_t **m, uint32_t *p, uint32_t *c, uint32_t n) {\n" "static uint32_t memory_grow(uint8_t **m, uint32_t *p, uint32_t *c, uint32_t n) {\n"
" uint8_t *new_m = *m;\n"
" uint32_t r = *p;\n" " uint32_t r = *p;\n"
" uint32_t new_p = r + n;\n" " uint32_t new_p = r + n;\n"
" if (new_p > UINT32_C(0xFFFF)) return UINT32_C(0xFFFFFFFF);\n" " if (new_p > UINT32_C(0xFFFF)) return UINT32_C(0xFFFFFFFF);\n"
" uint8_t *new_m = *m;\n"
" uint32_t new_c = *c;\n" " uint32_t new_c = *c;\n"
" if (new_c < new_p) {\n" " if (new_c < new_p) {\n"
" do new_c += new_c / 2 + 8; while (new_c < new_p);\n" " do new_c += new_c / 2 + 8; while (new_c < new_p);\n"