aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorxiphon <xiphon@protonmail.com>2018-11-13 12:15:18 +0000
committerxiphon <xiphon@protonmail.com>2018-11-13 12:15:18 +0000
commitd01bdaca12bd759462f91783ca63ec178f6c3268 (patch)
tree603e95104c8fcb5a065197edd4856fc6e6c4dfc2 /src/common
parentMerge pull request #4814 (diff)
downloadmonero-d01bdaca12bd759462f91783ca63ec178f6c3268.tar.xz
common: fix base58 gcc -Werror=implicit-fallthrough
Diffstat (limited to 'src/common')
-rw-r--r--src/common/base58.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/common/base58.cpp b/src/common/base58.cpp
index 75556cad9..b28a04f20 100644
--- a/src/common/base58.cpp
+++ b/src/common/base58.cpp
@@ -109,20 +109,8 @@ namespace tools
assert(1 <= size && size <= sizeof(uint64_t));
uint64_t res = 0;
- switch (9 - size)
- {
- case 1: res |= *data++; /* FALLTHRU */
- case 2: res <<= 8; res |= *data++; /* FALLTHRU */
- case 3: res <<= 8; res |= *data++; /* FALLTHRU */
- case 4: res <<= 8; res |= *data++; /* FALLTHRU */
- case 5: res <<= 8; res |= *data++; /* FALLTHRU */
- case 6: res <<= 8; res |= *data++; /* FALLTHRU */
- case 7: res <<= 8; res |= *data++; /* FALLTHRU */
- case 8: res <<= 8; res |= *data; break;
- default: assert(false);
- }
-
- return res;
+ memcpy(reinterpret_cast<uint8_t*>(&res) + sizeof(uint64_t) - size, data, size);
+ return SWAP64BE(res);
}
void uint_64_to_8be(uint64_t num, size_t size, uint8_t* data)