diff options
author | fanquake <fanquake@gmail.com> | 2022-11-01 08:28:36 +0000 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2022-11-01 08:29:57 +0000 |
commit | d08b63baa020651d3cc5597c85d5316cb39aaf59 (patch) | |
tree | acf86eceaf30cd8816a7e57317bf701794c6da75 /src | |
parent | 43e813cab266eef42e622519836f171f6a18d426 (diff) | |
parent | 45a0f4e014484695a00c30d792a6ea514d42f04e (diff) | |
download | bitcoin-d08b63baa020651d3cc5597c85d5316cb39aaf59.tar.xz |
Merge bitcoin/bitcoin#26373: Update minisketch subtree to latest upstream
e9f1d8c27261070d209a28570ad36fe91531cdd2 Squashed 'src/minisketch/' changes from 47f0a2d26f..a571ba20f9 (Hennadii Stepanov)
Pull request description:
Contains:
- https://github.com/sipa/minisketch/pull/68
- https://github.com/sipa/minisketch/pull/69
- https://github.com/sipa/minisketch/pull/70
- https://github.com/sipa/minisketch/pull/72
Fixes bitcoin/bitcoin#26262.
Required for bitcoin/bitcoin#25797.
Guix builds on `arm64`:
```
28af3bdd17924bb5279934add1fe34f5664181a1c99f33793725adc35f90d778 guix-build-45a0f4e01448/output/aarch64-linux-gnu/SHA256SUMS.part
c9cdcb107de5b683221b0e2a3796814548414cdba27be198516a2b401ada90c3 guix-build-45a0f4e01448/output/aarch64-linux-gnu/bitcoin-45a0f4e01448-aarch64-linux-gnu-debug.tar.gz
ce1e916cc7574f555c04ed5fa9e9a47a1e4d2d9d1cb82a040269e8c32aca9194 guix-build-45a0f4e01448/output/aarch64-linux-gnu/bitcoin-45a0f4e01448-aarch64-linux-gnu.tar.gz
26404d3479108bcb8ede4ae7f3d37dbb64a335f0cd5bce7ee901d171a1ef2b0b guix-build-45a0f4e01448/output/arm-linux-gnueabihf/SHA256SUMS.part
0fe32aee5836baed86ad25cbddb43c5a9d2ecbbe5cc954f3a76670aa52ff3c6f guix-build-45a0f4e01448/output/arm-linux-gnueabihf/bitcoin-45a0f4e01448-arm-linux-gnueabihf-debug.tar.gz
41f312cbf26a0e51e6867e644beb3d085ebd4221dc83ea84a97b708e6d230b6d guix-build-45a0f4e01448/output/arm-linux-gnueabihf/bitcoin-45a0f4e01448-arm-linux-gnueabihf.tar.gz
c05ba8235e05c171ecdbacba87dfc1db34d1971286b853c26e3de52a6b0ea1cc guix-build-45a0f4e01448/output/arm64-apple-darwin/SHA256SUMS.part
9d1dae2b73573d34950684269c41f2504761f2df19f24033513f6664b70b1aad guix-build-45a0f4e01448/output/arm64-apple-darwin/bitcoin-45a0f4e01448-arm64-apple-darwin-unsigned.dmg
1ff742346bd04b7edf27e096286f4863fcfec984b99caf265a64fe72b298b36a guix-build-45a0f4e01448/output/arm64-apple-darwin/bitcoin-45a0f4e01448-arm64-apple-darwin-unsigned.tar.gz
74a001f16ba382c22acb9979ee5d905af42f4ca3613fc6e8fa66fec994fb0850 guix-build-45a0f4e01448/output/arm64-apple-darwin/bitcoin-45a0f4e01448-arm64-apple-darwin.tar.gz
ec2f70a0b8a128d3ca69307150714c400620199b506a411b0a4c0a506cc3ed66 guix-build-45a0f4e01448/output/dist-archive/bitcoin-45a0f4e01448.tar.gz
9a67ea74e1b5ef3d08b6a59217ecf8d193234c76f81157192fabe7a9b679af0c guix-build-45a0f4e01448/output/powerpc64-linux-gnu/SHA256SUMS.part
95b458427d73ed81f4a4f85be0dfe81a9a48dc254be65ef158de93d32f07a17a guix-build-45a0f4e01448/output/powerpc64-linux-gnu/bitcoin-45a0f4e01448-powerpc64-linux-gnu-debug.tar.gz
2b269c630f069cc42da5f361d13f5b684fbacb49641f44ed6687379a1e9281b0 guix-build-45a0f4e01448/output/powerpc64-linux-gnu/bitcoin-45a0f4e01448-powerpc64-linux-gnu.tar.gz
33d576b9be022108db6d76c41c1f72c865b5bb38439c6da1cbceac757a1be47f guix-build-45a0f4e01448/output/powerpc64le-linux-gnu/SHA256SUMS.part
053dc9cecc978601701459109eec82f3bcce4042d794c520fd4bd8cd4e17eff3 guix-build-45a0f4e01448/output/powerpc64le-linux-gnu/bitcoin-45a0f4e01448-powerpc64le-linux-gnu-debug.tar.gz
32946d589103c763c2fc67c0d8fa13a38b9194df76cd31755a761a7b9ad856a6 guix-build-45a0f4e01448/output/powerpc64le-linux-gnu/bitcoin-45a0f4e01448-powerpc64le-linux-gnu.tar.gz
7d1be372c84f9403333462e82d7800dfb1812b14c1ed228dacf605dff9aab75c guix-build-45a0f4e01448/output/riscv64-linux-gnu/SHA256SUMS.part
3338bcaf6b8ffd9c155c055a0a18d039e1173212e128561fdea493c263d6ecb9 guix-build-45a0f4e01448/output/riscv64-linux-gnu/bitcoin-45a0f4e01448-riscv64-linux-gnu-debug.tar.gz
7735eefa84630d16d8d37ea23c734578c6fb6540d4359b78d0d1508887e76042 guix-build-45a0f4e01448/output/riscv64-linux-gnu/bitcoin-45a0f4e01448-riscv64-linux-gnu.tar.gz
c3a96d6758631b8e8b4f5bb8035e5442e1fc5b831c7a0ddedb26473b025b2503 guix-build-45a0f4e01448/output/x86_64-apple-darwin/SHA256SUMS.part
b6c87738e6e561bfc4052464e93a6d03a87c51e8f27e4df8ae7458c9828e28cb guix-build-45a0f4e01448/output/x86_64-apple-darwin/bitcoin-45a0f4e01448-x86_64-apple-darwin-unsigned.dmg
0c16f9435c3d572970400ff4683705b297eda3dd37a682619371771da8efbb24 guix-build-45a0f4e01448/output/x86_64-apple-darwin/bitcoin-45a0f4e01448-x86_64-apple-darwin-unsigned.tar.gz
22e06590afe07b992f6f4e46d5568499403937606d16540b121f23e133270560 guix-build-45a0f4e01448/output/x86_64-apple-darwin/bitcoin-45a0f4e01448-x86_64-apple-darwin.tar.gz
56ddb44760f71fd1c1ea06c7174bf035b8b73c32569d69a1401d130551db43e5 guix-build-45a0f4e01448/output/x86_64-linux-gnu/SHA256SUMS.part
1c8a27fab5d9d0f3a5449f04ae8a7e693c5f144948f6d0c2dbf397e04ce9ebfa guix-build-45a0f4e01448/output/x86_64-linux-gnu/bitcoin-45a0f4e01448-x86_64-linux-gnu-debug.tar.gz
66aca3767407f6c2e77b8b93edc58e71c00bed518a75362e3c2f5009739c666c guix-build-45a0f4e01448/output/x86_64-linux-gnu/bitcoin-45a0f4e01448-x86_64-linux-gnu.tar.gz
7ac04c1d5f2dbb6c2c392add9c4e2c5c838c718910b920fe6691a5e9881065b9 guix-build-45a0f4e01448/output/x86_64-w64-mingw32/SHA256SUMS.part
2c51afbcf5645516d01d5f730e9883d9ed3cb90b9b9baf90792ecdb2b3eb21cf guix-build-45a0f4e01448/output/x86_64-w64-mingw32/bitcoin-45a0f4e01448-win64-debug.zip
81738a0690e954d6850f210fa3933ca5de8800078734f8b0810b5e7fe3e63e5d guix-build-45a0f4e01448/output/x86_64-w64-mingw32/bitcoin-45a0f4e01448-win64-setup-unsigned.exe
ecade9ee23ad156e057d466afe79943f008de316973738efdf5ae33d2a527631 guix-build-45a0f4e01448/output/x86_64-w64-mingw32/bitcoin-45a0f4e01448-win64-unsigned.tar.gz
3b17762d01825a3f7d5aecf34cf038938d9ee467e63ea3f34efd1dfa2af5e284 guix-build-45a0f4e01448/output/x86_64-w64-mingw32/bitcoin-45a0f4e01448-win64.zip
```
ACKs for top commit:
fanquake:
ACK 45a0f4e014484695a00c30d792a6ea514d42f04e
Tree-SHA512: e48d79aa0e3563aeae981ddf1281420fff9b739af43e3d77f13cace158724ff01a7622762aadfd093dcd18822a2c1b76d1c548ae64faf727ba93044887b560fb
Diffstat (limited to 'src')
-rw-r--r-- | src/minisketch/configure.ac | 3 | ||||
-rw-r--r-- | src/minisketch/src/bench.cpp | 4 | ||||
-rw-r--r-- | src/minisketch/src/int_utils.h | 24 | ||||
-rw-r--r-- | src/minisketch/src/test.cpp | 1 |
4 files changed, 13 insertions, 19 deletions
diff --git a/src/minisketch/configure.ac b/src/minisketch/configure.ac index 9dc66e7fd2..83910448a2 100644 --- a/src/minisketch/configure.ac +++ b/src/minisketch/configure.ac @@ -124,9 +124,6 @@ if test "x$use_ccache" != "xno"; then fi AC_MSG_RESULT($use_ccache) fi -if test "x$use_ccache" = "xyes"; then - AX_CHECK_COMPILE_FLAG([-Qunused-arguments],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Qunused-arguments"],,[[$CXXFLAG_WERROR]]) -fi VERIFY_DEFINES=-DMINISKETCH_VERIFY RELEASE_DEFINES= diff --git a/src/minisketch/src/bench.cpp b/src/minisketch/src/bench.cpp index f55944a448..dc44379fdb 100644 --- a/src/minisketch/src/bench.cpp +++ b/src/minisketch/src/bench.cpp @@ -62,13 +62,11 @@ int main(int argc, char** argv) { if (!states[0]) { printf(" -\t"); } else { - double total = 0.0; for (auto& state : states) { auto start = std::chrono::steady_clock::now(); minisketch_decode(state, 2 * syndromes, roots.data()); auto stop = std::chrono::steady_clock::now(); std::chrono::duration<double> dur(stop - start); - total += dur.count(); benches.push_back(dur.count()); } std::sort(benches.begin(), benches.end()); @@ -98,7 +96,6 @@ int main(int argc, char** argv) { if (!states[0]) { printf(" -\t"); } else { - double total = 0.0; for (auto& state : states) { auto start = std::chrono::steady_clock::now(); for (auto val : data) { @@ -106,7 +103,6 @@ int main(int argc, char** argv) { } auto stop = std::chrono::steady_clock::now(); std::chrono::duration<double> dur(stop - start); - total += dur.count(); benches.push_back(dur.count()); } std::sort(benches.begin(), benches.end()); diff --git a/src/minisketch/src/int_utils.h b/src/minisketch/src/int_utils.h index 62b2c38a29..d21ba56f33 100644 --- a/src/minisketch/src/int_utils.h +++ b/src/minisketch/src/int_utils.h @@ -129,17 +129,7 @@ constexpr inline I Mask() { return ((I((I(-1)) << (std::numeric_limits<I>::digit /** Compute the smallest power of two that is larger than val. */ template<typename I> static inline int CountBits(I val, int max) { -#ifdef HAVE_CLZ - (void)max; - if (val == 0) return 0; - if (std::numeric_limits<unsigned>::digits >= std::numeric_limits<I>::digits) { - return std::numeric_limits<unsigned>::digits - __builtin_clz(val); - } else if (std::numeric_limits<unsigned long>::digits >= std::numeric_limits<I>::digits) { - return std::numeric_limits<unsigned long>::digits - __builtin_clzl(val); - } else { - return std::numeric_limits<unsigned long long>::digits - __builtin_clzll(val); - } -#elif _MSC_VER +#ifdef _MSC_VER (void)max; unsigned long index; unsigned char ret; @@ -149,7 +139,17 @@ static inline int CountBits(I val, int max) { ret = _BitScanReverse64(&index, val); } if (!ret) return 0; - return index; + return index + 1; +#elif HAVE_CLZ + (void)max; + if (val == 0) return 0; + if (std::numeric_limits<unsigned>::digits >= std::numeric_limits<I>::digits) { + return std::numeric_limits<unsigned>::digits - __builtin_clz(val); + } else if (std::numeric_limits<unsigned long>::digits >= std::numeric_limits<I>::digits) { + return std::numeric_limits<unsigned long>::digits - __builtin_clzl(val); + } else { + return std::numeric_limits<unsigned long long>::digits - __builtin_clzll(val); + } #else while (max && (val >> (max - 1) == 0)) --max; return max; diff --git a/src/minisketch/src/test.cpp b/src/minisketch/src/test.cpp index 417937ea5f..85b9e9e396 100644 --- a/src/minisketch/src/test.cpp +++ b/src/minisketch/src/test.cpp @@ -9,6 +9,7 @@ #include <limits> #include <random> #include <stdexcept> +#include <string> #include <vector> #include "../include/minisketch.h" |