From 98aade06e8960a4cd11e937089d64b42df982826 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Fri, 11 Apr 2014 20:48:11 +0200 Subject: Simplified bitmask utility functions * they were relocated into a separate compilation unit by 79a65ce ** but I want them to be inlined which is hindered by exactly that ** i.e. the implementations are now moved to the utility header file and marked as inline * removed unnecessary declaration of arguments as reference --- src/utility.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/utility.h') diff --git a/src/utility.h b/src/utility.h index e185e3e..8aa46a0 100644 --- a/src/utility.h +++ b/src/utility.h @@ -20,8 +20,16 @@ enum class CodePoint : std::uint8_t { FOUR = (UINT8_MAX >> 5), // 00000111 }; -bool match(const std::uint8_t&, CodeUnitType&&); -void write(char32_t&, const std::uint8_t&, CodePoint&&, const std::uint8_t&); +inline bool match(std::uint8_t unit, CodeUnitType type) { + return unit & static_cast(type); +} + +inline void write(char32_t& point, + std::uint8_t unit, + CodePoint mask, + std::uint8_t offset) { + point += (unit & static_cast(mask)) << offset; +} } } -- cgit v1.2.3