I have multiple macro functions in my project.
Here is the first macro defined as following
#if !defined(bswap_32)
#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00))
#endif
Here is the second macro function, which calls the first macro function
#if defined(SWAP_BYTES)
#define bsw_32(p,n) \
{ int _i = (n); while(_i--) ((uint32_t*)p)[_i] = bswap_32(((uint32_t*)p)[_i]); }
At compilation level, the nvcc complains the following
error: calling a __host__ function("__bswap_32") from a __device__ function is not allowed
When i substitute the contents of bswap_32 in the second macro , it compiles just fine.
The problem occurs when i call the second macro function from the first.