1
0

template.c: optimize PRODUCT - 1

This commit is contained in:
Intel A80486DX2-66 2024-01-09 16:43:22 +03:00
parent c2791ce3fc
commit f067b87ba9
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -122,6 +122,8 @@ main(void)
}
// * bytebeat generating loop
const uintmax_t product_minus_1 = PRODUCT - 1;
for (size_t w = 0; w < PRODUCT; w++) {
// 1. generate audio data
long double bytebeat_res = bytebeat((long double)w);
@ -146,11 +148,11 @@ main(void)
// 6. log
#if VERBOSE_MODE
if (w % FREQUENCY_OF_STATUS_REPORTING == 0 ||
w >= (PRODUCT - 1) /* or if writing last sample */) {
w >= product_minus_1 /* or if writing last sample */) {
printf(
"%sremaining samples = %18" PRIuMAX " (%.2Lf%% done)",
ANSI_CLEAR,
PRODUCT - w - 1,
product_minus_1 - w,
((long double) w * 100) / (long double) PRODUCT);
fflush(stdout);
}