Browse Source

Get rid CL_REQUIRE/CL_PROVIDE(cl_F_leastpos), it is not really necessary.

Move static variables least_positive_[SFDL]F into least_positive_LF() function
(which is the only user of those variables) in order to avoid possible static
order initialization problems. While at it, make least_positive_LF() function
static.
master
Alexei Sheplyakov 16 years ago
parent
commit
d1f1de0458
  1. 1
      include/cln/float.h
  2. 33
      src/float/misc/cl_F_leastpos.cc

1
include/cln/float.h

@ -563,7 +563,6 @@ extern const cl_F most_negative_float (float_format_t f);
// Returns the least positive floating point number (i.e. > 0 but closest to 0) // Returns the least positive floating point number (i.e. > 0 but closest to 0)
// in float format f. // in float format f.
extern const cl_F least_positive_float (float_format_t f); extern const cl_F least_positive_float (float_format_t f);
//CL_REQUIRE(cl_F_leastpos)
// Returns the least negative floating point number (i.e. < 0 but closest to 0) // Returns the least negative floating point number (i.e. < 0 but closest to 0)
// in float format f. // in float format f.

33
src/float/misc/cl_F_leastpos.cc

@ -3,8 +3,6 @@
// General includes. // General includes.
#include "cl_sysdep.h" #include "cl_sysdep.h"
CL_PROVIDE(cl_F_leastpos)
// Specification. // Specification.
#include "cln/float.h" #include "cln/float.h"
@ -19,6 +17,21 @@ CL_PROVIDE(cl_F_leastpos)
namespace cln { namespace cln {
static inline const cl_LF least_positive_LF (uintC len)
{
var Lfloat erg = allocate_lfloat(len,LF_exp_low,0);
#if CL_DS_BIG_ENDIAN_P
TheLfloat(erg)->data[0] = bit(intDsize-1);
clear_loop_up(&TheLfloat(erg)->data[1],len-1);
#else
var uintD* ptr = clear_loop_up(&TheLfloat(erg)->data[0],len-1);
*ptr = bit(intDsize-1);
#endif
return erg;
}
const cl_F least_positive_float (float_format_t f)
{
// Exponent so klein wie möglich, Mantisse 10...0, Vorzeichen +. // Exponent so klein wie möglich, Mantisse 10...0, Vorzeichen +.
static const cl_SF least_positive_SF = static const cl_SF least_positive_SF =
@ -34,21 +47,6 @@ static const cl_DF least_positive_DF =
encode_DF(0,DF_exp_low-DF_exp_mid,bit(DF_mant_len-32),0); encode_DF(0,DF_exp_low-DF_exp_mid,bit(DF_mant_len-32),0);
#endif #endif
inline const cl_LF least_positive_LF (uintC len)
{
var Lfloat erg = allocate_lfloat(len,LF_exp_low,0);
#if CL_DS_BIG_ENDIAN_P
TheLfloat(erg)->data[0] = bit(intDsize-1);
clear_loop_up(&TheLfloat(erg)->data[1],len-1);
#else
var uintD* ptr = clear_loop_up(&TheLfloat(erg)->data[0],len-1);
*ptr = bit(intDsize-1);
#endif
return erg;
}
const cl_F least_positive_float (float_format_t f)
{
floatformatcase((uintC)f floatformatcase((uintC)f
, return least_positive_SF; , return least_positive_SF;
, return least_positive_FF; , return least_positive_FF;
@ -59,4 +57,3 @@ const cl_F least_positive_float (float_format_t f)
} // namespace cln } // namespace cln
CL_PROVIDE_END(cl_F_leastpos)
Loading…
Cancel
Save