Do we need an unsigned multiplyHigh?

Peter Lawrey peter.lawrey at gmail.com
Wed Sep 27 10:28:19 UTC 2017


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.
ᐧ

On 26 September 2017 at 15:57, Andrew Haley <aph at redhat.com> wrote:

> On 26/09/17 15:53, Peter Lawrey wrote:
> > None, except you end up jumping through hoops to implement 128 bit
> > arithmetic efficiently or cleanly. At some point language support for
> such
> > a basic operation is the simplest and clearest solution.
>
> There's nothing inefficient about this approach.  I don't quite see
> how 128-bit types help with cleanliness, because then you'd need a
> multiplyHigh for 128-bit types, surely?  You need that for the type
> system to be complete.
>
> --
> Andrew Haley
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
>


More information about the discuss mailing list