3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-02 23:36:17 +00:00
z3/src/util/approx_set.cpp
Copilot 2436943794
Standardize for-loop increments to prefix form (++i) (#8199)
* Initial plan

* Convert postfix to prefix increment in for loops

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Fix member variable increment conversion bug

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Update API generator to produce prefix increments

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-01-14 19:55:31 -08:00

52 lines
893 B
C++

/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
approx_set.cpp
Abstract:
Approximated sets.
Author:
Leonardo de Moura (leonardo) 2007-03-02.
Revision History:
--*/
#include "util/approx_set.h"
void approx_set::display(std::ostream & out) const {
out << "{";
bool first = true;
unsigned long long s = m_set;
for (unsigned i = 0; i < approx_set_traits<unsigned long long>::capacity; ++i) {
if ((s & 1) != 0) {
if (first) {
first = false;
}
else {
out << ", ";
}
out << i;
}
s = s >> 1;
}
out << "}";
}
unsigned approx_set::size() const {
unsigned long long tmp = m_set;
unsigned r = 0;
while (tmp > 0) {
if ((tmp & 1) != 0) {
r++;
}
tmp = tmp >> 1;
}
return r;
}