diff options
author | breakneck <[email protected]> | 2022-02-10 16:47:58 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:47:58 +0300 |
commit | e2021f9a0e54d13b7c48796318b13b66dc625e74 (patch) | |
tree | 5aed1691033eaf399ab80a10a137238922035fa8 /util/charset/wide_specific.h | |
parent | 83602b1b564b92a80a1526d113fa2846661dd10e (diff) |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'util/charset/wide_specific.h')
-rw-r--r-- | util/charset/wide_specific.h | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/util/charset/wide_specific.h b/util/charset/wide_specific.h index 4ea765b94b6..983bf55341e 100644 --- a/util/charset/wide_specific.h +++ b/util/charset/wide_specific.h @@ -1,22 +1,22 @@ -#pragma once - -#include <util/system/types.h> -#include <util/system/yassert.h> - -inline constexpr bool IsW16SurrogateLead(wchar16 c) noexcept { - return 0xD800 <= c && c <= 0xDBFF; -} - -inline constexpr bool IsW16SurrogateTail(wchar16 c) noexcept { - return 0xDC00 <= c && c <= 0xDFFF; -} - -inline size_t W16SymbolSize(const wchar16* begin, const wchar16* end) { - Y_ASSERT(begin < end); - - if ((begin + 1 != end) && IsW16SurrogateLead(*begin) && IsW16SurrogateTail(*(begin + 1))) { - return 2; - } - - return 1; -} +#pragma once + +#include <util/system/types.h> +#include <util/system/yassert.h> + +inline constexpr bool IsW16SurrogateLead(wchar16 c) noexcept { + return 0xD800 <= c && c <= 0xDBFF; +} + +inline constexpr bool IsW16SurrogateTail(wchar16 c) noexcept { + return 0xDC00 <= c && c <= 0xDFFF; +} + +inline size_t W16SymbolSize(const wchar16* begin, const wchar16* end) { + Y_ASSERT(begin < end); + + if ((begin + 1 != end) && IsW16SurrogateLead(*begin) && IsW16SurrogateTail(*(begin + 1))) { + return 2; + } + + return 1; +} |