Antonio Sanchez 3d98a6ef5c Modify scalar pzero, ptrue, pselect, and p<binary> operations to avoid memset.
The `memset` function and bitwise manipulation only apply to POD types
that do not require initialization, otherwise resulting in UB. We currently
violate this in `ptrue` and `pzero`, we assume bitmasks for `pselect`, and
bitwise operations are applied byte-by-byte in the generic implementations.

This is causing issues for scalar types that do require initialization
or that contain non-POD info such as pointers (#2201). We either break
them, or force specializations of these functions for custom scalars,
even if they are not vectorized.

Here we modify these functions for scalars only - instead using only
scalar operations:
- `pzero`: `Scalar(0)` for all scalars.
- `ptrue`: `Scalar(1)` for non-trivial scalars, bitset to one bits for trivial scalars.
- `pselect`: ternary select comparing mask to `Scalar(0)` for all scalars
- `pand`, `por`, `pxor`, `pnot`: use operators `&`, `|`, `^`, `~` for all integer or non-trivial scalars, otherwise apply bytewise.

For non-scalar types, the original implementations are used to maintain
compatibility and minimize the number of changes.

Fixes #2201.
2021-08-03 08:44:28 -07:00
..
2019-03-14 10:08:12 +01:00
2016-05-18 14:03:03 +02:00
2018-11-23 15:37:09 +01:00
2021-04-02 22:06:27 +00:00
2021-03-15 13:32:24 -07:00
2019-12-11 18:22:57 +00:00
2021-01-27 23:32:12 +01:00
2021-05-07 16:26:57 +00:00
2021-01-27 23:32:12 +01:00
2021-03-10 22:17:03 -08:00
2021-01-05 10:41:25 -08:00
2021-04-22 18:45:19 +00:00
2021-01-21 09:44:42 -08:00
2019-01-15 10:51:03 +01:00
2018-11-23 15:12:06 +01:00