commit 834b1e4f6ab7a09b67126b234fb9e263ff69cd8e parent 2af4c053eae8d7f371dfac52335af2aaad674c65 Author: Sebastian <sebastian@sebsite.pw> Date: Thu, 23 Jun 2022 19:23:33 -0400 encoding::utf8: move utf8sz to rune.ha Signed-off-by: Sebastian <sebastian@sebsite.pw> Diffstat:
M | encoding/utf8/decode.ha | | | 10 | ---------- |
M | encoding/utf8/rune.ha | | | 10 | ++++++++++ |
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/encoding/utf8/decode.ha b/encoding/utf8/decode.ha @@ -154,13 +154,3 @@ export fn valid(src: (str | []u8)) bool = { }; abort(); }; - -// Returns the expected length of a UTF-8 codepoint in bytes given its first -// byte, or void if the given byte doesn't begin a valid UTF-8 sequence. -export fn utf8sz(c: u8) (size | void) = { - for (let i = 0z; i < len(sizes); i += 1) { - if (c & sizes[i].mask == sizes[i].result) { - return sizes[i].octets; - }; - }; -}; diff --git a/encoding/utf8/rune.ha b/encoding/utf8/rune.ha @@ -27,3 +27,13 @@ export fn runesz(r: rune) size = { else if (ch < 0x10000) 3 else 4; }; + +// Returns the expected length of a UTF-8 codepoint in bytes given its first +// byte, or void if the given byte doesn't begin a valid UTF-8 sequence. +export fn utf8sz(c: u8) (size | void) = { + for (let i = 0z; i < len(sizes); i += 1) { + if (c & sizes[i].mask == sizes[i].result) { + return sizes[i].octets; + }; + }; +};