Use _bzhi_u32 for 32-bit builds when building with STATIC_BMI2
`_bzhi_u64` is available only for 64-bit builds, while `BIT_getLowerBits` expects `nbBits` to be less than `BIT_MASK_SIZE` (`BIT_MASK_SIZE` is 32)
This commit is contained in:
@@ -162,7 +162,11 @@ MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC,
|
||||
FORCE_INLINE_TEMPLATE size_t BIT_getLowerBits(size_t bitContainer, U32 const nbBits)
|
||||
{
|
||||
#if defined(STATIC_BMI2) && STATIC_BMI2 == 1 && !defined(ZSTD_NO_INTRINSICS)
|
||||
return _bzhi_u64(bitContainer, nbBits);
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
return _bzhi_u64(bitContainer, nbBits);
|
||||
#else
|
||||
return _bzhi_u32(bitContainer, nbBits);
|
||||
#endif
|
||||
#else
|
||||
assert(nbBits < BIT_MASK_SIZE);
|
||||
return bitContainer & BIT_mask[nbBits];
|
||||
|
||||
Reference in New Issue
Block a user