Skip to content

Commit

Permalink
Refined tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
czurnieden committed Jun 10, 2024
1 parent ac33ffb commit 37ba942
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions etc/tune.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,25 +633,33 @@ int main(int argc, char **argv)
"\"Faster radix conversion (writing)\"", &MP_RADIX_WRITE_CUTOFF,
&(updated.RADIX_WRITE),MP_HAS(S_MP_FASTER_TO_RADIX) ? s_time_radix_conversion_write : NULL
}

#undef T_MUL_SQR
};
/* Turn all limits from bncore.c to the max */
set_cutoffs(&max_cutoffs);

for (n = 0; n < (sizeof(test)/sizeof(test[0]) - 2); ++n) {
if (test[n].fn != NULL) {
s_run(test[n].name, test[n].fn, test[n].cutoff);
*test[n].update = *test[n].cutoff;
*test[n].cutoff = INT_MAX;
};
}
/* Cutoffs for radix conversions are in bits to make handling of 62 different radices
more feasible. */

/* We need the updated fast multiplication cutoffs for the radix conversion, set them */
for (n = 0; n < (sizeof(test)/sizeof(test[0]) - 2); ++n) {
if (test[n].fn != NULL) {
*test[n].cutoff = *test[n].update;
};
}

/* Cutoffs for radix conversions are in bits to make handling of 62 different radices easier */
for (; n < sizeof(test)/sizeof(test[0]); ++n) {
if (test[n].fn != NULL) {
s_run(test[n].name, test[n].fn, test[n].cutoff);
/* TODO: can overflow for small INT_MAX */
*test[n].update = ((*test[n].cutoff) * MP_DIGIT_BIT * 93)/28;
*test[n].cutoff = INT_MAX;
}
}
}
Expand Down

0 comments on commit 37ba942

Please sign in to comment.