xsimd icon indicating copy to clipboard operation
xsimd copied to clipboard

Handle loading of bool* correctly

Open wolfv opened this issue 5 years ago • 1 comments

Currently, it's not possible to load from a bool pointer.

E.g.

xt::uvector<bool> xbools(100, true);
xsimd::load_unaligned(&xbools[0])

fails with substitution errors. Now it's actually a question what we should do here. Maybe we should map bools to batches with sizeof(bool) elements? batch<char, 8>(bool*)...

wolfv avatar Dec 12 '18 11:12 wolfv

Note I am using uvector here because std::vector uses a bitmask ... :)

wolfv avatar Dec 12 '18 11:12 wolfv

The bool type matches with xsimd::batch_bool<T, Arch>, so provided you know which type of boolean mask you want to load, xsimd supports xsimd::batch_bool<T, Arch>::load_unaligned(bool*), see https://godbolt.org/z/zvMeE9b6E

serge-sans-paille avatar Dec 13 '22 20:12 serge-sans-paille