Is there any way to get the high half of the multiplication of two long
s in Java? I.e. the part that vanishes due to overflow. (So the upper 64 bits of the 128-bit result)
I'm used to writing OpenCL code where the command mul_hi
does exactly this: http://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/mul_hi.html
Since OpenCL can do it efficiently on my CPU, Java should be able to do so as well, but I can't find how I should do this (or even mimic its behaviour efficiently) in Java. Is this possible in Java, and if so, how?