Skip to content

Commit

Permalink
Some fixes from @laurynas-biveinis
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Thompson committed Jan 29, 2025
1 parent 11c4f56 commit 24efd72
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
25 changes: 11 additions & 14 deletions art_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,20 +202,20 @@ class key_encoder {
//

key_encoder &encode(std::int8_t v) {
const int8_t iONE = static_cast<int8_t>(1);
const uint8_t uONE = static_cast<uint8_t>(1);
const uint8_t u = (v >= 0)
? msb8 + static_cast<uint8_t>(v)
: msb8 - static_cast<uint8_t>(-(v + iONE)) - uONE;
const auto iONE = static_cast<int8_t>(1);
const auto uONE = static_cast<uint8_t>(1);
const auto u = static_cast<uint8_t>(
(v >= 0) ? msb8 + static_cast<uint8_t>(v)
: msb8 - static_cast<uint8_t>(-(v + iONE)) - uONE);
return encode(u);
}

key_encoder &encode(std::int16_t v) {
const int16_t iONE = static_cast<int16_t>(1);
const uint16_t uONE = static_cast<uint16_t>(1);
const uint16_t u = (v >= 0)
? msb16 + static_cast<uint16_t>(v)
: msb16 - static_cast<uint16_t>(-(v + iONE)) - uONE;
const auto iONE = static_cast<int16_t>(1);
const auto uONE = static_cast<uint16_t>(1);
const auto u = static_cast<uint16_t>(
(v >= 0) ? msb16 + static_cast<uint16_t>(v)
: msb16 - static_cast<uint16_t>(-(v + iONE)) - uONE);
return encode(u);
}

Expand Down Expand Up @@ -299,8 +299,7 @@ class key_encoder {
std::byte *buf{};
size_t cap{}; // current buffer capacity
size_t off{}; // #of bytes in the buffer having encoded data.

}; // class key_encoder
}; // class key_encoder

// A utility class that can decode binary comparable keys as long as
// those keys (except for Unicode sort keys). To use this class, you
Expand Down Expand Up @@ -413,9 +412,7 @@ class key_decoder {
off += sizeof(u);
return *this;
}

}; // class key_decoder

} // namespace unodb

#endif // UNODB_DETAIL_ART_COMMON_HPP
2 changes: 1 addition & 1 deletion test/db_test_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void assert_result_eq(const Db &db, typename Db::key_type key,
template <class Db>
class [[nodiscard]] tree_verifier final {
public:
using key_type = Db::key_type;
using key_type = typename Db::key_type;

private:
UNODB_DETAIL_DISABLE_MSVC_WARNING(6326)
Expand Down
2 changes: 1 addition & 1 deletion test/test_art_concurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ARTConcurrencyTest : public ::testing::Test {
}

// decode a uint64_t key.
static inline std::uint64_t decode(unodb::key_view akey) {
static std::uint64_t decode(unodb::key_view akey) {
unodb::key_decoder dec{akey};
std::uint64_t k;
dec.decode(k);
Expand Down
1 change: 1 addition & 0 deletions test/test_qsbr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// IWYU pragma: no_include <string>
// IWYU pragma: no_include "gtest/gtest.h"

#include <cmath>
#include <sstream>
#include <system_error>
#include <utility>
Expand Down

0 comments on commit 24efd72

Please sign in to comment.