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