Merge pull request #2800 from animalize/fix_c89

Fix a C89 error in msvc
This commit is contained in:
Yann Collet
2021-10-18 14:32:04 -07:00
committed by GitHub
13 changed files with 131 additions and 58 deletions
+8 -2
View File
@@ -883,8 +883,14 @@ typedef U64 ZSTD_VecMask; /* Clarifies when we are interacting with a U64 repr
static U32 ZSTD_VecMask_next(ZSTD_VecMask val) {
assert(val != 0);
# if defined(_MSC_VER) && defined(_WIN64)
unsigned long r=0;
return _BitScanForward64(&r, val) ? (U32)r : 0; /* _BitScanForward64 not defined outside of x86/64 */
if (val != 0) {
unsigned long r;
_BitScanForward64(&r, val);
return (U32)(r);
} else {
/* Should not reach this code path */
__assume(0);
}
# elif (defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))
if (sizeof(size_t) == 4) {
U32 mostSignificantWord = (U32)(val >> 32);