diff options
author | Charlie Gordon <github@chqrlie.org> | 2024-02-18 08:29:04 +0100 |
---|---|---|
committer | Charlie Gordon <github@chqrlie.org> | 2024-02-18 08:29:04 +0100 |
commit | bbf36d5b84460a4f39c93f1b81ea87f9a9f8f2fe (patch) | |
tree | 577d4e18f6a8c5d663e803fd82b5254d96f5ffe0 /cutils.h | |
parent | 530ba6a631de6b99caa05363788e7561ea919249 (diff) | |
download | quickjs-bbf36d5b84460a4f39c93f1b81ea87f9a9f8f2fe.tar.gz quickjs-bbf36d5b84460a4f39c93f1b81ea87f9a9f8f2fe.zip |
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()`
Diffstat (limited to 'cutils.h')
-rw-r--r-- | cutils.h | 3 |
1 files changed, 0 insertions, 3 deletions
@@ -28,9 +28,6 @@ #include <stdlib.h> #include <inttypes.h> -/* set if CPU is big endian */ -#undef WORDS_BIGENDIAN - #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #define force_inline inline __attribute__((always_inline)) |