template.c: fix possible division by zero

This commit is contained in:
Intel A80486DX2-66 2024-01-21 14:05:52 +03:00
parent c81054b6f6
commit ba855735fb
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B
1 changed files with 7 additions and 1 deletions

View File

@ -195,7 +195,13 @@ main(void)
(uintmax_t) (sizeof(SAMPLE_TYPE) / sizeof(uint8_t)));
exit(EXIT_FAILURE);
}
const size_t MAX = (PRODUCT + (BLOCK_SIZE - 1)) / BLOCK_SIZE;
const size_t MAX =
#if BLOCK_SIZE > 0
(PRODUCT + (BLOCK_SIZE - 1)) / BLOCK_SIZE
#else
0
#endif
;
size_t w = 0;
for (size_t seq = 0; seq < MAX; seq++) {