Do we need an unsigned multiplyHigh?

Peter Lawrey peter.lawrey at
Wed Sep 27 15:25:32 UTC 2017

Indeed cleanliness is in the eye of the beholder. ;)
I feel for mathematical code like this it should be possible to write
something as fast and clear as C++, whether that is desirable or not is
another matter.

Perhaps project Valhalla will be a way to return multiple values by having
a composite value type, or panama with it's support for XMM instructions
(or both)


On 27 September 2017 at 16:44, Andrew Haley <aph at> wrote:

> On 27/09/17 11:28, Peter Lawrey wrote:
> > If you need multiplyHigh for 128-bit then you need uint256. At some point
> > you have to decide whether you need that many bits as a supported
> > operation.  When Java was created a 64-bit long as the widest type made
> > sense, however CPUs such as x64 now support 128, 256 and 512 bit natively
> > and having the JVM dong its best to work this out is not as clean as
> > defining it explicitly.
> I guess cleanliness is in the eye of the beholder.  IMO multiplyHigh is
> as clean as we need, and I'd rather see more complexity there than in
> the type system.  It'd be nice to be able to return more than one scalar
> value from a method, for sure.
> --
> Andrew Haley
> Java Platform Lead Engineer
> Red Hat UK Ltd. <>
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the security-dev mailing list