aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-09-16 20:09:14 +0200
committerAdrian Kummerlaender2014-09-16 20:09:14 +0200
commit31f8cbdd0b038c7196f630febd2bbe2f9183cde0 (patch)
treecbcd7e8139b8c01b19f7ea2a56c716f9f7a513e8
parentc87d8ec91f0e191dba6b744788167bb8d41d339e (diff)
downloadCodepointIterator-master.tar
CodepointIterator-master.tar.gz
CodepointIterator-master.tar.bz2
CodepointIterator-master.tar.lz
CodepointIterator-master.tar.xz
CodepointIterator-master.tar.zst
CodepointIterator-master.zip
Redefined CodePoint utility masks as C++14 binary literalsHEADmaster
* they are more expressive as the shift-syntax in my opinion
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/utility.h16
2 files changed, 9 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 65fee81..3c526f3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,7 @@ project(CodepointIterator)
set(
CMAKE_CXX_FLAGS
- "-std=c++11 -W -Wall -Wextra -Winline -pedantic"
+ "-std=c++14 -W -Wall -Wextra -Winline -pedantic"
)
include_directories(
diff --git a/src/utility.h b/src/utility.h
index 75811f5..56bcfea 100644
--- a/src/utility.h
+++ b/src/utility.h
@@ -7,17 +7,17 @@ namespace UTF8 {
namespace dtl {
enum class CodeUnitType : std::uint8_t {
- CONTINUATION = (128 >> 0), // 10000000
- LEADING = (128 >> 1), // 01000000
- THREE = (128 >> 2), // 00100000
- FOUR = (128 >> 3), // 00010000
+ CONTINUATION = 0b10000000,
+ LEADING = 0b01000000,
+ THREE = 0b00100000,
+ FOUR = 0b00010000
};
enum class CodePoint : std::uint8_t {
- CONTINUATION = (UINT8_MAX >> 2), // 00111111
- TWO = (UINT8_MAX >> 3), // 00011111
- THREE = (UINT8_MAX >> 4), // 00001111
- FOUR = (UINT8_MAX >> 5), // 00000111
+ CONTINUATION = 0b00111111,
+ TWO = 0b00011111,
+ THREE = 0b00001111,
+ FOUR = 0b00000111
};
inline bool match(const std::uint8_t unit, const CodeUnitType type) {