Add printTree
This commit is contained in:
26
Internal.h
26
Internal.h
@@ -410,28 +410,16 @@ struct ReferenceImpl {
|
||||
using Key = ConflictSet::Key;
|
||||
|
||||
[[maybe_unused]] static Key toKey(Arena &arena, int n) {
|
||||
constexpr int kMaxLength = 8;
|
||||
int i = kMaxLength;
|
||||
uint8_t *itoaBuf = new (arena) uint8_t[kMaxLength];
|
||||
memset(itoaBuf, '0', kMaxLength);
|
||||
do {
|
||||
itoaBuf[--i] = "0123456789abcdef"[n % 16];
|
||||
n /= 16;
|
||||
} while (n);
|
||||
return Key{itoaBuf, kMaxLength};
|
||||
uint8_t *buf = new (arena) uint8_t[sizeof(n)];
|
||||
memcpy(buf, &n, sizeof(n));
|
||||
return Key{buf, sizeof(n)};
|
||||
}
|
||||
|
||||
[[maybe_unused]] static Key toKeyAfter(Arena &arena, int n) {
|
||||
constexpr int kMaxLength = 8;
|
||||
int i = kMaxLength;
|
||||
uint8_t *itoaBuf = new (arena) uint8_t[kMaxLength + 1];
|
||||
memset(itoaBuf, '0', kMaxLength);
|
||||
itoaBuf[kMaxLength] = 0;
|
||||
do {
|
||||
itoaBuf[--i] = "0123456789abcdef"[n % 16];
|
||||
n /= 16;
|
||||
} while (n);
|
||||
return Key{itoaBuf, kMaxLength + 1};
|
||||
uint8_t *buf = new (arena) uint8_t[sizeof(n) + 1];
|
||||
memcpy(buf, &n, sizeof(n));
|
||||
buf[sizeof(n)] = 0;
|
||||
return Key{buf, sizeof(n) + 1};
|
||||
}
|
||||
|
||||
inline std::string printable(std::string_view key) {
|
||||
|
Reference in New Issue
Block a user