Skip to content

Commit ee4ff7b

Browse files
committed
Fix build error due to mismatched types
Error was: | literals.cpp: In function 'libp2p::common::Hash256 libp2p::common::operator""_hash256(const char*, size_t)': | literals.cpp:19:36: error: no matching function for call to 'min(size_t&, long unsigned int)' | 19 | std::copy_n(c, std::min(s, 32ul), hash.rbegin()); | | ^
1 parent 4647bbb commit ee4ff7b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/common/literals.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
namespace libp2p::common {
1717
libp2p::common::Hash256 operator""_hash256(const char *c, size_t s) {
1818
libp2p::common::Hash256 hash{};
19-
std::copy_n(c, std::min(s, 32ul), hash.rbegin());
19+
std::copy_n(c, std::min(s, static_cast<size_t>(32ul)), hash.rbegin());
2020
return hash;
2121
}
2222

2323
libp2p::common::Hash512 operator""_hash512(const char *c, size_t s) {
2424
libp2p::common::Hash512 hash{};
25-
std::copy_n(c, std::min(s, 64ul), hash.rbegin());
25+
std::copy_n(c, std::min(s, static_cast<size_t>(64ul)), hash.rbegin());
2626
return hash;
2727
}
2828

0 commit comments

Comments
 (0)