]> www.ginac.de Git - cln.git/commitdiff
Get rid CL_REQUIRE/CL_PROVIDE(cl_F_leastneg), it is not really necessary.
authorAlexei Sheplyakov <varg@theor.jinr.ru>
Thu, 21 Aug 2008 12:06:02 +0000 (16:06 +0400)
committerAlexei Sheplyakov <varg@theor.jinr.ru>
Wed, 27 Aug 2008 04:41:07 +0000 (08:41 +0400)
Move static variables least_negative_[SFDL]F into least_negative_LF() function
(which is the only user of those variables) in order to avoid possible static
order initialization problems. While at it, make least_negative_LF() function
static.

include/cln/float.h
src/float/misc/cl_F_leastneg.cc

index 6a0fff5d47a84afac1270d69d1f3218e2ad284ba..5a06ff8f2f8e1eb6c32f909040cbe6a42ae7d3b0 100644 (file)
@@ -567,7 +567,6 @@ extern const cl_F least_positive_float (float_format_t f);
 // Returns the least negative floating point number (i.e. < 0 but closest to 0)
 // in float format f.
 extern const cl_F least_negative_float (float_format_t f);
-//CL_REQUIRE(cl_F_leastneg)
 
 // Returns the smallest floating point number e > 0 such that 1+e != 1.
 extern const cl_F float_epsilon (float_format_t f);
index 918db47305b24b18d233e69ae01edc142769ee5b..bcdf0a8b45717966b551d69a65d9102b679f72c6 100644 (file)
@@ -3,8 +3,6 @@
 // General includes.
 #include "cl_sysdep.h"
 
-CL_PROVIDE(cl_F_leastneg)
-
 // Specification.
 #include "cln/float.h"
 
@@ -19,22 +17,7 @@ CL_PROVIDE(cl_F_leastneg)
 
 namespace cln {
 
-// Exponent so klein wie möglich, Mantisse 10...0, Vorzeichen -.
-
-static const cl_SF least_negative_SF =
-       make_SF(-1,SF_exp_low,bit(SF_mant_len));
-
-static const cl_FF least_negative_FF =
-       encode_FF(-1,FF_exp_low-FF_exp_mid,bit(FF_mant_len));
-
-static const cl_DF least_negative_DF =
-       #if (cl_word_size==64)
-         encode_DF(-1,DF_exp_low-DF_exp_mid,bit(DF_mant_len));
-       #else
-         encode_DF(-1,DF_exp_low-DF_exp_mid,bit(DF_mant_len-32),0);
-       #endif
-
-inline const cl_LF least_negative_LF (uintC len)
+static inline const cl_LF least_negative_LF (uintC len)
 {
        var Lfloat erg = allocate_lfloat(len,LF_exp_low,-1);
        #if CL_DS_BIG_ENDIAN_P
@@ -49,6 +32,21 @@ inline const cl_LF least_negative_LF (uintC len)
 
 const cl_F least_negative_float (float_format_t f)
 {
+       // Exponent so klein wie möglich, Mantisse 10...0, Vorzeichen -.
+
+       static const cl_SF least_negative_SF =
+               make_SF(-1,SF_exp_low,bit(SF_mant_len));
+
+       static const cl_FF least_negative_FF =
+               encode_FF(-1,FF_exp_low-FF_exp_mid,bit(FF_mant_len));
+
+       static const cl_DF least_negative_DF =
+       #if (cl_word_size==64)
+               encode_DF(-1,DF_exp_low-DF_exp_mid,bit(DF_mant_len));
+       #else
+               encode_DF(-1,DF_exp_low-DF_exp_mid,bit(DF_mant_len-32),0);
+       #endif
+
        floatformatcase((uintC)f
        ,       return least_negative_SF;
        ,       return least_negative_FF;
@@ -59,4 +57,3 @@ const cl_F least_negative_float (float_format_t f)
 
 }  // namespace cln
 
-CL_PROVIDE_END(cl_F_leastneg)