From 47f9ea4c7abd50b0e0bbffe56ea6134cc8d1898b Mon Sep 17 00:00:00 2001 From: Lee Clagett Date: Wed, 23 Sep 2020 15:48:48 -0400 Subject: [PATCH] Fix integer wire serialization ambiguities --- src/wire/write.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/wire/write.h b/src/wire/write.h index a8b2c06..696d933 100644 --- a/src/wire/write.h +++ b/src/wire/write.h @@ -82,18 +82,26 @@ namespace wire { dest.integer(source); } - inline void write_bytes(writer& dest, const std::intmax_t source) + inline void write_bytes(writer& dest, const long source) { - dest.integer(source); + dest.integer(std::intmax_t(source)); + } + inline void write_bytes(writer& dest, const long long source) + { + dest.integer(std::intmax_t(source)); } inline void write_bytes(writer& dest, const unsigned source) { dest.unsigned_integer(source); } - inline void write_bytes(writer& dest, const std::uintmax_t source) + inline void write_bytes(writer& dest, const unsigned long source) { - dest.unsigned_integer(source); + dest.unsigned_integer(std::uintmax_t(source)); + } + inline void write_bytes(writer& dest, const unsigned long long source) + { + dest.unsigned_integer(std::uintmax_t(source)); } inline void write_bytes(writer& dest, const double source)