12 uintD div2adic (uintD a, uintD b)
15 // Konstruiere c Bit für Bit.
17 // Für j=0,...,intDsize:
18 // [Hier b*c == a mod 2^j und d = (a-b*c)/2^j.] j=intDsize -> fertig.
19 // Falls d ungerade, setze c:=c+2^j und d:=(d-b)/2, sonst d:=d/2.
21 ASSERT(!((b % 2) ==0))
24 var uintD bit_j = 1; // 2^j
25 loop // Verwende a als Variable d
26 { if (a & bit(0)) { c = c+bit_j; a = a-b; }
29 if (bit_j == 0) break; // j=intDsize -> fertig
34 {var uintD bit_j = 1; // 2^j
35 var uintD b_j = b-1; // (b-1)*2^j
36 loop // Verwende a als Variable d*2^j+c
37 { if (a & bit_j) { a = a - b_j; }
38 b_j = b_j << 1; bit_j = bit_j << 1;
39 if (bit_j == 0) break; // j=intDsize -> fertig