made ZSTD_isPower2() an inline function

This commit is contained in:
Yann Collet
2024-10-23 11:50:57 -07:00
parent a167571db5
commit 7bad787d8b
2 changed files with 8 additions and 4 deletions
+5 -1
View File
@@ -278,7 +278,11 @@
* Alignment check
*****************************************************************/
#define ZSTD_IS_POWER_2(a) (((a) & ((a)-1)) == 0)
/* @return 1 if @u is a 2^n value, 0 otherwise
* useful to check a value is valid for alignment restrictions */
MEM_STATIC int ZSTD_isPower2(size_t u) {
return (u & (u-1)) == 0;
}
/* this test was initially positioned in mem.h,
* but this file is removed (or replaced) for linux kernel