]> www.ginac.de Git - cln.git/commitdiff
Get rid CL_REQUIRE/CL_PROVIDE(cl_F_mostneg), 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 most_negative_[SFDL]F into most_negative_LF() function
(which is the only user of those variables) in order to avoid possible static
order initialization problems. While at it, make most_negative_LF() function
static.

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

index 6a3f9bf7003acc4e0296edbf0e086f4094d30be6..ada8a29402092292727df7df334053a97f4cdd57 100644 (file)
@@ -559,7 +559,6 @@ extern const cl_F most_positive_float (float_format_t f);
 
 // Returns the smallest (most negative) floating point number in float format f.
 extern const cl_F most_negative_float (float_format_t f);
-//CL_REQUIRE(cl_F_mostneg)
 
 // Returns the least positive floating point number (i.e. > 0 but closest to 0)
 // in float format f.
index 1008f8347074fe43b7fabd19da8a5a989606ce8d..c393fa66a5ad88d200577b398bcd4cf5338c255e 100644 (file)
@@ -3,8 +3,6 @@
 // General includes.
 #include "cl_sysdep.h"
 
-CL_PROVIDE(cl_F_mostneg)
-
 // Specification.
 #include "cln/float.h"
 
@@ -19,22 +17,7 @@ CL_PROVIDE(cl_F_mostneg)
 
 namespace cln {
 
-// Exponent so groß wie möglich, Mantisse 1...1, Vorzeichen -.
-
-static const cl_SF most_negative_SF =
-       make_SF(-1,SF_exp_high,bit(SF_mant_len+1)-1);
-
-static const cl_FF most_negative_FF =
-       encode_FF(-1,FF_exp_high-FF_exp_mid,bit(FF_mant_len+1)-1);
-
-static const cl_DF most_negative_DF =
-#if (cl_word_size==64)
-       encode_DF(-1,DF_exp_high-DF_exp_mid,bit(DF_mant_len+1)-1);
-#else
-       encode_DF(-1,DF_exp_high-DF_exp_mid,bit(DF_mant_len-32+1)-1,bitm(32)-1);
-#endif
-
-inline const cl_LF most_negative_LF (uintC len)
+static inline const cl_LF most_negative_LF (uintC len)
 {
        var Lfloat erg = allocate_lfloat(len,LF_exp_high,-1);
        fill_loop_up(&TheLfloat(erg)->data[0],len,~(uintD)0);
@@ -43,6 +26,21 @@ inline const cl_LF most_negative_LF (uintC len)
 
 const cl_F most_negative_float (float_format_t f)
 {
+       // Exponent so groß wie möglich, Mantisse 1...1, Vorzeichen -.
+
+       static const cl_SF most_negative_SF =
+               make_SF(-1,SF_exp_high,bit(SF_mant_len+1)-1);
+
+       static const cl_FF most_negative_FF =
+               encode_FF(-1,FF_exp_high-FF_exp_mid,bit(FF_mant_len+1)-1);
+
+       static const cl_DF most_negative_DF =
+#if (cl_word_size==64)
+               encode_DF(-1,DF_exp_high-DF_exp_mid,bit(DF_mant_len+1)-1);
+#else
+               encode_DF(-1,DF_exp_high-DF_exp_mid,bit(DF_mant_len-32+1)-1,bitm(32)-1);
+#endif
+
        floatformatcase((uintC)f
        ,       return most_negative_SF;
        ,       return most_negative_FF;
@@ -53,4 +51,3 @@ const cl_F most_negative_float (float_format_t f)
 
 }  // namespace cln
 
-CL_PROVIDE_END(cl_F_mostneg)