DivResult

Calculate x86 long division of a and b.

  1. struct DivResult(T)
    struct DivResult (
    T
    ) {}
  2. DivResult!T longDiv(L a, T b)

Members

Variables

quotient
T quotient;
remainder
T remainder;

Examples

assert(longDiv(LongInt!int(1, 0), 1) == DivResult!int(1, 0));
assert(longDiv(LongInt!int(5, 0), 2) == DivResult!int(2, 1));
assert(longDiv(LongInt!int(0, 1), 0x1_0000) == DivResult!int(0x1_0000, 0));

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

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

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

Meta