Hi,
I’m trying to take a 8 character byte array and convert it to a 64 bit integer. The code I have below compiles and works fine in non-cuda c++, but does not compile in cuda nvcc. If there is another way to do this conversion please let me know, I know some functions I tried just did not work because they were not device functions.
I receive this error when I compile the code:
1>### Assertion failure at line 1923 of …/…/be/cg/cgemit.cxx:
1>### Compiler Error in file C:/Users/john/AppData/Local/Temp/tmpxft_00002238_00000000-9_DeviceFunctions.cpp3.i during Assembly phase:
1>### incorrect register class for operand 0
Here is the code I’m compiling. All I’m really doing is changing the endian of the bytes and referring to the switched array as an unsigned 64 bit integer.
device void dConvertCAToInt64(unsigned __int64* intInt64Out, unsigned char* chrCAIn)
{
unsigned char chrCAOutRev[8];
unsigned __int64* p_intInt64 = (unsigned __int64 *)&chrCAOutRev;
chrCAOutRev[0] = chrCAIn[7];
chrCAOutRev[1] = chrCAIn[6];
chrCAOutRev[2] = chrCAIn[5];
chrCAOutRev[3] = chrCAIn[4];
chrCAOutRev[4] = chrCAIn[3];
chrCAOutRev[5] = chrCAIn[2];
chrCAOutRev[6] = chrCAIn[1];
chrCAOutRev[7] = chrCAIn[0];
*intInt64Out = *p_intInt64; // <---- This is the specific line that is causing the error!!!
}
Any info is appreciated.
Thanks.