PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/cln-1.3.2/src/float/ffloat/elem/cl_FF_globals.cc

#
C++ | 43 lines | 24 code | 14 blank | 5 comment | 4 complexity | 3468886d4420938b5a8643d7ec548ad1 MD5 | raw file
Possible License(s): GPL-2.0
  1. // Global variables for cl_FF.
  2. // General includes.
  3. #include "base/cl_sysdep.h"
  4. // Specification.
  5. #include "cln/ffloat_class.h"
  6. #include "float/ffloat/cl_FF.h"
  7. // Implementation.
  8. namespace cln {
  9. #if !defined(CL_WIDE_POINTERS)
  10. const cl_FF cl_FF_0 = cl_FF_0; // 0.0f0
  11. const cl_FF cl_FF_1 = cl_FF_1; // 1.0f0
  12. const cl_FF cl_FF_minus1 = cl_FF_minus1; // -1.0f0
  13. int cl_FF_globals_init_helper::count = 0;
  14. cl_FF_globals_init_helper::cl_FF_globals_init_helper()
  15. {
  16. if (count++ == 0) {
  17. new ((void *)&cl_FF_0) cl_FF(allocate_ffloat(0)); // 0.0f0
  18. new ((void *)&cl_FF_1) cl_FF(encode_FF(0,1,bit(FF_mant_len))); // 1.0f0
  19. new ((void *)&cl_FF_minus1) cl_FF(encode_FF(-1,1,bit(FF_mant_len))); // -1.0f0
  20. }
  21. }
  22. cl_FF_globals_init_helper::~cl_FF_globals_init_helper()
  23. {
  24. if (--count == 0) {
  25. // Nothing to clean up
  26. }
  27. }
  28. #endif
  29. } // namespace cln