longMul

Calculate x86 long multiplication of a and b.

longMul
(
T
)
(
T a
,
T b
)
if (
is(T : long) &&
T.sizeof >= 2
)

Examples

assert(longMul(1, 1) == LongInt!int(1, 0));
assert(longMul(1, 2) == LongInt!int(2, 0));
assert(longMul(0x1_0000, 0x1_0000) == LongInt!int(0, 1));

assert(longMul(short(1), short(1)) == LongInt!short(1, 0));
assert(longMul(short(0x100), short(0x100)) == LongInt!short(0, 1));

assert(longMul(short(1), short(-1)) == LongInt!short(cast(ushort)-1, -1));
assert(longMul(ushort(1), cast(ushort)-1) == LongInt!ushort(cast(ushort)-1, 0));

version(X86_64)
{
	assert(longMul(1L, 1L) == LongInt!long(1, 0));
	assert(longMul(0x1_0000_0000L, 0x1_0000_0000L) == LongInt!long(0, 1));
}

Meta