Skip to content

Commit 9cba468

Browse files
authored
Fix emulated mask()
Problem: 0/1 values are shifted inside a 32Bit integer value up to 63 positions to the left. Therefore, all bits at positions > 32 in the final uint64_t return value will be set to 0. Fix: Explicit cast to (uint64_t) before shifting.
1 parent 5e971d6 commit 9cba468

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

include/xsimd/arch/xsimd_emulated.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ namespace xsimd
508508
constexpr size_t size = batch<T, A>::size;
509509
uint64_t res = 0;
510510
for (size_t i = 0; i < size; ++i)
511-
res |= (self.data[i] ? 1u : 0u) << i;
511+
res |= (uint64_t)(self.data[i] ? 1u : 0u) << i;
512512
return res;
513513
}
514514

0 commit comments

Comments
 (0)