Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync iguana #134

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions iguana/define.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#pragma once

#include <array>
#if __cplusplus >= 202002L
#if (defined(_MSC_VER) && _MSC_VER >= 1920 && _MSVC_LANG >= 202002L) || \
(!defined(_MSC_VER) && defined(__cplusplus) && __cplusplus >= 202002L)
#include <bit>
#endif
#include <array>
#include <string>
#include <string_view>
#include <type_traits>
Expand Down
10 changes: 0 additions & 10 deletions iguana/json_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ^
Expand Down
11 changes: 10 additions & 1 deletion iguana/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "error_code.h"
#include "reflection.hpp"


namespace iguana {

template <typename T>
Expand Down Expand Up @@ -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
12 changes: 1 addition & 11 deletions iguana/xml_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ struct is_cdata_t<xml_cdata_t<T>> : std::true_type {};
template <typename T>
constexpr inline bool cdata_v = is_cdata_t<std::remove_cvref_t<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 ^
Expand Down Expand Up @@ -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 <typename It>
IGUANA_INLINE void skip_sapces_and_newline(It &&it, It &&end) {
while (it != end && (*it < 33)) {
while (it != end && (static_cast<uint8_t>(*it) < 33)) {
++it;
}
}
Expand Down
2 changes: 1 addition & 1 deletion iguana/yaml_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace iguana {
// return true when it==end
template <typename It>
IGUANA_INLINE bool skip_space_till_end(It &&it, It &&end) {
while (it != end && *it < 33) ++it;
while (it != end && (static_cast<uint8_t>(*it) < 33)) ++it;
return it == end;
}

Expand Down
Loading