[Design question] mask construction using custom value
Matthias Kretz
[please enable javascript to see the address]
Mon Mar 9 10:18:52 CET 2015
Hi Przemysław,
do I understand correctly you're looking for the reverse of Mask::toInt()?
Because Mask supports the conversion from bool.
The simple answer is, because nobody did it. ;)
The longer answer: There's already a problem with toInt. In terms of the
abstraction, there is no guarantee that sizeof(int) >= Mask::Size.
So rather I'd look into an API for converting Mask to std::bitset<Size> and
back. Since this makes the bitset type target dependent, a valid approach is
to use a load/store interface using unsigned char* instead. This is still a
portability issue because Mask objects with Size < sizeof(unsigned char) only
do partial stores at each address. And there would be no way to access the
remaining bits.
Are you interested in implementing one of the above?
As a much easier and portable alternative you have load and store
functionality for bool* in Mask. If you don't have to store a huge amount of
boolean data, then this should be good enough for now.
Cheers,
Matthias
On Thursday 12 February 2015 14:15:38 Przemyslaw Karpinski wrote:
> Hello everyone,
>
> Mask classes provide no assignment operator or a constructor constructing
> masks from basic types. While I think adding the assignment operator might
> result in an incorrect usage of the masks, the construction of mask using
> integer constants can still be useful while not posing additional
> significant overheads during runtime.
>
> Is there a plan to add such functionality? If not, then why and is there a
> workaround for assigning mask with custom, non-uniform value, that does not
> require modifications in VC code?
>
> Kind regards,
> Przemysław Karpiński.
> -------------------------------------------
> Marie Curie Fellow, CERN
> Intel-CERN Openlab Collaboration
>[please enable javascript to see the address][please enable javascript to see the address]>
> mobile: (+48)503478598
>
> Conducting research in HPC applications for HEP.
> -------------------------------------------
--
─────────────────────────────────────────────────────────────
Dipl.-Phys. Matthias Kretz
Web: http://compeng.uni-frankfurt.de/?mkretz
SIMD easy and portable: http://compeng.uni-frankfurt.de/?vc
─────────────────────────────────────────────────────────────
More information about the Vc-devel
mailing list