diff options
Added static assert of std::string::value_type size
* CodepointIterator only supports UTF-8 encoded single-byte input strings
** this should prevent CodepointIterator from compiling on systems with larger char sizes while providing a helpful error message
* improved const-correctness by marking currByte (iterator dereferencing cache) and helper method arguments as const
Diffstat (limited to 'src/utility.h')
-rw-r--r-- | src/utility.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utility.h b/src/utility.h index 8aa46a0..75811f5 100644 --- a/src/utility.h +++ b/src/utility.h @@ -20,14 +20,14 @@ enum class CodePoint : std::uint8_t { FOUR = (UINT8_MAX >> 5), // 00000111 }; -inline bool match(std::uint8_t unit, CodeUnitType type) { +inline bool match(const std::uint8_t unit, const CodeUnitType type) { return unit & static_cast<std::uint8_t>(type); } inline void write(char32_t& point, - std::uint8_t unit, - CodePoint mask, - std::uint8_t offset) { + const std::uint8_t unit, + const CodePoint mask, + const std::uint8_t offset) { point += (unit & static_cast<std::uint8_t>(mask)) << offset; } |