eval_as_long takes in const NetExpr arguments.

It is not the same as eval_tree, in particular it doesn't
rewrite the expression tree. So the NetExpr argument can
be constant.
This commit is contained in:
Stephen Williams 2013-08-31 18:48:32 -07:00
parent 9b3987bf3c
commit 64b2345cf2
2 changed files with 4 additions and 4 deletions

View File

@ -873,14 +873,14 @@ void eval_expr(NetExpr*&expr, int context_width)
}
}
bool eval_as_long(long&value, NetExpr*expr)
bool eval_as_long(long&value, const NetExpr*expr)
{
if (NetEConst*tmp = dynamic_cast<NetEConst*>(expr) ) {
if (const NetEConst*tmp = dynamic_cast<const NetEConst*>(expr) ) {
value = tmp->value().as_long();
return true;
}
if (NetECReal*rtmp = dynamic_cast<NetECReal*>(expr)) {
if (const NetECReal*rtmp = dynamic_cast<const NetECReal*>(expr)) {
value = rtmp->value().as_long();
return true;
}

View File

@ -273,7 +273,7 @@ void eval_expr(NetExpr*&expr, int context_width =-1);
* possible. If it is not possible (the expression is not evaluated
* down to a constant) then return false and leave value unchanged.
*/
bool eval_as_long(long&value, NetExpr*expr);
bool eval_as_long(long&value, const NetExpr*expr);
bool eval_as_double(double&value, NetExpr*expr);
/*