From 31f8cbdd0b038c7196f630febd2bbe2f9183cde0 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Tue, 16 Sep 2014 20:09:14 +0200 Subject: Redefined CodePoint utility masks as C++14 binary literals * they are more expressive as the shift-syntax in my opinion --- CMakeLists.txt | 2 +- src/utility.h | 16 ++++++++-------- 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) { -- cgit v1.2.3