How to clear compile error when using rdrand64_step due to typedef'ing a 64-bit type?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm catching a compile error when using rdrand64_step on x86_64. If I
change the typedef to use 'unsigned long long', then I catch a compile
error under AArch64 when using NEON intrinsics.

How should I clear the compile error in a way that does not lead to
additional breaks?

Thanks in advance.

Jeff

**********

$ cat test.cc
#include <x86intrin.h>

#if _LP64 || __LP64__
typedef unsigned long my_u64;
#else
typedef unsigned long long my_u64;
#endif

int main(int argc, char* argv[])
{
  my_u64 val;
  _rdrand64_step(&val);

  return 0;
}

$ gcc -mrdrnd test.cc -o test.exe
test.cc: In function ‘int main(int, char**)’:
test.cc:12:22: error: invalid conversion from ‘my_u64* {aka long
unsigned int*}’ to ‘long long unsigned int*’ [-fpermissive]
   _rdrand64_step(&val);
                      ^
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:46:0,
                 from test.cc:1:
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/immintrin.h:166:1: note:
initializing argument 1 of ‘int _rdrand64_step(long long unsigned
int*)’
 _rdrand64_step (unsigned long long *__P)
 ^

**********

Intel's declaration is (http://software.intel.com/en-us/node/523864):

    extern int _rdrand64_step(unsigned __int64 *random_val);

**********

$ grep -R 'unsigned __int64' /usr/lib/gcc/x86_64-linux-gnu/4.9/include
| grep typedef
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/cilk/common.h:
typedef unsigned __int64 uint64_t;

$ grep -R 'uint64_t' /usr/lib/gcc/x86_64-linux-gnu/4.9/include | grep typedef
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdint-gcc.h:typedef
__UINT64_TYPE__ uint64_t;
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/cilk/common.h:
typedef unsigned __int64 uint64_t;

The trail ends at __UINT64_TYPE__. I can't find what its defined as.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux