[druntime] core.int128: Add 64-bit mul() overload and optimize via inline asm on x86_64

This commit is contained in:
Martin Kinkelin 2025-03-25 03:15:39 +01:00 committed by Nicholas Wilson
parent 6c160b78d5
commit b390c7ec13
2 changed files with 69 additions and 6 deletions

View file

@ -0,0 +1,14 @@
`core.int128`: Add `mul` and `udivmod` overloads for 64-bit operands
These map to a single x86_64 instruction and have accordingly been optimized via inline assembly.
---
import core.int128;
ulong a, b;
Cent product128 = mul(a, b);
ulong divisor64 = …;
ulong modulus64;
ulong quotient64 = udivmod(product128, divisor64, modulus64);
---