mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd::utf: Rename encode() to encode_sparse().
This commit is contained in:
parent
f1e76604d0
commit
71b1b44a7f
4 changed files with 16 additions and 16 deletions
|
@ -24,7 +24,7 @@ namespace ircd::utf8
|
||||||
template<class u32xN> u32xN length(const u32xN codepoints) noexcept;
|
template<class u32xN> u32xN length(const u32xN codepoints) noexcept;
|
||||||
|
|
||||||
// Encode char32_t codepoints into respective utf-8 encodings
|
// Encode char32_t codepoints into respective utf-8 encodings
|
||||||
template<class u32xN> u32xN encode(const u32xN codepoints) noexcept;
|
template<class u32xN> u32xN encode_sparse(const u32xN codepoints) noexcept;
|
||||||
|
|
||||||
// Decode utf-8 string into char32_t unicode codepoints
|
// Decode utf-8 string into char32_t unicode codepoints
|
||||||
u32x16 decode(const u8x16 string) noexcept;
|
u32x16 decode(const u8x16 string) noexcept;
|
||||||
|
|
|
@ -376,7 +376,7 @@ ircd::gpt::vocab::pre_tokenize(u8x16 (&token)[16],
|
||||||
// Generate utf-8 codepoints
|
// Generate utf-8 codepoints
|
||||||
const u8x64 rch8
|
const u8x64 rch8
|
||||||
(
|
(
|
||||||
utf8::encode(rch & cover_mask)
|
utf8::encode_sparse(rch & cover_mask)
|
||||||
);
|
);
|
||||||
|
|
||||||
u32x16 idx;
|
u32x16 idx;
|
||||||
|
|
|
@ -3566,7 +3566,7 @@ ircd::json::string_unescape_utf16(u8x16 &block,
|
||||||
|
|
||||||
const u32x4 encoded_sparse
|
const u32x4 encoded_sparse
|
||||||
{
|
{
|
||||||
utf8::encode(unicode)
|
utf8::encode_sparse(unicode)
|
||||||
};
|
};
|
||||||
|
|
||||||
const u8x16 encoded
|
const u8x16 encoded
|
||||||
|
@ -3841,7 +3841,7 @@ ircd::json::string_stringify_utf16(u8x16 &block,
|
||||||
|
|
||||||
const u32x4 encoded_sparse
|
const u32x4 encoded_sparse
|
||||||
{
|
{
|
||||||
utf8::encode(unicode)
|
utf8::encode_sparse(unicode)
|
||||||
};
|
};
|
||||||
|
|
||||||
const u8x16 encoded
|
const u8x16 encoded
|
||||||
|
|
24
ircd/utf.cc
24
ircd/utf.cc
|
@ -402,24 +402,24 @@ noexcept
|
||||||
|
|
||||||
namespace ircd::utf8
|
namespace ircd::utf8
|
||||||
{
|
{
|
||||||
template<class u32xN> static u32xN _encode(const u32xN codepoint) noexcept;
|
template<class u32xN> static u32xN _encode_sparse(const u32xN codepoint) noexcept;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
ircd::u32x4
|
ircd::u32x4
|
||||||
ircd::utf8::encode(const u32x4 codepoint)
|
ircd::utf8::encode_sparse(const u32x4 codepoint)
|
||||||
noexcept
|
noexcept
|
||||||
{
|
{
|
||||||
return _encode(codepoint);
|
return _encode_sparse(codepoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
ircd::u32x8
|
ircd::u32x8
|
||||||
ircd::utf8::encode(const u32x8 codepoint)
|
ircd::utf8::encode_sparse(const u32x8 codepoint)
|
||||||
noexcept
|
noexcept
|
||||||
#ifdef __AVX2__
|
#ifdef __AVX2__
|
||||||
{
|
{
|
||||||
return _encode(codepoint);
|
return _encode_sparse(codepoint);
|
||||||
}
|
}
|
||||||
#else // This block is only effective for GCC. Clang performs this automatically.
|
#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)
|
for(size_t j(0); j < 4; ++j)
|
||||||
cp[i][j] = codepoint[i * 4 + j];
|
cp[i][j] = codepoint[i * 4 + j];
|
||||||
|
|
||||||
cp[0] = _encode(cp[0]);
|
cp[0] = _encode_sparse(cp[0]);
|
||||||
cp[1] = _encode(cp[1]);
|
cp[1] = _encode_sparse(cp[1]);
|
||||||
|
|
||||||
u32x8 ret;
|
u32x8 ret;
|
||||||
for(size_t i(0); i < 2; ++i)
|
for(size_t i(0); i < 2; ++i)
|
||||||
|
@ -442,11 +442,11 @@ noexcept
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
ircd::u32x16
|
ircd::u32x16
|
||||||
ircd::utf8::encode(const u32x16 codepoint)
|
ircd::utf8::encode_sparse(const u32x16 codepoint)
|
||||||
noexcept
|
noexcept
|
||||||
#ifdef __AVX512F__
|
#ifdef __AVX512F__
|
||||||
{
|
{
|
||||||
return _encode(codepoint);
|
return _encode_sparse(codepoint);
|
||||||
}
|
}
|
||||||
#else // This block is only effective for GCC. Clang performs this automatically.
|
#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)
|
for(size_t j(0); j < 8; ++j)
|
||||||
cp[i][j] = codepoint[i * 8 + j];
|
cp[i][j] = codepoint[i * 8 + j];
|
||||||
|
|
||||||
cp[0] = encode(cp[0]);
|
cp[0] = encode_sparse(cp[0]);
|
||||||
cp[1] = encode(cp[1]);
|
cp[1] = encode_sparse(cp[1]);
|
||||||
|
|
||||||
u32x16 ret;
|
u32x16 ret;
|
||||||
for(size_t i(0); i < 2; ++i)
|
for(size_t i(0); i < 2; ++i)
|
||||||
|
@ -472,7 +472,7 @@ noexcept
|
||||||
/// compress the result down).
|
/// compress the result down).
|
||||||
template<class u32xN>
|
template<class u32xN>
|
||||||
inline u32xN
|
inline u32xN
|
||||||
ircd::utf8::_encode(const u32xN codepoint)
|
ircd::utf8::_encode_sparse(const u32xN codepoint)
|
||||||
noexcept
|
noexcept
|
||||||
{
|
{
|
||||||
const u32xN len
|
const u32xN len
|
||||||
|
|
Loading…
Reference in a new issue