mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
refactor: use braced init for integer constants instead of c style casts
This commit is contained in:
@@ -50,7 +50,7 @@ static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot
|
||||
// For each of the lower bits in count that are 0, do 1 step. Each
|
||||
// corresponds to an inner value that existed before processing the
|
||||
// current leaf, and each needs a hash to combine it.
|
||||
for (level = 0; !(count & (((uint32_t)1) << level)); level++) {
|
||||
for (level = 0; !(count & ((uint32_t{1}) << level)); level++) {
|
||||
if (pbranch) {
|
||||
if (matchh) {
|
||||
pbranch->push_back(inner[level]);
|
||||
@@ -74,12 +74,12 @@ static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot
|
||||
int level = 0;
|
||||
// As long as bit number level in count is zero, skip it. It means there
|
||||
// is nothing left at this level.
|
||||
while (!(count & (((uint32_t)1) << level))) {
|
||||
while (!(count & ((uint32_t{1}) << level))) {
|
||||
level++;
|
||||
}
|
||||
uint256 h = inner[level];
|
||||
bool matchh = matchlevel == level;
|
||||
while (count != (((uint32_t)1) << level)) {
|
||||
while (count != ((uint32_t{1}) << level)) {
|
||||
// If we reach this point, h is an inner value that is not the top.
|
||||
// We combine it with itself (Bitcoin's special rule for odd levels in
|
||||
// the tree) to produce a higher level one.
|
||||
@@ -89,10 +89,10 @@ static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot
|
||||
CHash256().Write(h).Write(h).Finalize(h);
|
||||
// Increment count to the value it would have if two entries at this
|
||||
// level had existed.
|
||||
count += (((uint32_t)1) << level);
|
||||
count += ((uint32_t{1}) << level);
|
||||
level++;
|
||||
// And propagate the result upwards accordingly.
|
||||
while (!(count & (((uint32_t)1) << level))) {
|
||||
while (!(count & ((uint32_t{1}) << level))) {
|
||||
if (pbranch) {
|
||||
if (matchh) {
|
||||
pbranch->push_back(inner[level]);
|
||||
|
||||
Reference in New Issue
Block a user