]> git.kaiwu.me - quickjs.git/commit
Fix big endian serialization
authorCharlie Gordon <github@chqrlie.org>
Sun, 18 Feb 2024 07:29:04 +0000 (08:29 +0100)
committerCharlie Gordon <github@chqrlie.org>
Sun, 18 Feb 2024 07:29:04 +0000 (08:29 +0100)
commitbbf36d5b84460a4f39c93f1b81ea87f9a9f8f2fe
tree577d4e18f6a8c5d663e803fd82b5254d96f5ffe0
parent530ba6a631de6b99caa05363788e7561ea919249
Fix big endian serialization

Big endian serialization was broken because:
- it partially relied on `WORDS_ENDIAN` (unconditionally undef'd in cutils.h)
- endianness was not handled at all in the bc reader.

Modifications:
- remove `WORDS_ENDIAN`
- use `bc_put_u32()` / `bc_put_u64()` in `JS_WriteBigInt()`
- use `bc_get_u32()` / `bc_get_u64()` in `JS_ReadBigInt()`
- handle host endianness in `bc_get_u16()`, `bc_get_u32()`, `bc_get_u64()` and
  `JS_ReadFunctionBytecode()`

- handle optional littleEndian argument as specified in
  `js_dataview_getValue()` and `js_dataview_setValue()`
cutils.h
quickjs.c