mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Simplify HashPrefix by converting to an enum
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/protocol/digest.h>
|
||||
#include <ripple/protocol/Serializer.h>
|
||||
#include <type_traits>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -52,6 +53,17 @@ int Serializer::add32 (std::uint32_t i)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int Serializer::add32 (HashPrefix p)
|
||||
{
|
||||
// This should never trigger; the size & type of a hash prefix are
|
||||
// integral parts of the protocol and unlikely to ever change.
|
||||
static_assert(std::is_same_v<std::uint32_t,
|
||||
std::underlying_type_t<decltype(p)>>);
|
||||
|
||||
return add32(safe_cast<std::uint32_t>(p));
|
||||
}
|
||||
|
||||
int Serializer::add64 (std::uint64_t i)
|
||||
{
|
||||
int ret = mData.size ();
|
||||
|
||||
Reference in New Issue
Block a user