android-ndkg++int128

Is there a way to use __int128_t with the Android NDK?


Is there a way to use __int128_t with the Android NDK?

I tried to use GNU toolchain 4.9 but I get the following error no matter how I try: error: '__int128_t' was not declared in this scope

-std=gnu++11 is enabled of course.


Solution

  • Is there a way to use __int128_t with the Android NDK?

    I don't believe so. __int128_t is emulated, and its only available on 64-bit platforms. Its not available on Android at the moment, which is a 32-bit platform. See Is __int128_t arithmetic emulated by GCC, even with SSE?.

    You can check for availability of __int128_t by detecting the presence of the macro __SIZEOF_INT128__. If the macro is defined and the value is 16 or more then 128-bit types are available. Also see 128-bit integer - nonsensical documentation? on the GCC mailing list.