Fixed cppcheck errors
This commit is contained in:
@@ -210,6 +210,22 @@ struct alignas(uint64_t) hash
|
||||
FORCEINLINE uint64_t* u64() { return reinterpret_cast<uint64_t*>(h); }
|
||||
FORCEINLINE const uint64_t* u64() const { return reinterpret_cast<const uint64_t*>(h); }
|
||||
|
||||
template<int index>
|
||||
FORCEINLINE constexpr uint64_t u64() const
|
||||
{
|
||||
if constexpr ((index < 0) || (index >= HASH_SIZE / sizeof(uint64_t))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t k = 0;
|
||||
|
||||
for (size_t i = 0; i < sizeof(uint64_t); ++i) {
|
||||
k |= static_cast<uint64_t>(h[index * sizeof(uint64_t) + i]) << (i * sizeof(uint64_t));
|
||||
}
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& s, const hash& d);
|
||||
friend std::istream& operator>>(std::istream& s, hash& d);
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ static FORCEINLINE constexpr uint64_t rotl64(uint64_t x) { return (x << y) | (x
|
||||
template<int ROUNDS>
|
||||
static FORCEINLINE constexpr void keccakf(std::array<uint64_t, 25>& st)
|
||||
{
|
||||
constexpr uint64_t keccakf_rndc[24] =
|
||||
constexpr uint64_t round_constants[24] =
|
||||
{
|
||||
0x0000000000000001, 0x0000000000008082, 0x800000000000808a,
|
||||
0x8000000080008000, 0x000000000000808b, 0x0000000080000001,
|
||||
@@ -85,7 +85,7 @@ static FORCEINLINE constexpr void keccakf(std::array<uint64_t, 25>& st)
|
||||
}
|
||||
|
||||
// Iota
|
||||
st[0] ^= keccakf_rndc[round];
|
||||
st[0] ^= round_constants[round];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +139,6 @@ constexpr hash keccak_0x00 = keccak("\0");
|
||||
constexpr hash keccak_subaddress_viewpub = keccak("subaddress_viewpub");
|
||||
constexpr hash keccak_onion_address_v3 = keccak("onion_address_v3");
|
||||
|
||||
static_assert((keccak_0x00.h[0] == 0xBC) && (keccak_0x00.h[1] == 0x36) && (keccak_0x00.h[2] == 0x78) && (keccak_0x00.h[3] == 0x9E), "constexpr keccak code check failed");
|
||||
static_assert(keccak_0x00.u64<0>() == 0x14281E7A9E7836BCULL, "constexpr keccak code check failed");
|
||||
|
||||
} // namespace p2pool
|
||||
|
||||
@@ -997,6 +997,10 @@ bool MergeMiningClientTari::TariClient::on_connect()
|
||||
// Check if the incoming connection (downstream) has already sent something that needs to be relayed
|
||||
TariClient* downstream = m_pairedClient;
|
||||
|
||||
if (!downstream) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::vector<uint8_t>& v = downstream->m_pendingData;
|
||||
|
||||
if (!v.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user