depends: update 'src/minisketch' to sipa/minisketch@eb37a9b8 as ef10e83d

This commit is contained in:
Kittywhiskers Van Gogh 2024-10-29 10:16:07 +00:00
commit 33035ffde0
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
7 changed files with 15 additions and 11 deletions

View File

@ -102,6 +102,7 @@ case $host in
esac
AX_CHECK_COMPILE_FLAG([-Wall],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wall"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wundef], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wundef"], [], [$CXXFLAG_WERROR])
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[CXXFLAGS="$CXXFLAGS -fvisibility=hidden"],[],[$CXXFLAG_WERROR])
if test "x$use_ccache" != "xno"; then

View File

@ -239,7 +239,7 @@ public:
/** Make this Minisketch a clone of the specified one. */
Minisketch& operator=(const Minisketch& sketch) noexcept
{
if (sketch.m_minisketch) {
if (this != &sketch && sketch.m_minisketch) {
m_minisketch = std::unique_ptr<minisketch, Deleter>(minisketch_clone(sketch.m_minisketch.get()));
}
return *this;

View File

@ -81,7 +81,8 @@ uint64_t BaseFPBits(uint32_t bits, uint32_t capacity) {
size_t ComputeCapacity(uint32_t bits, size_t max_elements, uint32_t fpbits) {
if (bits == 0) return 0;
uint64_t base_fpbits = BaseFPBits(bits, max_elements);
if (max_elements > 0xffffffff) return max_elements;
uint64_t base_fpbits = BaseFPBits(bits, static_cast<uint32_t>(max_elements));
// The fpbits provided by the base max_elements==capacity case are sufficient.
if (base_fpbits >= fpbits) return max_elements;
// Otherwise, increment capacity by ceil(fpbits / bits) beyond that.
@ -90,6 +91,7 @@ size_t ComputeCapacity(uint32_t bits, size_t max_elements, uint32_t fpbits) {
size_t ComputeMaxElements(uint32_t bits, size_t capacity, uint32_t fpbits) {
if (bits == 0) return 0;
if (capacity > 0xffffffff) return capacity;
// Start with max_elements=capacity, and decrease max_elements until the corresponding capacity is capacity.
size_t max_elements = capacity;
while (true) {

View File

@ -159,7 +159,7 @@ static inline int CountBits(I val, int max) {
}
if (!ret) return 0;
return index + 1;
#elif HAVE_CLZ
#elif defined(HAVE_CLZ)
(void)max;
if (val == 0) return 0;
if (std::numeric_limits<unsigned>::digits >= std::numeric_limits<I>::digits) {
@ -210,7 +210,7 @@ public:
static constexpr inline int TopBits(I val) {
static_assert(Count > 0, "BitsInt::TopBits needs Count > 0");
static_assert(Count <= BITS, "BitsInt::TopBits needs Offset <= BITS");
return val >> (BITS - Count);
return static_cast<int>(val >> (BITS - Count));
}
static inline constexpr I CondXorWith(I val, bool cond, I v) {

View File

@ -468,7 +468,7 @@ size_t minisketch_merge(minisketch* sketch, const minisketch* other_sketch) {
ssize_t minisketch_decode(const minisketch* sketch, size_t max_elements, uint64_t* output) {
const Sketch* s = (const Sketch*)sketch;
s->Check();
return s->Decode(max_elements, output);
return s->Decode(static_cast<int>(max_elements), output);
}
void minisketch_set_seed(minisketch* sketch, uint64_t seed) {

View File

@ -29,7 +29,7 @@ public:
virtual ~Sketch() {}
virtual size_t Syndromes() const = 0;
virtual void Init(int syndromes) = 0;
virtual void Init(size_t syndromes) = 0;
virtual void Add(uint64_t element) = 0;
virtual void Serialize(unsigned char*) const = 0;
virtual void Deserialize(const unsigned char*) = 0;

View File

@ -92,7 +92,8 @@ template<typename F>
void Sqr(std::vector<typename F::Elem>& poly, const F& field) {
if (poly.size() == 0) return;
poly.resize(poly.size() * 2 - 1);
for (int x = poly.size() - 1; x >= 0; --x) {
for (size_t i = 0; i < poly.size(); ++i) {
auto x = poly.size() - i - 1;
poly[x] = (x & 1) ? 0 : field.Sqr(poly[x / 2]);
}
}
@ -217,7 +218,7 @@ bool RecFindRoots(std::vector<std::vector<typename F::Elem>>& stack, size_t pos,
}
if (fully_factorizable) {
// Every succesful iteration of this algorithm splits the input
// Every successful iteration of this algorithm splits the input
// polynomial further into buckets, each corresponding to a subset
// of 2^(BITS-depth) roots. If after depth splits the degree of
// the polynomial is >= 2^(BITS-depth), something is wrong.
@ -297,7 +298,7 @@ std::vector<typename F::Elem> BerlekampMassey(const std::vector<typename F::Elem
auto discrepancy = syndromes[n];
for (size_t i = 1; i < current.size(); ++i) discrepancy ^= table[n - i](current[i]);
if (discrepancy != 0) {
int x = n + 1 - (current.size() - 1) - (prev.size() - 1);
int x = static_cast<int>(n + 1 - (current.size() - 1) - (prev.size() - 1));
if (!b_have_inv) {
b_inv = field.Inv(b);
b_have_inv = true;
@ -366,7 +367,7 @@ public:
}
size_t Syndromes() const override { return m_syndromes.size(); }
void Init(int count) override { m_syndromes.assign(count, 0); }
void Init(size_t count) override { m_syndromes.assign(count, 0); }
void Add(uint64_t val) override
{
@ -405,7 +406,7 @@ public:
for (const auto& root : roots) {
*(out++) = m_field.ToUint64(root);
}
return roots.size();
return static_cast<int>(roots.size());
}
size_t Merge(const Sketch* other_sketch) override