using System;
public class Program
{
public struct ULARGE_INTEGER
public UInt32 loPart;
public UInt32 hiPart;
}
public static void Main()
ULARGE_INTEGER a;
a.hiPart = 0x80123456;
a.loPart = 0x789ABCDE;
UInt32 m = 585741;
//Calculate 0x80123456789ABCDE % 585741
UInt32 r = Program.Mod64(a, m);
Console.WriteLine("0x{0:x8}{1:x8} mod {2} = {3}",
a.hiPart, a.loPart, m, r);
public static UInt32 Mod64(ULARGE_INTEGER a, UInt32 m)
/*
Calculates
r = a mod m
a.hiPart: High 32-bits of UInt32 a
a.loPart: Low 32-bits of UInt32 a
m: modulus
In other words:
r = Ah||Al mod m
*/
//TODO: Ask Stackoverflow
return 7;