Simplify SHAMapItem construction:

The existing class offered several constructors which were mostly
unnecessary. This commit eliminates all existing constructors and
introduces a single new one, taking a `Slice`.

The internal buffer is switched from `std::vector` to `Buffer` to
save a minimum of 8 bytes (plus the buffer slack that is inherent
in `std::vector`) per SHAMapItem instance.
This commit is contained in:
Nik Bougalis
2021-01-30 23:26:38 -08:00
parent f91b568069
commit 27d978b891
27 changed files with 91 additions and 151 deletions

View File

@@ -91,7 +91,7 @@ public:
Serializer s;
for (int d = 0; d < 3; ++d)
s.add32(ripple::rand_int<std::uint32_t>(r));
return std::make_shared<Item>(s.getSHA512Half(), s.peekData());
return std::make_shared<Item>(s.getSHA512Half(), s.slice());
}
void