From f067b87ba9709439409279737a6d2b4d1b17e8fa Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Tue, 9 Jan 2024 16:43:22 +0300 Subject: [PATCH] template.c: optimize `PRODUCT - 1` --- src/template.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/template.c b/src/template.c index c00ecce..acf5632 100644 --- a/src/template.c +++ b/src/template.c @@ -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); }