File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -2960,6 +2960,29 @@ class shl_exprt:public shift_exprt
29602960 }
29612961};
29622962
2963+ // / \brief Cast an exprt to a \ref shl_exprt
2964+ // /
2965+ // / \a expr must be known to be \ref shl_exprt.
2966+ // /
2967+ // / \param expr: Source expression
2968+ // / \return Object of type \ref shl_exprt
2969+ inline const shl_exprt &to_shl_expr (const exprt &expr)
2970+ {
2971+ PRECONDITION (expr.id () == ID_shl);
2972+ DATA_INVARIANT (
2973+ expr.operands ().size () == 2 , " Bit-wise shl must have two operands" );
2974+ return static_cast <const shl_exprt &>(expr);
2975+ }
2976+
2977+ // / \copydoc to_shl_expr(const exprt &)
2978+ inline shl_exprt &to_shl_expr (exprt &expr)
2979+ {
2980+ PRECONDITION (expr.id () == ID_shl);
2981+ DATA_INVARIANT (
2982+ expr.operands ().size () == 2 , " Bit-wise shl must have two operands" );
2983+ return static_cast <shl_exprt &>(expr);
2984+ }
2985+
29632986// / \brief Arithmetic right shift
29642987class ashr_exprt :public shift_exprt
29652988{
You can’t perform that action at this time.
0 commit comments