diff --git a/iguana/define.h b/iguana/define.h index ee0e3596..2887122c 100644 --- a/iguana/define.h +++ b/iguana/define.h @@ -1,9 +1,10 @@ #pragma once -#include -#if __cplusplus >= 202002L +#if (defined(_MSC_VER) && _MSC_VER >= 1920 && _MSVC_LANG >= 202002L) || \ + (!defined(_MSC_VER) && defined(__cplusplus) && __cplusplus >= 202002L) #include #endif +#include #include #include #include diff --git a/iguana/json_util.hpp b/iguana/json_util.hpp index 986040ef..5c00c077 100644 --- a/iguana/json_util.hpp +++ b/iguana/json_util.hpp @@ -90,16 +90,6 @@ IGUANA_INLINE void skip_ws_no_comments(It &&it, It &&end) { } } -inline constexpr auto has_zero = [](uint64_t chunk) IGUANA__INLINE_LAMBDA { - return (((chunk - 0x0101010101010101) & ~chunk) & 0x8080808080808080); -}; - -inline constexpr auto has_qoute = [](uint64_t chunk) IGUANA__INLINE_LAMBDA { - return has_zero( - chunk ^ - 0b0010001000100010001000100010001000100010001000100010001000100010); -}; - inline constexpr auto has_escape = [](uint64_t chunk) IGUANA__INLINE_LAMBDA { return has_zero( chunk ^ diff --git a/iguana/util.hpp b/iguana/util.hpp index f1ecf9e7..b5ec2c3e 100644 --- a/iguana/util.hpp +++ b/iguana/util.hpp @@ -17,7 +17,6 @@ #include "error_code.h" #include "reflection.hpp" - namespace iguana { template @@ -194,4 +193,14 @@ IGUANA_INLINE void match(It &&it, It &&end) { } } +inline constexpr auto has_zero = [](uint64_t chunk) IGUANA__INLINE_LAMBDA { + return (((chunk - 0x0101010101010101) & ~chunk) & 0x8080808080808080); +}; + +inline constexpr auto has_qoute = [](uint64_t chunk) IGUANA__INLINE_LAMBDA { + return has_zero( + chunk ^ + 0b0010001000100010001000100010001000100010001000100010001000100010); +}; + } // namespace iguana diff --git a/iguana/xml_util.hpp b/iguana/xml_util.hpp index be28c4d2..cd2df709 100644 --- a/iguana/xml_util.hpp +++ b/iguana/xml_util.hpp @@ -47,10 +47,6 @@ struct is_cdata_t> : std::true_type {}; template constexpr inline bool cdata_v = is_cdata_t>::value; -inline constexpr auto has_zero = [](uint64_t chunk) IGUANA__INLINE_LAMBDA { - return (((chunk - 0x0101010101010101) & ~chunk) & 0x8080808080808080); -}; - inline constexpr auto has_greater = [](uint64_t chunk) IGUANA__INLINE_LAMBDA { return has_zero( chunk ^ @@ -82,15 +78,9 @@ inline constexpr auto has_equal = [](uint64_t chunk) IGUANA__INLINE_LAMBDA { 0b0011110100111101001111010011110100111101001111010011110100111101); }; -inline constexpr auto has_qoute = [](uint64_t chunk) IGUANA__INLINE_LAMBDA { - return has_zero( - chunk ^ - 0b0010001000100010001000100010001000100010001000100010001000100010); -}; - template IGUANA_INLINE void skip_sapces_and_newline(It &&it, It &&end) { - while (it != end && (*it < 33)) { + while (it != end && (static_cast(*it) < 33)) { ++it; } } diff --git a/iguana/yaml_util.hpp b/iguana/yaml_util.hpp index 00e44461..0f2be370 100644 --- a/iguana/yaml_util.hpp +++ b/iguana/yaml_util.hpp @@ -6,7 +6,7 @@ namespace iguana { // return true when it==end template IGUANA_INLINE bool skip_space_till_end(It &&it, It &&end) { - while (it != end && *it < 33) ++it; + while (it != end && (static_cast(*it) < 33)) ++it; return it == end; }