From a11153d9351a0d57a0fe3fe3f675de5f5b7d9e27 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Mon, 2 Apr 2007 06:15:31 +0000 Subject: [PATCH] * Fix compilation issues with prereleases of GCC 4.3, at least in theory. See . --- ginac/add.cpp | 5 +++-- ginac/function.pl | 3 ++- ginac/indexed.cpp | 3 ++- ginac/integral.cpp | 2 +- ginac/pseries.cpp | 13 +++++++------ ginac/symmetry.cpp | 7 ++++--- ginac/symmetry.h | 2 +- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/ginac/add.cpp b/ginac/add.cpp index c2db2291..067f9bf7 100644 --- a/ginac/add.cpp +++ b/ginac/add.cpp @@ -22,6 +22,7 @@ #include #include +#include #include "add.h" #include "mul.h" @@ -256,7 +257,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; @@ -273,7 +274,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 13abceb2..d5c6245d 100755 --- a/ginac/function.pl +++ b/ginac/function.pl @@ -508,6 +508,7 @@ $implementation=< #include #include +#include #include "function.h" #include "operators.h" @@ -871,7 +872,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 618efbce..0b668cd7 100644 --- a/ginac/indexed.cpp +++ b/ginac/indexed.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "indexed.h" #include "idx.h" @@ -305,7 +306,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 f4cf75d0..695fec80 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 b63d4640..d239777a 100644 --- a/ginac/pseries.cpp +++ b/ginac/pseries.cpp @@ -23,6 +23,7 @@ #include #include +#include #include "pseries.h" #include "add.h" @@ -287,7 +288,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) @@ -315,7 +316,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) @@ -653,7 +654,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) { @@ -786,8 +787,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))) @@ -808,7 +809,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 4044ee26..f1cc67cb 100644 --- a/ginac/symmetry.cpp +++ b/ginac/symmetry.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "symmetry.h" #include "lst.h" @@ -361,7 +362,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; @@ -372,7 +373,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; } @@ -399,7 +400,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 46bdae28..b97abf80 100644 --- a/ginac/symmetry.h +++ b/ginac/symmetry.h @@ -136,7 +136,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). */ -- 2.49.0