I am trying to compile a C project to Javascript using Emscripten, and I have very basic code which uses the GCC extension supporting __int128
as seen below:
unsigned __int128 r = (unsigned __int128)a * (unsigned __int128)b;
*hi = r >> 64;
return (uint64_t)r;
Now these variables are being cast from uint64_t
pointers which I know are supported in Emscripten, but I get an error on compilation which says
error: __int128 is not supported on this target
So, either I don't know how to enable support or there is no support for this type. If the latter, does anyone have tips for how to mimic 128 bit unsigned integer multiplication without having type support for it? The code doesn't seem to actually need to keep the result in full unsigned 128 bit form, as the line right after the multiplication shifts the number down to a 64 bit unsigned int.