Skip to content

Commit

Permalink
Special case for unary - of real literal.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed Jun 4, 2004
1 parent fbfc796 commit dd69872
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion elab_expr.cc
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_expr.cc,v 1.86 2004/05/31 23:34:36 steve Exp $"
#ident "$Id: elab_expr.cc,v 1.87 2004/06/04 23:34:15 steve Exp $"
#endif

# include "config.h"
Expand Down Expand Up @@ -886,6 +886,16 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, bool) const
val.has_sign(true);
tmp = new NetEConst(val);
delete ip;

} else if (NetECReal*ipc = dynamic_cast<NetECReal*>(ip)) {

/* When taking the - of a real, fold this into the
constant value. */
verireal val = - ipc->value();
tmp = new NetECReal(val);
tmp->set_line( *ip );
delete ip;

} else {
tmp = new NetEUnary(op_, ip);
tmp->set_line(*this);
Expand Down Expand Up @@ -955,6 +965,9 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, bool) const

/*
* $Log: elab_expr.cc,v $
* Revision 1.87 2004/06/04 23:34:15 steve
* Special case for unary - of real literal.
*
* Revision 1.86 2004/05/31 23:34:36 steve
* Rewire/generalize parsing an elaboration of
* function return values to allow for better
Expand Down

0 comments on commit dd69872

Please sign in to comment.