]> www.ginac.de Git - cln.git/blob - src/float/sfloat/misc/cl_SF_idecode.cc
Fix linking problems on some platforms caused by inline/non-inline versions
[cln.git] / src / float / sfloat / misc / cl_SF_idecode.cc
1 // integer_decode_float().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cln/sfloat.h"
8
9
10 // Implementation.
11
12 #include "cl_SF.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_SF& x)
18 {
19         // x entpacken:
20         var cl_signean sign;
21         var sintL exp;
22         var uint32 mant;
23         SF_decode(x, { return cl_idecoded_float(0, 0, 1); },
24                      sign=,exp=,mant=
25                  );
26         return cl_idecoded_float(
27                 L_to_FN(mant), // Mantisse als Fixnum (>0, <2^17)
28                 L_to_FN(exp-(SF_mant_len+1)), // e-17 als Fixnum
29                 (sign>=0 ? cl_I(1) : cl_I(-1)) // (-1)^s erzeugen
30                );
31 }
32
33 }  // namespace cln