3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-22 16:27:37 +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

@ -40,7 +40,7 @@ static void tst2() {
to.insert(1);
to.insert_after(1, 2);
to.insert_after(2, 3);
for (unsigned i = 0; i < 1000; i++) {
for (unsigned i = 0; i < 1000; ++i) {
to.move_after(3, 1);
to.move_after(1, 2);
to.move_after(2, 3);
@ -52,10 +52,10 @@ static void tst2() {
static void tst3(unsigned sz, unsigned num_rounds) {
uint_total_order to;
to.insert(0);
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
to.insert_after(i, i+1);
}
for (unsigned i = 0; i < num_rounds; i++) {
for (unsigned i = 0; i < num_rounds; ++i) {
unsigned v1 = rand() % sz;
unsigned v2 = rand() % sz;
if (v1 != v2)
@ -78,7 +78,7 @@ void move_after(unsigned_vector & v, unsigned_vector & inv_v, unsigned a, unsign
unsigned pos_b = inv_v[b];
ENSURE(pos_a != pos_b);
if (pos_b < pos_a) {
for (unsigned i = pos_b; i < pos_a; i++) {
for (unsigned i = pos_b; i < pos_a; ++i) {
v[i] = v[i+1];
inv_v[v[i+1]] = i;
}
@ -106,19 +106,19 @@ static void tst4(unsigned sz, unsigned num_rounds) {
to.insert(0);
v.push_back(0);
inv_v.push_back(0);
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
to.insert_after(i, i+1);
v.push_back(i+1);
inv_v.push_back(i+1);
}
for (unsigned i = 0; i < num_rounds; i++) {
for (unsigned i = 0; i < num_rounds; ++i) {
unsigned v1 = rand() % sz;
unsigned v2 = rand() % sz;
if (v1 != v2) {
to.move_after(v1, v2);
move_after(v, inv_v, v1, v2);
}
for (unsigned k = 0; k < sz - 1; k++) {
for (unsigned k = 0; k < sz - 1; ++k) {
ENSURE(inv_v[v[k]] == k);
ENSURE(to.lt(v[k], v[k+1]));
}
@ -133,12 +133,12 @@ static void tst4(unsigned sz, unsigned num_rounds) {
static void bad_case(unsigned sz, unsigned num_rounds) {
uint_total_order to;
to.insert(0);
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
to.insert_after(i, i+1);
}
for (unsigned i = 0; i < num_rounds; i++) {
for (unsigned i = 0; i < num_rounds; ++i) {
to.move_after(sz, 0);
for (unsigned j = 0; j < sz; j++) {
for (unsigned j = 0; j < sz; ++j) {
to.move_after(j, j+1);
}
if (i % 10 == 0) {