]> www.ginac.de Git - cln.git/blob - src/integer/misc/cl_I_oddp.cc
* include/cln/number.h (As): Fix it in namespace by suffixing `_As'
[cln.git] / src / integer / misc / cl_I_oddp.cc
1 // oddp().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cln/integer.h"
8
9
10 // Implementation.
11
12 #include "cl_I.h"
13 #include "cl_DS.h"
14
15 namespace cln {
16
17 cl_boolean oddp (const cl_I& x)
18 {
19         if (fixnump(x)) {
20                 // Fixnum: Bit 0 abprüfen
21                 if (x.word & bit(cl_value_shift))
22                         return cl_true;
23                 else
24                         return cl_false;
25         } else {
26                 // Bignum: Bit 0 im letzten Digit abprüfen
27                 if (lspref(BN_LSDptr(x),0) & bit(0))
28                         return cl_true;
29                 else
30                         return cl_false;
31         }
32 }
33
34 }  // namespace cln