Skip to content

Commit 2407365

Browse files
committed
document non-binary case for Boolean and bit-wise operators
This documents the current behavior of the non-binary case of the Boolean operators and the bit-wise operators.
1 parent 74d15ae commit 2407365

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/util/bitvector_expr.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ inline bitnot_exprt &to_bitnot_expr(exprt &expr)
121121
}
122122

123123
/// \brief Bit-wise OR
124+
/// Any number of operands that is greater or equal one.
125+
/// The type of all operands must be the same.
124126
class bitor_exprt : public multi_ary_exprt
125127
{
126128
public:
@@ -162,6 +164,8 @@ inline bitor_exprt &to_bitor_expr(exprt &expr)
162164

163165
/// \brief Bit-wise NOR
164166
///
167+
/// Any number of operands that is greater or equal one.
168+
/// The type of all operands must be the same.
165169
/// When given one operand, this is equivalent to the bit-wise negation.
166170
/// When given three or more operands, this is equivalent to the bit-wise
167171
/// negation of the bitand expression with the same operands.
@@ -205,6 +209,8 @@ inline bitnor_exprt &to_bitnor_expr(exprt &expr)
205209
}
206210

207211
/// \brief Bit-wise XOR
212+
/// Any number of operands that is greater or equal one.
213+
/// The type of all operands must be the same.
208214
class bitxor_exprt : public multi_ary_exprt
209215
{
210216
public:
@@ -246,6 +252,8 @@ inline bitxor_exprt &to_bitxor_expr(exprt &expr)
246252

247253
/// \brief Bit-wise XNOR
248254
///
255+
/// Any number of operands that is greater or equal one.
256+
/// The type of all operands must be the same.
249257
/// When given one operand, this is equivalent to the bit-wise negation.
250258
/// When given three or more operands, this is equivalent to the bit-wise
251259
/// negation of the bitxor expression with the same operands.
@@ -291,6 +299,8 @@ inline bitxnor_exprt &to_bitxnor_expr(exprt &expr)
291299
}
292300

293301
/// \brief Bit-wise AND
302+
/// Any number of operands that is greater or equal one.
303+
/// The type of all operands must be the same.
294304
class bitand_exprt : public multi_ary_exprt
295305
{
296306
public:
@@ -332,6 +342,8 @@ inline bitand_exprt &to_bitand_expr(exprt &expr)
332342

333343
/// \brief Bit-wise NAND
334344
///
345+
/// Any number of operands that is greater or equal one.
346+
/// The type of all operands must be the same.
335347
/// When given one operand, this is equivalent to the bit-wise negation.
336348
/// When given three or more operands, this is equivalent to the bit-wise
337349
/// negation of the bitand expression with the same operands.

src/util/std_expr.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,8 +2119,9 @@ inline typecast_exprt &to_typecast_expr(exprt &expr)
21192119
return static_cast<typecast_exprt &>(expr);
21202120
}
21212121

2122-
21232122
/// \brief Boolean AND
2123+
/// All operands must be boolean, and the result is always boolean.
2124+
/// Any number of operands that is greater or equal one.
21242125
class and_exprt:public multi_ary_exprt
21252126
{
21262127
public:
@@ -2189,6 +2190,8 @@ inline and_exprt &to_and_expr(exprt &expr)
21892190

21902191
/// \brief Boolean NAND
21912192
///
2193+
/// All operands must be boolean, and the result is always boolean.
2194+
/// Any number of operands that is greater or equal one.
21922195
/// When given one operand, this is equivalent to the negation.
21932196
/// When given three or more operands, this is equivalent to the negation
21942197
/// of the and expression with the same operands.
@@ -2269,8 +2272,9 @@ inline implies_exprt &to_implies_expr(exprt &expr)
22692272
return ret;
22702273
}
22712274

2272-
22732275
/// \brief Boolean OR
2276+
/// All operands must be boolean, and the result is always boolean.
2277+
/// Any number of operands that is greater or equal one.
22742278
class or_exprt:public multi_ary_exprt
22752279
{
22762280
public:
@@ -2334,6 +2338,8 @@ inline or_exprt &to_or_expr(exprt &expr)
23342338

23352339
/// \brief Boolean NOR
23362340
///
2341+
/// All operands must be boolean, and the result is always boolean.
2342+
/// Any number of operands that is greater or equal one.
23372343
/// When given one operand, this is equivalent to the negation.
23382344
/// When given three or more operands, this is equivalent to the negation
23392345
/// of the and expression with the same operands.
@@ -2371,6 +2377,8 @@ inline nor_exprt &to_nor_expr(exprt &expr)
23712377
}
23722378

23732379
/// \brief Boolean XOR
2380+
/// All operands must be boolean, and the result is always boolean.
2381+
/// Any number of operands that is greater or equal one.
23742382
class xor_exprt:public multi_ary_exprt
23752383
{
23762384
public:

0 commit comments

Comments
 (0)