Browse Source

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

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

1
include/cln/float.h

@ -556,7 +556,6 @@ extern const cl_F signum (const cl_F& x);
// Returns the largest (most positive) floating point number in float format f. // Returns the largest (most positive) floating point number in float format f.
extern const cl_F most_positive_float (float_format_t f); extern const cl_F most_positive_float (float_format_t f);
//CL_REQUIRE(cl_F_mostpos)
// Returns the smallest (most negative) floating point number in float format f. // Returns the smallest (most negative) floating point number in float format f.
extern const cl_F most_negative_float (float_format_t f); extern const cl_F most_negative_float (float_format_t f);

21
src/float/misc/cl_F_mostpos.cc

@ -3,8 +3,6 @@
// General includes. // General includes.
#include "cl_sysdep.h" #include "cl_sysdep.h"
CL_PROVIDE(cl_F_mostpos)
// Specification. // Specification.
#include "cln/float.h" #include "cln/float.h"
@ -19,6 +17,15 @@ CL_PROVIDE(cl_F_mostpos)
namespace cln { namespace cln {
static inline const cl_LF most_positive_LF (uintC len)
{
var Lfloat erg = allocate_lfloat(len,LF_exp_high,0);
fill_loop_up(&TheLfloat(erg)->data[0],len,~(uintD)0);
return erg;
}
const cl_F most_positive_float (float_format_t f)
{
// Exponent so groß wie möglich, Mantisse 1...1, Vorzeichen +. // Exponent so groß wie möglich, Mantisse 1...1, Vorzeichen +.
static const cl_SF most_positive_SF = static const cl_SF most_positive_SF =
@ -34,15 +41,6 @@ static const cl_DF most_positive_DF =
encode_DF(0,DF_exp_high-DF_exp_mid,bit(DF_mant_len-32+1)-1,bitm(32)-1); encode_DF(0,DF_exp_high-DF_exp_mid,bit(DF_mant_len-32+1)-1,bitm(32)-1);
#endif #endif
inline const cl_LF most_positive_LF (uintC len)
{
var Lfloat erg = allocate_lfloat(len,LF_exp_high,0);
fill_loop_up(&TheLfloat(erg)->data[0],len,~(uintD)0);
return erg;
}
const cl_F most_positive_float (float_format_t f)
{
floatformatcase((uintC)f floatformatcase((uintC)f
, return most_positive_SF; , return most_positive_SF;
, return most_positive_FF; , return most_positive_FF;
@ -53,4 +51,3 @@ const cl_F most_positive_float (float_format_t f)
} // namespace cln } // namespace cln
CL_PROVIDE_END(cl_F_mostpos)
Loading…
Cancel
Save