]> www.ginac.de Git - cln.git/blob - src/integer/bitwise/cl_I_log.h
Initial revision
[cln.git] / src / integer / bitwise / cl_I_log.h
1 // cl_I internals for logical operations
2
3 #ifndef _CL_I_LOG_H
4 #define _CL_I_LOG_H
5
6 #include "cl_number.h"
7 #include "cl_I.h"
8 #include "cl_DS.h"
9
10 // Liefert die Anzahl Digits, die ein Integer als DS bräuchte.
11 // (Leicht aufgerundet.)
12 inline uintC I_to_DS_need (const cl_I& x)
13 {
14         if (fixnump(x))
15                 return FN_maxlength; // das wird reichen
16         else
17                 return TheBignum(x)->length;
18 }
19
20 // Integer to Digit sequence, n Digits
21 // I_to_DS_n(obj,n,ptr=);
22 // Integer obj zu einer Digit sequence MSDptr/n/LSDptr machen,
23 // die genau n Digits hat (sollte n >= Bedarf und >= FN_maxlength sein).
24 // Die neue Digit-sequence darf modifiziert werden.
25 // < ptr: MSDptr der neuen DS
26 // Dabei wird num_stack erniedrigt.
27   #define I_to_DS_n(obj,n,ptr_zuweisung)  \
28     {var uintD* destptr;                                                \
29      num_stack_alloc(n,,destptr=);                                      \
30      ptr_zuweisung I_to_DS_n_aux(obj,n,destptr);                        \
31     }
32   extern uintD* I_to_DS_n_aux (const cl_I& obj, uintC n, uintD* destptr);
33
34 #endif /* _CL_I_LOG_H */