Update minisketch subtree to latest upstream

pull/26373/head
Hennadii Stepanov 2 years ago
commit 45a0f4e014
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

@ -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=

@ -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());

@ -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;

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

Loading…
Cancel
Save