How do I do a 64 bits mulhi in D?

deadalnix deadalnix at gmail.com
Sun Nov 27 01:55:45 UTC 2022


On Sunday, 27 November 2022 at 01:53:11 UTC, Vladimir Panteleev 
wrote:
> On Sunday, 27 November 2022 at 01:26:36 UTC, deadalnix wrote:
>> Mulhi is an instruction that is effectively available on any 
>> 64 bits CPU that multiply that effectively does the following:
>
> For x86 I made this: 
> https://github.com/cybershadow/ae/blob/master/utils/math/longmul.d
>
> There's also a BSL-licensed copy in DustMite, used for 
> polynomial hashing.
>
> BTW, not that any of us are students new to D, but I think such 
> questions would be better suitable for the D.learn group. E.g., 
> Ali often asks questions about how to achieve non-trivial goals 
> in D there.

That's a clever trick, but that only work on x86, but also will 
blind the optimizer as to what's going on.


More information about the Digitalmars-d mailing list