Skip to contentSkip to conversation

erofs-utils: lib: use another way to check power-of-2

PATCH New Gao Xiang 1 participant 1 message Sep 10, 2024 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: lib: use another way to check power-of-2

Otherwise, Coverity will complain as "Operands don't affect result (CONSTANT_EXPRESSION_RESULT)", which I don't think that is an issue.

Coverity-id: 508261

---
 lib/kite_deflate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/kite_deflate.c +1 -1
index 4b1068b..592c4d1 100644
@@ -834,7 +834,7 @@ static int kite_mf_init(struct kite_matchfinder *mf, unsigned int wsiz,
 		return -EINVAL;
 	cfg = &kite_mfcfg[level];
 
-	if (wsiz > kHistorySize32 || (1 << ilog2(wsiz)) != wsiz)
+	if (wsiz > kHistorySize32 || (wsiz & (wsiz - 1)))
 		return -EINVAL;
 
 	mf->hash = calloc(0x10000, sizeof(mf->hash[0]));
Signature · 1 line
2.43.5