diff options
Diffstat (limited to '5C.md')
| -rw-r--r-- | 5C.md | 4 |
1 files changed, 4 insertions, 0 deletions
| @@ -34,6 +34,10 @@ Unless noted otherwise (i.e. for hex pubkeys and ids), the module passes strings | |||
| 34 | 34 | ||
| 35 | For example, if `nostr.get_content(handle)` returns `7165` that will be a pointer to a buffer at location `7165`. If that buffer starts with `[ 00 00 00 03 ]` that means it contains 3 bytes (aside from the initial four), so we can keep reading it `[ 00 00 00 03 66 6f 6f ]` and conclude that the string is `"foo"`. | 35 | For example, if `nostr.get_content(handle)` returns `7165` that will be a pointer to a buffer at location `7165`. If that buffer starts with `[ 00 00 00 03 ]` that means it contains 3 bytes (aside from the initial four), so we can keep reading it `[ 00 00 00 03 66 6f 6f ]` and conclude that the string is `"foo"`. |
| 36 | 36 | ||
| 37 | ## Numbers Convention | ||
| 38 | |||
| 39 | All numbers written by the host must use **Little-endian** byte order, matching WASM's default endianness. This applies consistently: write string length prefixes as Little-endian numbers, write number parameters as Little-endian | ||
| 40 | |||
| 37 | ## Memory Management Convention | 41 | ## Memory Management Convention |
| 38 | 42 | ||
| 39 | In order to keep the size of WASM programs small (<10kb) we recommend not including any type of garbage collector or complex allocator. Just use the simplest possible bump allocator and do not free any memory -- programs will not use a lot of memory anyway, at most they will receive a bunch of `i32` event handles from the host, which are cheap. | 43 | In order to keep the size of WASM programs small (<10kb) we recommend not including any type of garbage collector or complex allocator. Just use the simplest possible bump allocator and do not free any memory -- programs will not use a lot of memory anyway, at most they will receive a bunch of `i32` event handles from the host, which are cheap. |