Changeset 960


Ignore:
Timestamp:
Jul 4, 2003, 4:40:47 AM (18 years ago)
Author:
orlov
Message:
  • Some simplification of implementation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/library/Compare/compare.cc

    r955 r960  
    1616
    1717RF_FUNC (Compare, (RF_ARG e_Exp1, e_Exp2), (RF_RES s_Res))
    18   if (Expr::compare(e_Exp1, e_Exp2) == 0) 
    19     s_Res = Char::create_expr("=");
    20   else
    21   if (Expr::compare(e_Exp1, e_Exp2) == -1) 
    22     s_Res = Char::create_expr("<");
    23   else
    24   if (Expr::compare(e_Exp1, e_Exp2) == 1) 
    25     s_Res = Char::create_expr(">");
    26 
    27 
     18  static const Expr res[] = {
     19    Char::create_expr("<"),
     20    Char::create_expr("="),
     21    Char::create_expr(">")
     22  };
     23  s_Res = res[Expr::compare(e_Exp1, e_Exp2) + 1];
    2824RF_END
    2925
Note: See TracChangeset for help on using the changeset viewer.