@@ -2374,6 +2374,60 @@ template<> inline bool can_cast_expr<or_exprt>(const exprt &base)
2374
2374
// }
2375
2375
2376
2376
2377
+ /* ! \brief Boolean XOR
2378
+ */
2379
+ class xor_exprt :public multi_ary_exprt
2380
+ {
2381
+ public:
2382
+ xor_exprt ():multi_ary_exprt(ID_bitxor, bool_typet())
2383
+ {
2384
+ }
2385
+
2386
+ xor_exprt (const exprt &_op0, const exprt &_op1):
2387
+ multi_ary_exprt (_op0, ID_xor, _op1, bool_typet())
2388
+ {
2389
+ }
2390
+ };
2391
+
2392
+ /* ! \brief Cast a generic exprt to a \ref xor_exprt
2393
+ *
2394
+ * This is an unchecked conversion. \a expr must be known to be \ref
2395
+ * xor_exprt.
2396
+ *
2397
+ * \param expr Source expression
2398
+ * \return Object of type \ref xor_exprt
2399
+ *
2400
+ * \ingroup gr_std_expr
2401
+ */
2402
+ inline const xor_exprt &to_xor_expr (const exprt &expr)
2403
+ {
2404
+ PRECONDITION (expr.id ()==ID_xor);
2405
+ return static_cast <const xor_exprt &>(expr);
2406
+ }
2407
+
2408
+ /* ! \copydoc to_bitxor_expr(const exprt &)
2409
+ * \ingroup gr_std_expr
2410
+ */
2411
+ inline xor_exprt &to_xor_expr (exprt &expr)
2412
+ {
2413
+ PRECONDITION (expr.id ()==ID_xor);
2414
+ return static_cast <xor_exprt &>(expr);
2415
+ }
2416
+
2417
+ template <> inline bool can_cast_expr<xor_exprt>(const exprt &base)
2418
+ {
2419
+ return base.id ()==ID_xor;
2420
+ }
2421
+ // inline void validate_expr(const bitxor_exprt &value)
2422
+ // {
2423
+ // validate_operands(
2424
+ // value,
2425
+ // 2,
2426
+ // "Bit-wise xor must have two or more operands",
2427
+ // true);
2428
+ // }
2429
+
2430
+
2377
2431
/* ! \brief Bit-wise negation of bit-vectors
2378
2432
*/
2379
2433
class bitnot_exprt :public unary_exprt
0 commit comments