Hojun-Cho
a8561c03a0
lib/encoding/hex+test: Hare port (encode / decode / sizes)
Replaces the 19-line placeholder. Five entrypoints per
ref/hare/encoding/hex/hex.ha + README:13:
- invalid (!void) — mirrors errors::invalid (hex.ha:175 decodestr).
base32's !i32 is a pre-existing in-tree divergence; hex doesn't
carry it forward.
- encodedsize(n) = n*2 — derived from hex.ha:46-55 encode_writer
lowercase 2-chars-per-byte.
- decodedsize(n) = n/2 — inverse; hex.ha:158.
- encode(dst, src) i32 — lowercase output per README:13 + hex.ha:91.
- decode(dst, src) (i32 | invalid) — accepts lower / upper / mixed;
returns invalid on odd length (hex.ha:154) or non-hex char
(hex.ha:161-163).
Deferred (cite-and-defer, same pattern as base32/base64):
- newencoder / newdecoder — Hare's io::handle stream API; ww has no
io::handle integration yet.
- encodestr / decodestr — allocator-returning sum-result; needs
os.alloc-backed memio dynamic, not wired.
- dump — hexdump-with-ASCII view; needs io::handle + fmt::fprintf
into a write sink.
Test: lib/encoding/hex/hextest.ww 13 rows — sizes, encode_basic
(Hare's CAFEBABEDEADF00D verbatim), encode_zero / encode_ff /
encode_empty (nibble corners + sign-extend + table off-by-one),
decode_{lower,upper,mixed} (case acceptance), decode_{empty,
odd_length,bad_char,bad_char_mid} (error paths), roundtrip_all_bytes
(0..255 full nibble+shift family — Class B exerciser).
Driver test/wcc/979_hex_run.c slotted between 978_intdiv_signed and
980_memio_run.
2026-05-17 07:07:57 +09:00
..
2026-05-13 04:03:55 +09:00
2026-05-15 14:16:53 +09:00
2026-05-13 08:05:01 +09:00
2026-05-11 02:17:47 +09:00
2026-05-16 23:36:41 +09:00
2026-05-17 07:07:57 +09:00
2026-05-13 04:03:55 +09:00
2026-05-13 20:19:03 +09:00
2026-05-16 14:36:45 +09:00
2026-05-15 15:11:59 +09:00
2026-05-16 02:03:18 +09:00
2026-05-13 14:58:36 +09:00
2026-05-13 20:19:03 +09:00
2026-05-16 08:47:46 +09:00
2026-05-13 14:58:36 +09:00
2026-05-16 02:03:18 +09:00
2026-05-12 00:45:18 +09:00
2026-05-17 06:52:16 +09:00
2026-05-13 04:03:55 +09:00
2026-05-16 02:03:18 +09:00
2026-05-11 02:17:47 +09:00
2026-05-13 08:05:01 +09:00
2026-05-15 15:48:13 +09:00
2026-05-16 23:36:41 +09:00
2026-05-17 02:51:15 +09:00
2026-05-12 00:45:18 +09:00
2026-05-15 11:24:33 +09:00
2026-05-16 00:45:30 +09:00