/[ascend]/trunk/base/generic/compiler/relation_util.c
ViewVC logotype

Diff of /trunk/base/generic/compiler/relation_util.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 117 by jds, Fri Dec 16 00:20:44 2005 UTC revision 118 by ben.allan, Mon Dec 19 04:16:27 2005 UTC
# Line 1979  unsigned long RelationDepth(CONST struct Line 1979  unsigned long RelationDepth(CONST struct
1979  static double FindMaxAdditiveTerm(struct relation_term *s)  static double FindMaxAdditiveTerm(struct relation_term *s)
1980  {  {
1981    enum safe_err serr;    enum safe_err serr;
1982      double lhs, rhs;
1983    
1984    switch (RelationTermType(s)) {    switch (RelationTermType(s)) {
1985    case e_plus:    case e_plus:
1986    case e_minus:    case e_minus:
1987      return MAX(fabs(FindMaxAdditiveTerm(TermBinLeft(s))),      /** note these used to be inlined with max, but a bug in gcc323 caused it to be split out. */
1988                 fabs(FindMaxAdditiveTerm(TermBinRight(s))));      lhs = FindMaxAdditiveTerm(TermBinLeft(s));
1989        rhs = FindMaxAdditiveTerm(TermBinRight(s));
1990        return MAX(fabs(lhs), fabs(rhs));
1991    case e_uminus:    case e_uminus:
1992      return (FindMaxAdditiveTerm(TermUniLeft(s)));      return (FindMaxAdditiveTerm(TermUniLeft(s)));
1993    case e_times:    case e_times:
# Line 2001  static double FindMaxAdditiveTerm(struct Line 2004  static double FindMaxAdditiveTerm(struct
2004    
2005  static double FindMaxFromTop(struct relation *s)  static double FindMaxFromTop(struct relation *s)
2006  {  {
2007      double lhs;
2008      double rhs;
2009    if (s == NULL) {    if (s == NULL) {
2010      return 0;      return 0;
2011    }    }
2012    return MAX(fabs(FindMaxAdditiveTerm(Infix_LhsSide(s))),    /** note these used to be inlined with max, but a bug in gcc323 caused it to be split out. */
2013               fabs(FindMaxAdditiveTerm(Infix_RhsSide(s))));    lhs = FindMaxAdditiveTerm(Infix_LhsSide(s));
2014      rhs = FindMaxAdditiveTerm(Infix_RhsSide(s));
2015      return MAX(fabs(lhs), fabs(rhs));
2016  }  }
2017    
2018  double CalcRelationNominal(struct Instance *i)     /* send in relation */  double CalcRelationNominal(struct Instance *i)     /* send in relation */

Legend:
Removed from v.117  
changed lines
  Added in v.118

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22