Adding static assert and using it in cli
This commit is contained in:
parent
0fa6c90e89
commit
38d010eea0
@ -544,7 +544,10 @@ static int init_cLevel(void) {
|
||||
return ZSTDCLI_CLEVEL_DEFAULT;
|
||||
}
|
||||
|
||||
#define ZSTD_CLI_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
|
||||
|
||||
#define ZSTD_NB_STRATEGIES ZSTD_STRATEGY_MAX
|
||||
|
||||
static const char* ZSTD_strategyMap[ZSTD_NB_STRATEGIES + 1] = { "", "ZSTD_fast",
|
||||
"ZSTD_dfast", "ZSTD_greedy", "ZSTD_lazy", "ZSTD_lazy2", "ZSTD_btlazy2",
|
||||
"ZSTD_btopt", "ZSTD_btultra", "ZSTD_btultra2"};
|
||||
@ -1227,6 +1230,8 @@ int main(int const argCount, const char* argv[])
|
||||
if (adaptMin > cLevel) cLevel = adaptMin;
|
||||
if (adaptMax < cLevel) cLevel = adaptMax;
|
||||
|
||||
ZSTD_CLI_STATIC_ASSERT(ZSTD_NB_STRATEGIES >= ZSTD_STRATEGY_MIN && ZSTD_NB_STRATEGIES <= ZSTD_STRATEGY_MAX);
|
||||
|
||||
if (showDefaultCParams) {
|
||||
size_t fileNb;
|
||||
for (fileNb = 0; fileNb < (size_t)filenames->tableSize; fileNb++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user