3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-10 11:00:52 +00:00

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>
This commit is contained in:
Copilot 2026-01-14 19:55:31 -08:00 committed by GitHub
parent 1bf463d77a
commit 2436943794
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
475 changed files with 3237 additions and 3237 deletions

View file

@ -102,13 +102,13 @@ void bit_vector::shift_right(unsigned k) {
}
if (bit_shift > 0) {
DEBUG_CODE({
for (unsigned i = 0; i < word_shift; i++) {
for (unsigned i = 0; i < word_shift; ++i) {
SASSERT(m_data[i] == 0);
}
});
unsigned comp_shift = (8 * sizeof(unsigned)) - bit_shift;
unsigned prev = 0;
for (unsigned i = word_shift; i < new_num_words; i++) {
for (unsigned i = word_shift; i < new_num_words; ++i) {
unsigned new_prev = (m_data[i] >> comp_shift);
m_data[i] <<= bit_shift;
m_data[i] |= prev;
@ -124,7 +124,7 @@ bool bit_vector::operator==(bit_vector const & source) const {
if (n == 0)
return true;
unsigned i;
for (i = 0; i < n - 1; i++) {
for (i = 0; i < n - 1; ++i) {
if (m_data[i] != source.m_data[i])
return false;
}
@ -142,12 +142,12 @@ bit_vector & bit_vector::operator|=(bit_vector const & source) {
unsigned bit_rest = source.m_num_bits % 32;
if (bit_rest == 0) {
unsigned i = 0;
for (i = 0; i < n2; i++)
for (i = 0; i < n2; ++i)
m_data[i] |= source.m_data[i];
}
else {
unsigned i = 0;
for (i = 0; i < n2 - 1; i++)
for (i = 0; i < n2 - 1; ++i)
m_data[i] |= source.m_data[i];
unsigned mask = MK_MASK(bit_rest);
m_data[i] |= source.m_data[i] & mask;
@ -161,7 +161,7 @@ bit_vector & bit_vector::operator&=(bit_vector const & source) {
if (n1 == 0)
return *this;
if (n2 > n1) {
for (unsigned i = 0; i < n1; i++)
for (unsigned i = 0; i < n1; ++i)
m_data[i] &= source.m_data[i];
}
else {
@ -169,17 +169,17 @@ bit_vector & bit_vector::operator&=(bit_vector const & source) {
unsigned bit_rest = source.m_num_bits % 32;
unsigned i = 0;
if (bit_rest == 0) {
for (i = 0; i < n2; i++)
for (i = 0; i < n2; ++i)
m_data[i] &= source.m_data[i];
}
else {
for (i = 0; i < n2 - 1; i++)
for (i = 0; i < n2 - 1; ++i)
m_data[i] &= source.m_data[i];
unsigned mask = MK_MASK(bit_rest);
m_data[i] &= (source.m_data[i] & mask);
}
for (i = n2; i < n1; i++)
for (i = n2; i < n1; ++i)
m_data[i] = 0;
}
return *this;
@ -196,7 +196,7 @@ void bit_vector::display(std::ostream & out) const {
out << "0";
}
#else
for (unsigned i = 0; i < m_num_bits; i++) {
for (unsigned i = 0; i < m_num_bits; ++i) {
if (get(i))
out << "1";
else