upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiatjaf_ <fiatjaf@gmail.com>2026-04-05 12:08:24 -0300
committerGitHub <noreply@github.com>2026-04-05 12:08:24 -0300
commit93dcd8033f50bbc127bfd927b8de3804630a260c (patch)
tree6395d87d50fae33e441fc1b9afc91e478b7a6ea4
parent85dd28b2414db6c0b6a72d4ecf5d0aa35f41cc24 (diff)
byte order clarification
Co-authored-by: Awiteb <a@4rs.nl>
-rw-r--r--5C.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/5C.md b/5C.md
index 37197e1..f4b8e64 100644
--- a/5C.md
+++ b/5C.md
@@ -34,6 +34,10 @@ Unless noted otherwise (i.e. for hex pubkeys and ids), the module passes strings
34 34
35For 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"`. 35For 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
39All 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
39In 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. 43In 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.