7 #include "cl_integer.h"
16 // Logische Operationen auf Integers:
17 // Methode: aus den Längen der beiden Argumente eine obere Schranke für
18 // die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und
19 // FN_maxlength), so daß das MSD für unendlich viele Bits steht.
20 // Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation
21 // mit einer einfachen Schleife durchführen.
23 const cl_I logior (const cl_I& x, const cl_I& y)
24 { if (fixnump(x) && fixnump(y)) // Beides Fixnums -> ganz einfach:
25 { // bitweise als Fixnum zurück
26 return cl_I_from_word(x.word | y.word);
30 var uintC n; // Anzahl der Digits
31 {var uintC nx = I_to_DS_need(x);
32 var uintC ny = I_to_DS_need(y);
33 n = (nx>=ny ? nx : ny);
35 {var uintD* xptr; I_to_DS_n(x,n,xptr=); // Pointer in DS zu x
36 var uintD* yptr; I_to_DS_n(y,n,yptr=); // Pointer in DS zu y
37 var uintD* zptr = xptr; // Pointer aufs Ergebnis
38 or_loop_msp(xptr,yptr,n); // mit OR verknüpfen
39 return DS_to_I(zptr,n); // Ergebnis als Integer