]> www.ginac.de Git - cln.git/blob - src/float/dfloat/misc/cl_DF_idecode.cc
Fix linking problems on some platforms caused by inline/non-inline versions
[cln.git] / src / float / dfloat / misc / cl_DF_idecode.cc
1 // integer_decode_float().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cln/dfloat.h"
8
9
10 // Implementation.
11
12 #include "cl_DF.h"
13 #include "cl_I.h"
14
15 namespace cln {
16
17 CL_INLINE const cl_idecoded_float CL_INLINE_DECL(integer_decode_float) (const cl_DF& x)
18 {
19         // x entpacken:
20         var cl_signean sign;
21         var sintL exp;
22 #if (cl_word_size==64)
23         var uint64 mant;
24         DF_decode(x, { return cl_idecoded_float(0, 0, 1); },
25                      sign=,exp=,mant=
26                  );
27         return cl_idecoded_float(
28                 Q_to_I(mant), // Mantisse (>0, <2^53) als Bignum
29                 L_to_FN(exp-(DF_mant_len+1)), // e-53 als Fixnum
30                 (sign>=0 ? cl_I(1) : cl_I(-1)) // (-1)^s erzeugen
31                );
32 #else
33         var uint32 manthi;
34         var uint32 mantlo;
35         DF_decode2(x, { return cl_idecoded_float(0, 0, 1); },
36                       sign=,exp=,manthi=,mantlo=
37                   );
38         return cl_idecoded_float(
39                 L2_to_I(manthi,mantlo), // Mantisse (>0, <2^53) als Bignum
40                 L_to_FN(exp-(DF_mant_len+1)), // e als Fixnum
41                 (sign>=0 ? cl_I(1) : cl_I(-1)) // (-1)^s erzeugen
42                );
43 #endif
44 }
45
46 }  // namespace cln