depends: update 'src/minisketch' to sipa/minisketch@a571ba20 as 1c94f1a3

This commit is contained in:
Kittywhiskers Van Gogh 2024-10-20 10:41:07 +00:00
commit ae019707b9
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
4 changed files with 13 additions and 19 deletions

View File

@ -124,9 +124,6 @@ if test "x$use_ccache" != "xno"; then
fi fi
AC_MSG_RESULT($use_ccache) AC_MSG_RESULT($use_ccache)
fi 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 VERIFY_DEFINES=-DMINISKETCH_VERIFY
RELEASE_DEFINES= RELEASE_DEFINES=

View File

@ -62,13 +62,11 @@ int main(int argc, char** argv) {
if (!states[0]) { if (!states[0]) {
printf(" -\t"); printf(" -\t");
} else { } else {
double total = 0.0;
for (auto& state : states) { for (auto& state : states) {
auto start = std::chrono::steady_clock::now(); auto start = std::chrono::steady_clock::now();
minisketch_decode(state, 2 * syndromes, roots.data()); minisketch_decode(state, 2 * syndromes, roots.data());
auto stop = std::chrono::steady_clock::now(); auto stop = std::chrono::steady_clock::now();
std::chrono::duration<double> dur(stop - start); std::chrono::duration<double> dur(stop - start);
total += dur.count();
benches.push_back(dur.count()); benches.push_back(dur.count());
} }
std::sort(benches.begin(), benches.end()); std::sort(benches.begin(), benches.end());
@ -98,7 +96,6 @@ int main(int argc, char** argv) {
if (!states[0]) { if (!states[0]) {
printf(" -\t"); printf(" -\t");
} else { } else {
double total = 0.0;
for (auto& state : states) { for (auto& state : states) {
auto start = std::chrono::steady_clock::now(); auto start = std::chrono::steady_clock::now();
for (auto val : data) { for (auto val : data) {
@ -106,7 +103,6 @@ int main(int argc, char** argv) {
} }
auto stop = std::chrono::steady_clock::now(); auto stop = std::chrono::steady_clock::now();
std::chrono::duration<double> dur(stop - start); std::chrono::duration<double> dur(stop - start);
total += dur.count();
benches.push_back(dur.count()); benches.push_back(dur.count());
} }
std::sort(benches.begin(), benches.end()); std::sort(benches.begin(), benches.end());

View File

@ -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. */ /** Compute the smallest power of two that is larger than val. */
template<typename I> template<typename I>
static inline int CountBits(I val, int max) { static inline int CountBits(I val, int max) {
#ifdef HAVE_CLZ #ifdef _MSC_VER
(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
(void)max; (void)max;
unsigned long index; unsigned long index;
unsigned char ret; unsigned char ret;
@ -149,7 +139,17 @@ static inline int CountBits(I val, int max) {
ret = _BitScanReverse64(&index, val); ret = _BitScanReverse64(&index, val);
} }
if (!ret) return 0; 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 #else
while (max && (val >> (max - 1) == 0)) --max; while (max && (val >> (max - 1) == 0)) --max;
return max; return max;

View File

@ -9,6 +9,7 @@
#include <limits> #include <limits>
#include <random> #include <random>
#include <stdexcept> #include <stdexcept>
#include <string>
#include <vector> #include <vector>
#include "../include/minisketch.h" #include "../include/minisketch.h"