PROCEDURE [code] ModMult (a, b, m : INTEGER) : INTEGER
066H, 059H, (* pop ecx ; m -> ecx *)
066H, 05AH, (* pop edx ; b -> edx *)
066H, 0F7H, 0E2H, (* mul edx ; edx:eax = eax * edx = a * b *)
066H, 0F7H, 0F1H, (* div ecx ; eax = edx:eax/ecx = (a*b)/m, edx =
edx:eax%ecx = (a*b)%m *)
066H, 08BH, 0C2H;(* mov eax,edx ; RETURN in aex = (a*b)%m *)
> -----Original Message-----
> From: robert.d.campbell{([at]})nowhere.xy> [mailto:robert.d.campbell{([at]})nowhere.xy> Sent: Tuesday, June 27, 2000 12:22 PM
> To: blackbox{([at]})nowhere.xy> Subject: Windows in-line CODE procedure.
>
>
>
>
> I have a series of algorithms that depend heavily on the
> following formula
>
> VAR
> a, b, m, x : INTEGER;
> BEGIN
> ...
> x := a * b MOD m;
>
>
> For my applications a and b are non-negative, ie in the range
> [0 ... 2^31 - 1].
> and m is positive, ie in the range [1 ... 2^31 - 1].
>
> The code as written is incorrect as a * b can cause INTEGER overflow.
>
--------------------------------------------
To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
blackbox-request{([at]})nowhere.xy
To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.
Send any problem reports or questions related to this email list to the list owner at
owner-blackbox{([at]})nowhere.xy
Received on Tue Jun 27 2000 - 09:00:03 UTC