static void TestMulDiv(ulong m, ulong n)
{
BitField a, b;
a = BitField.Create(31, 0, m);
b = BitField.Create(31, 0, n);
BitField p = SampleLogic.MulDiv(a, b, true);
BitField q = SampleLogic.MulDiv(a, b, false);
ulong tmp1 = p.Value;
ulong tmp2 = unchecked((ulong)((long)(int)a.Value * (long)(int)b.Value));
Console.Write("{0:x8}×{1:x8} = ", (int)a.Value, (int)b.Value);
Console.Write("{0:x16} ({1:x16})", tmp1, tmp2);
if(tmp1 != tmp2)
{
Console.Write(" ** ");
Console.ReadLine();
}
Console.Write("\n");
uint tmp3 = (uint)q[31, 0].Value;
uint tmp4 = unchecked((uint)((long)(int)a.Value / (long)(int)b.Value));
Console.Write("{0:x8}÷{1:x8} = ", (int)a.Value, (int)b.Value);
Console.Write("{0:x8} ({1:x8})", tmp3, tmp4);
if(tmp3 != tmp4)
{
Console.Write(" ** ");
Console.ReadLine();
}
Console.Write("\n");
}