Is it possible AT ALL? I know that OpenCL doesn’t support normal bitfields right now.
Could there be a way to get a definite 64-bits out of bool myBool[64] or something like
union newType{
double value;
bool bit[64];
};
or anything at all remotely related that could be helpful? i’ld like to have some static bit patterns to compare against value and be able to quickly manipulate single bits of the patterns.
The OpenCL Spec guarantees that a
doublewill be 64 bits and that you can reinterpret it usingas_long()or a union to get along, which is 64 bits.Reinterpreting a 64 bit scalar to something like a
char[8]or achar8is legal (using a union andas_char8()respectively), but the result is implementation-defined. Things like endianness conversions may occur, so you may have to watch out if your GPU behaves differently from your CPU in that respect.The only portable way to do bit manipulation on a
doubleis to use bitwise operators on a 64-bit scalar integer type, meaininglongorulong.