PageRenderTime 39ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/cln-1.3.2/src/float/conv/cl_FF_to_DF.cc

#
C++ | 32 lines | 18 code | 8 blank | 6 comment | 0 complexity | 4181e8f266b34a354bea1267ebbb672f MD5 | raw file
Possible License(s): GPL-2.0
  1. // cl_FF_to_DF().
  2. // General includes.
  3. #include "base/cl_sysdep.h"
  4. // Specification.
  5. #include "float/cl_F.h"
  6. // Implementation.
  7. #include "float/ffloat/cl_FF.h"
  8. #include "float/dfloat/cl_DF.h"
  9. namespace cln {
  10. const cl_DF cl_FF_to_DF (const cl_FF& x)
  11. {
  12. // x entpacken:
  13. var cl_signean sign;
  14. var sintL exp;
  15. var uint32 mant;
  16. FF_decode(x, { return cl_DF_0; }, sign=,exp=,mant=);
  17. // Mantisse um 52-23=29 Nullbits erweitern:
  18. #if (cl_word_size==64)
  19. return encode_DF(sign,exp,(uint64)mant<<(DF_mant_len-FF_mant_len));
  20. #else
  21. return encode_DF(sign,exp,mant>>(32-(DF_mant_len-FF_mant_len)),mant<<(DF_mant_len-FF_mant_len));
  22. #endif
  23. }
  24. } // namespace cln