Skip to content

Commit

Permalink
Committing clang-format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenberry committed Apr 13, 2023
1 parent 81a1e5f commit b52a7d5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 24 deletions.
5 changes: 3 additions & 2 deletions include/glaze/binary/read.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,9 @@ namespace glz
template <auto Opts>
GLZ_FLATTEN static void op(auto&& value, is_context auto&& ctx, auto&& it, auto&& end) noexcept
{
static constexpr uint8_t header = set_bits<5, 3, uint8_t>(set_bits<3, 2, uint8_t>(set_bits<3>(tag::object), 0), sizeof(decltype(*it)));

static constexpr uint8_t header =
set_bits<5, 3, uint8_t>(set_bits<3, 2, uint8_t>(set_bits<3>(tag::object), 0), sizeof(decltype(*it)));

const auto tag = uint8_t(*it);
if (tag != header) {
ctx.error = error_code::syntax_error;
Expand Down
6 changes: 3 additions & 3 deletions include/glaze/binary/write.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ namespace glz

uint8_t tag = tag::object;
if constexpr (str_t<Key>) {
//set_bits<3, 1, uint8_t>(tag, 0); // no need to set zero
// set_bits<3, 1, uint8_t>(tag, 0); // no need to set zero
}
else {
set_bits<3, 2, uint8_t>(tag, 1 + std::unsigned_integral<Key>);
Expand Down Expand Up @@ -373,7 +373,7 @@ namespace glz
GLZ_ALWAYS_INLINE static void op(auto&& value, is_context auto&& ctx, Args&&... args) noexcept
{
uint8_t tag = tag::object;
//detail::set_bits<3, 2, uint8_t>(tag, 0); // no need to set zero
// detail::set_bits<3, 2, uint8_t>(tag, 0); // no need to set zero
detail::set_bits<5, 3, uint8_t>(tag, 1);
dump_type(tag, args...);

Expand Down Expand Up @@ -463,7 +463,7 @@ namespace glz
static constexpr auto N = std::tuple_size_v<std::decay_t<decltype(groups)>>;

uint8_t tag = tag::object;
//detail::set_bits<3, 2, uint8_t>(tag, 0); // no need to set zero
// detail::set_bits<3, 2, uint8_t>(tag, 0); // no need to set zero
detail::set_bits<5, 3, uint8_t>(tag, sizeof(decltype(buffer[0])));
detail::dump_type(tag, buffer);

Expand Down
34 changes: 17 additions & 17 deletions include/glaze/json/write.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,39 +192,39 @@ namespace glz
// now we don't have to check writing

dump_unchecked<'"'>(b, ix);

for (auto&& c : str) {
switch (c) {
case '"':
std::memcpy(data_ptr(b) + ix, R"(\")", 2);
ix += 2;
std::memcpy(data_ptr(b) + ix, R"(\")", 2);
ix += 2;
break;
case '\\':
std::memcpy(data_ptr(b) + ix, R"(\\)", 2);
ix += 2;
std::memcpy(data_ptr(b) + ix, R"(\\)", 2);
ix += 2;
break;
case '\b':
std::memcpy(data_ptr(b) + ix, R"(\b)", 2);
ix += 2;
std::memcpy(data_ptr(b) + ix, R"(\b)", 2);
ix += 2;
break;
case '\f':
std::memcpy(data_ptr(b) + ix, R"(\f)", 2);
ix += 2;
std::memcpy(data_ptr(b) + ix, R"(\f)", 2);
ix += 2;
break;
case '\n':
std::memcpy(data_ptr(b) + ix, R"(\n)", 2);
ix += 2;
std::memcpy(data_ptr(b) + ix, R"(\n)", 2);
ix += 2;
break;
case '\r':
std::memcpy(data_ptr(b) + ix, R"(\r)", 2);
ix += 2;
std::memcpy(data_ptr(b) + ix, R"(\r)", 2);
ix += 2;
break;
case '\t':
std::memcpy(data_ptr(b) + ix, R"(\t)", 2);
ix += 2;
std::memcpy(data_ptr(b) + ix, R"(\t)", 2);
ix += 2;
break;
[[likely]] default:
std::memcpy(data_ptr(b) + ix, &c, 1);
[[likely]] default:
std::memcpy(data_ptr(b) + ix, &c, 1);
++ix;
}
}
Expand Down
4 changes: 3 additions & 1 deletion include/glaze/util/for_each.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ namespace glz
template <class = void, std::size_t... Is>
constexpr auto indexer(std::index_sequence<Is...>) noexcept
{
return [](auto&& f) noexcept -> decltype(auto) { return decltype(f)(f)(std::integral_constant<std::size_t, Is>{}...); };
return [](auto&& f) noexcept -> decltype(auto) {
return decltype(f)(f)(std::integral_constant<std::size_t, Is>{}...);
};
}

// takes a number N
Expand Down
2 changes: 1 addition & 1 deletion include/glaze/util/hash_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ namespace glz::detail
return uint64_t(-1);
}
};

template <uint64_t N>
consteval auto fit_unsigned_type() noexcept
{
Expand Down

0 comments on commit b52a7d5

Please sign in to comment.