mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 01:58:20 +00:00
test suite for bitwise operators
brief NEWS blurb allow for "counter" operands (does anyone still use these?) for one (but not both) of the bitwise operands
This commit is contained in:
parent
1658931af1
commit
58ffd61dcc
4 changed files with 33 additions and 4 deletions
11
src/Expr.cc
11
src/Expr.cc
|
@ -1874,12 +1874,15 @@ BitExpr::BitExpr(BroExprTag arg_tag, Expr* arg_op1, Expr* arg_op2)
|
|||
if ( IsVector(bt2) )
|
||||
bt2 = op2->Type()->AsVectorType()->YieldType()->Tag();
|
||||
|
||||
if ( bt1 == TYPE_COUNT && bt2 == bt1 )
|
||||
if ( (bt1 == TYPE_COUNT || bt1 == TYPE_COUNTER) &&
|
||||
(bt2 == TYPE_COUNT || bt2 == TYPE_COUNTER) )
|
||||
{
|
||||
if ( is_vector(op1) || is_vector(op2) )
|
||||
SetType(new VectorType(base_type(bt1)));
|
||||
if ( bt1 == TYPE_COUNTER && bt2 == TYPE_COUNTER )
|
||||
ExprError("cannot apply a bitwise operator to two \"counter\" operands");
|
||||
else if ( is_vector(op1) || is_vector(op2) )
|
||||
SetType(new VectorType(base_type(TYPE_COUNT)));
|
||||
else
|
||||
SetType(base_type(bt1));
|
||||
SetType(base_type(TYPE_COUNT));
|
||||
}
|
||||
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue