10#include <fmt/ranges.h>
11#include <small_vector/SmallVector.h>
15 using ByteVector = llvm_vecsmall::SmallVector<uint8_t, CHAR_BIT>;
21 template <
typename T,
unsigned N>
22 struct hash<llvm_vecsmall::SmallVector<T, N>>
24 size_t operator()(
const llvm_vecsmall::SmallVector<T, N>& v)
const
27 0x7720796f726c694b, 0x2165726568207361};
28 return ccf::siphash::siphash<2, 4>(v.data(), v.size(), k);
36struct formatter<
ccf::ByteVector>
38 template <
typename ParseContext>
39 constexpr auto parse(ParseContext& ctx)
44 template <
typename FormatContext>
48 constexpr auto first_printable = 0x20;
49 constexpr auto last_printable = 0x7e;
50 auto printable = [](uint8_t b) {
51 return b >= first_printable && b <= last_printable;
53 if (std::all_of(e.begin(), e.end(), printable))
57 "<uint8[{}]: ascii={}>",
59 std::string(e.begin(), e.end()));
62 ctx.out(),
"<uint8[{}]: hex={:02x}>", e.size(), fmt::join(e,
" "));
uint64_t[2] SipKey
Definition siphash.h:15
Definition app_interface.h:14
llvm_vecsmall::SmallVector< uint8_t, CHAR_BIT > ByteVector
Definition byte_vector.h:15
size_t operator()(const llvm_vecsmall::SmallVector< T, N > &v) const
Definition byte_vector.h:24