OK, hab was gefunden... haut zwar nicht hin mit X * MulInv(X)=1, aber immerhin ein Anfang.
Delphi-Quellcode:
//written by Dave Barton (davebarton@bigfoot.com)
function MulInv(x: word): word;
var
t0, t1, q, y: word;
begin
if x<= 1 then
begin
Result:= x;
Exit;
end;
t1:= DWord($10001) div x;
y:= DWord($10001) mod x;
if y= 1 then
begin
Result:= (1 - t1) and $FFFF;
Exit;
end;
t0:= 1;
repeat
q:= x div y;
x:= x mod y;
t0:= t0 + (q*t1);
if x= 1 then
begin
Result:= t0;
Exit;
end;
q:= y div x;
y:= y mod x;
t1:= t1 + (q*t0);
until y= 1;
Result:= (1-t1) and $FFFF;
end;