aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-04-11 20:48:11 +0200
committerAdrian Kummerländer2014-04-11 20:48:11 +0200
commit98aade06e8960a4cd11e937089d64b42df982826 (patch)
treed74af33ed40b409d8b0845074b4fa8ba48f6fda9 /src
parentc61de194f49c47880f8a886c88dcf044f893861a (diff)
downloadCodepointIterator-98aade06e8960a4cd11e937089d64b42df982826.tar
CodepointIterator-98aade06e8960a4cd11e937089d64b42df982826.tar.gz
CodepointIterator-98aade06e8960a4cd11e937089d64b42df982826.tar.bz2
CodepointIterator-98aade06e8960a4cd11e937089d64b42df982826.tar.lz
CodepointIterator-98aade06e8960a4cd11e937089d64b42df982826.tar.xz
CodepointIterator-98aade06e8960a4cd11e937089d64b42df982826.tar.zst
CodepointIterator-98aade06e8960a4cd11e937089d64b42df982826.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/utility.cc18
-rw-r--r--src/utility.h12
2 files changed, 10 insertions, 20 deletions
diff --git a/src/utility.cc b/src/utility.cc
deleted file mode 100644
index 9d81f61..0000000
--- a/src/utility.cc
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "utility.h"
-
-namespace UTF8 {
-namespace dtl {
-
-bool match(const std::uint8_t& codeUnit, CodeUnitType&& type) {
- return codeUnit & static_cast<std::uint8_t>(type);
-}
-
-void write(char32_t& codePoint,
- const std::uint8_t& codeUnit,
- CodePoint&& mask,
- const std::uint8_t& offset) {
- codePoint += (codeUnit & static_cast<std::uint8_t>(mask)) << offset;
-}
-
-}
-}
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<std::uint8_t>(type);
+}
+
+inline void write(char32_t& point,
+ std::uint8_t unit,
+ CodePoint mask,
+ std::uint8_t offset) {
+ point += (unit & static_cast<std::uint8_t>(mask)) << offset;
+}
}
}