Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
philippM's avatar
philippM
Honored Guest
11 years ago

OVR_Alg.h -> "Integer Constant is too large for 'long' type"

I'm getting the following compile error when building a project that includes the oculus SDK headers:

Integer constant is too large for 'long' type in ../LibOVR/Include/../Src/Kernel/OVR_Alg.h line 812.

I'm getting that error when building with GCC on Mac OSX with 32bit target. I don't get it when targeting 64bit, and I don't get it when targeting 32bit compiling with clang. So it is an error specific to using GCC with 32bit target.

Any ideas?

2 Replies

  • The solution is to mark the constant literals as unsigned long long by suffixing them with ULL:

    inline UInt64 SwapOrder(UInt64 v)
    {
    return (v>>56) |
    ((v&UInt64(0x00FF000000000000ULL))>>40) |
    ((v&UInt64(0x0000FF0000000000ULL))>>24) |
    ((v&UInt64(0x000000FF00000000ULL))>>8) |
    ((v&UInt64(0x00000000FF000000ULL))<<8) |
    ((v&UInt64(0x0000000000FF0000ULL))<<24) |
    ((v&UInt64(0x000000000000FF00ULL))<<40) |
    (v<<56);
    }

    how to notify them so this patch gets into the next SDK, so no one else gets this error in the future?
  • GCC is a bit more pedantic than some compilers on this. Good catch! Fixed.