3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-20 20:05:51 +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

@ -288,7 +288,7 @@ public:
static void tst2() {
tst_hash(0);
for (int i = 0; i <= 10000; i++) {
for (int i = 0; i <= 10000; ++i) {
int r = rand() % INT_MAX;
if (rand()%2 == 1) r = -r;
tst_hash(r);
@ -299,7 +299,7 @@ public:
static void tst7() {
rational p;
p = power(rational(2), 32);
for (unsigned i = 1; i < 1000; i++) {
for (unsigned i = 1; i < 1000; ++i) {
rational n(i);
rational x;
rational y;
@ -396,7 +396,7 @@ static void tst10(bool use_ints) {
vals.resize(NUM_RATIONALS);
vals2.resize(NUM_RATIONALS);
fvals.resize(NUM_RATIONALS);
for (unsigned i = 0; i < NUM_RATIONALS; i++) {
for (unsigned i = 0; i < NUM_RATIONALS; ++i) {
int r1 = rand() % MAGNITUDE;
int r2 = use_ints ? 1 : rand() % MAGNITUDE;
if (r2 == 0) r2 = 1;
@ -407,13 +407,13 @@ static void tst10(bool use_ints) {
}
{
timeit t(true, "multiplication with rationals");
for (unsigned i = 0; i < NUM_RATIONALS - 1; i++) {
for (unsigned i = 0; i < NUM_RATIONALS - 1; ++i) {
vals[i] *= vals[i+1];
}
}
{
timeit t(true, "multiplication with floats: ");
for (unsigned i = 0; i < NUM_RATIONALS - 1; i++) {
for (unsigned i = 0; i < NUM_RATIONALS - 1; ++i) {
fvals[i] *= fvals[i+1];
}
}
@ -428,7 +428,7 @@ static void tst11(bool use_ints) {
vector<float> fvals;
vals.resize(NUM_RATIONALS2);
fvals.resize(NUM_RATIONALS2);
for (unsigned i = 0; i < NUM_RATIONALS2; i++) {
for (unsigned i = 0; i < NUM_RATIONALS2; ++i) {
int r1 = rand() % MAGNITUDE2;
int r2 = use_ints ? 1 : rand() % MAGNITUDE2;
if (r2 == 0) r2 = 1;
@ -438,15 +438,15 @@ static void tst11(bool use_ints) {
}
{
timeit t(true, "multiplication with big rationals");
for (unsigned j = 0; j < 10; j++)
for (unsigned i = 0; i < NUM_RATIONALS2-1; i++) {
for (unsigned j = 0; j < 10; ++j)
for (unsigned i = 0; i < NUM_RATIONALS2-1; ++i) {
vals[i] *= vals[i+1];
}
}
{
timeit t(true, "multiplication with floats: ");
for (unsigned j = 0; j < 10; j++)
for (unsigned i = 0; i < NUM_RATIONALS2-1; i++) {
for (unsigned j = 0; j < 10; ++j)
for (unsigned i = 0; i < NUM_RATIONALS2-1; ++i) {
fvals[i] *= fvals[i+1];
}
}