template.c: optimize PRODUCT - 1
This commit is contained in:
parent
c2791ce3fc
commit
f067b87ba9
@ -122,6 +122,8 @@ main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// * bytebeat generating loop
|
// * bytebeat generating loop
|
||||||
|
const uintmax_t product_minus_1 = PRODUCT - 1;
|
||||||
|
|
||||||
for (size_t w = 0; w < PRODUCT; w++) {
|
for (size_t w = 0; w < PRODUCT; w++) {
|
||||||
// 1. generate audio data
|
// 1. generate audio data
|
||||||
long double bytebeat_res = bytebeat((long double)w);
|
long double bytebeat_res = bytebeat((long double)w);
|
||||||
@ -146,11 +148,11 @@ main(void)
|
|||||||
// 6. log
|
// 6. log
|
||||||
#if VERBOSE_MODE
|
#if VERBOSE_MODE
|
||||||
if (w % FREQUENCY_OF_STATUS_REPORTING == 0 ||
|
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(
|
printf(
|
||||||
"%sremaining samples = %18" PRIuMAX " (%.2Lf%% done)",
|
"%sremaining samples = %18" PRIuMAX " (%.2Lf%% done)",
|
||||||
ANSI_CLEAR,
|
ANSI_CLEAR,
|
||||||
PRODUCT - w - 1,
|
product_minus_1 - w,
|
||||||
((long double) w * 100) / (long double) PRODUCT);
|
((long double) w * 100) / (long double) PRODUCT);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user