From 71b1b44a7f27d18a36cddc232ae2e451a20dd5a6 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 5 Aug 2021 23:37:58 -0700 Subject: [PATCH] ircd::utf: Rename encode() to encode_sparse(). --- include/ircd/utf.h | 2 +- ircd/gpt_vocab.cc | 2 +- ircd/json.cc | 4 ++-- ircd/utf.cc | 24 ++++++++++++------------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/ircd/utf.h b/include/ircd/utf.h index 5dea7c98a..dddf01501 100644 --- a/include/ircd/utf.h +++ b/include/ircd/utf.h @@ -24,7 +24,7 @@ namespace ircd::utf8 template u32xN length(const u32xN codepoints) noexcept; // Encode char32_t codepoints into respective utf-8 encodings - template u32xN encode(const u32xN codepoints) noexcept; + template u32xN encode_sparse(const u32xN codepoints) noexcept; // Decode utf-8 string into char32_t unicode codepoints u32x16 decode(const u8x16 string) noexcept; diff --git a/ircd/gpt_vocab.cc b/ircd/gpt_vocab.cc index 717d3da3d..6833148c1 100644 --- a/ircd/gpt_vocab.cc +++ b/ircd/gpt_vocab.cc @@ -376,7 +376,7 @@ ircd::gpt::vocab::pre_tokenize(u8x16 (&token)[16], // Generate utf-8 codepoints const u8x64 rch8 ( - utf8::encode(rch & cover_mask) + utf8::encode_sparse(rch & cover_mask) ); u32x16 idx; diff --git a/ircd/json.cc b/ircd/json.cc index 1ea809954..60fba96bf 100644 --- a/ircd/json.cc +++ b/ircd/json.cc @@ -3566,7 +3566,7 @@ ircd::json::string_unescape_utf16(u8x16 &block, const u32x4 encoded_sparse { - utf8::encode(unicode) + utf8::encode_sparse(unicode) }; const u8x16 encoded @@ -3841,7 +3841,7 @@ ircd::json::string_stringify_utf16(u8x16 &block, const u32x4 encoded_sparse { - utf8::encode(unicode) + utf8::encode_sparse(unicode) }; const u8x16 encoded diff --git a/ircd/utf.cc b/ircd/utf.cc index 624e41637..ed3344b52 100644 --- a/ircd/utf.cc +++ b/ircd/utf.cc @@ -402,24 +402,24 @@ noexcept namespace ircd::utf8 { - template static u32xN _encode(const u32xN codepoint) noexcept; + template static u32xN _encode_sparse(const u32xN codepoint) noexcept; } template<> ircd::u32x4 -ircd::utf8::encode(const u32x4 codepoint) +ircd::utf8::encode_sparse(const u32x4 codepoint) noexcept { - return _encode(codepoint); + return _encode_sparse(codepoint); } template<> ircd::u32x8 -ircd::utf8::encode(const u32x8 codepoint) +ircd::utf8::encode_sparse(const u32x8 codepoint) noexcept #ifdef __AVX2__ { - return _encode(codepoint); + return _encode_sparse(codepoint); } #else // This block is only effective for GCC. Clang performs this automatically. { @@ -428,8 +428,8 @@ noexcept for(size_t j(0); j < 4; ++j) cp[i][j] = codepoint[i * 4 + j]; - cp[0] = _encode(cp[0]); - cp[1] = _encode(cp[1]); + cp[0] = _encode_sparse(cp[0]); + cp[1] = _encode_sparse(cp[1]); u32x8 ret; for(size_t i(0); i < 2; ++i) @@ -442,11 +442,11 @@ noexcept template<> ircd::u32x16 -ircd::utf8::encode(const u32x16 codepoint) +ircd::utf8::encode_sparse(const u32x16 codepoint) noexcept #ifdef __AVX512F__ { - return _encode(codepoint); + return _encode_sparse(codepoint); } #else // This block is only effective for GCC. Clang performs this automatically. { @@ -455,8 +455,8 @@ noexcept for(size_t j(0); j < 8; ++j) cp[i][j] = codepoint[i * 8 + j]; - cp[0] = encode(cp[0]); - cp[1] = encode(cp[1]); + cp[0] = encode_sparse(cp[0]); + cp[1] = encode_sparse(cp[1]); u32x16 ret; for(size_t i(0); i < 2; ++i) @@ -472,7 +472,7 @@ noexcept /// compress the result down). template inline u32xN -ircd::utf8::_encode(const u32xN codepoint) +ircd::utf8::_encode_sparse(const u32xN codepoint) noexcept { const u32xN len