From: Richard Kreckel Date: Mon, 2 Apr 2007 06:16:16 +0000 (+0000) Subject: * Fix compilation issues with prereleases of GCC 4.3, at least in theory. X-Git-Tag: release_1-4-0~23 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=701f2c9acbf58e84d2c8619f00d8b7718fb1eafd * Fix compilation issues with prereleases of GCC 4.3, at least in theory. See . --- diff --git a/ginac/add.cpp b/ginac/add.cpp index 353b4a77..b37ab79d 100644 --- a/ginac/add.cpp +++ b/ginac/add.cpp @@ -22,6 +22,7 @@ #include #include +#include #include "add.h" #include "mul.h" @@ -258,7 +259,7 @@ bool add::info(unsigned inf) const int add::degree(const ex & s) const { - int deg = INT_MIN; + int deg = std::numeric_limits::min(); if (!overall_coeff.is_zero()) deg = 0; @@ -275,7 +276,7 @@ int add::degree(const ex & s) const int add::ldegree(const ex & s) const { - int deg = INT_MAX; + int deg = std::numeric_limits::max(); if (!overall_coeff.is_zero()) deg = 0; diff --git a/ginac/function.pl b/ginac/function.pl index 4f8e3537..da8953c3 100755 --- a/ginac/function.pl +++ b/ginac/function.pl @@ -593,6 +593,7 @@ $implementation=< #include #include +#include #include "function.h" #include "operators.h" @@ -983,7 +984,7 @@ ex function::eval(int level) const exvector v = seq; GINAC_ASSERT(is_a(opt.symtree)); int sig = canonicalize(v.begin(), ex_to(opt.symtree)); - if (sig != INT_MAX) { + if (sig != std::numeric_limits::max()) { // Something has changed while sorting arguments, more evaluations later if (sig == 0) return _ex0; diff --git a/ginac/indexed.cpp b/ginac/indexed.cpp index f7172efc..b3c18ba5 100644 --- a/ginac/indexed.cpp +++ b/ginac/indexed.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "indexed.h" #include "idx.h" @@ -306,7 +307,7 @@ ex indexed::eval(int level) const exvector v = seq; GINAC_ASSERT(is_exactly_a(symtree)); int sig = canonicalize(v.begin() + 1, ex_to(symtree)); - if (sig != INT_MAX) { + if (sig != std::numeric_limits::max()) { // Something has changed while sorting indices, more evaluations later if (sig == 0) return _ex0; diff --git a/ginac/integral.cpp b/ginac/integral.cpp index f9d42a99..57f3532b 100644 --- a/ginac/integral.cpp +++ b/ginac/integral.cpp @@ -223,7 +223,7 @@ struct error_and_integral struct error_and_integral_is_less { - bool operator()(const error_and_integral &e1,const error_and_integral &e2) + bool operator()(const error_and_integral &e1,const error_and_integral &e2) const { int c = e1.integral.compare(e2.integral); if(c < 0) diff --git a/ginac/pseries.cpp b/ginac/pseries.cpp index 1e61e0ae..ec8e8c65 100644 --- a/ginac/pseries.cpp +++ b/ginac/pseries.cpp @@ -23,6 +23,7 @@ #include #include +#include #include "pseries.h" #include "add.h" @@ -292,7 +293,7 @@ int pseries::degree(const ex &s) const epvector::const_iterator it = seq.begin(), itend = seq.end(); if (it == itend) return 0; - int max_pow = INT_MIN; + int max_pow = std::numeric_limits::min(); while (it != itend) { int pow = it->rest.degree(s); if (pow > max_pow) @@ -320,7 +321,7 @@ int pseries::ldegree(const ex &s) const epvector::const_iterator it = seq.begin(), itend = seq.end(); if (it == itend) return 0; - int min_pow = INT_MAX; + int min_pow = std::numeric_limits::max(); while (it != itend) { int pow = it->rest.ldegree(s); if (pow < min_pow) @@ -718,7 +719,7 @@ ex pseries::add_series(const pseries &other) const epvector::const_iterator b = other.seq.begin(); epvector::const_iterator a_end = seq.end(); epvector::const_iterator b_end = other.seq.end(); - int pow_a = INT_MAX, pow_b = INT_MAX; + int pow_a = std::numeric_limits::max(), pow_b = std::numeric_limits::max(); for (;;) { // If a is empty, fill up with elements from b and stop if (a == a_end) { @@ -851,8 +852,8 @@ ex pseries::mul_series(const pseries &other) const int cdeg_min = a_min + b_min; int cdeg_max = a_max + b_max; - int higher_order_a = INT_MAX; - int higher_order_b = INT_MAX; + int higher_order_a = std::numeric_limits::max(); + int higher_order_b = std::numeric_limits::max(); if (is_order_function(coeff(var, a_max))) higher_order_a = a_max + b_min; if (is_order_function(other.coeff(var, b_max))) @@ -873,7 +874,7 @@ ex pseries::mul_series(const pseries &other) const if (!co.is_zero()) new_seq.push_back(expair(co, numeric(cdeg))); } - if (higher_order_c < INT_MAX) + if (higher_order_c < std::numeric_limits::max()) new_seq.push_back(expair(Order(_ex1), numeric(higher_order_c))); return pseries(relational(var, point), new_seq); } diff --git a/ginac/symmetry.cpp b/ginac/symmetry.cpp index 123346bf..6ab0944d 100644 --- a/ginac/symmetry.cpp +++ b/ginac/symmetry.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "symmetry.h" #include "lst.h" @@ -431,7 +432,7 @@ int canonicalize(exvector::iterator v, const symmetry &symm) { // Less than two elements? Then do nothing if (symm.indices.size() < 2) - return INT_MAX; + return std::numeric_limits::max(); // Canonicalize children first bool something_changed = false; @@ -442,7 +443,7 @@ int canonicalize(exvector::iterator v, const symmetry &symm) int child_sign = canonicalize(v, ex_to(*first)); if (child_sign == 0) return 0; - if (child_sign != INT_MAX) { + if (child_sign != std::numeric_limits::max()) { something_changed = true; sign *= child_sign; } @@ -469,7 +470,7 @@ int canonicalize(exvector::iterator v, const symmetry &symm) default: break; } - return something_changed ? sign : INT_MAX; + return something_changed ? sign : std::numeric_limits::max(); } diff --git a/ginac/symmetry.h b/ginac/symmetry.h index bb6af2df..9282b75e 100644 --- a/ginac/symmetry.h +++ b/ginac/symmetry.h @@ -139,7 +139,7 @@ const symmetry & antisymmetric4(); * @param v Start of expression vector * @param symm Root node of symmetry tree * @return the overall sign introduced by the reordering (+1, -1 or 0) - * or INT_MAX if nothing changed */ + * or numeric_limits::max() if nothing changed */ extern int canonicalize(exvector::iterator v, const symmetry &symm); /** Symmetrize expression over a set of objects (symbols, indices). */