mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Merge branch 'topic/vern/bit-ops' of https://github.com/bro/bro
* 'topic/vern/bit-ops' of https://github.com/bro/bro: documentation clarification for "p1 | p2" documentation for bitwise operators document the '|' operator for patterns 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 bitwise operations for "count" types implemented Starting branch for supporting bit operations on count's.
This commit is contained in:
commit
e5275b0c92
12 changed files with 215 additions and 26 deletions
|
@ -91,6 +91,10 @@ Here is a more detailed description of each type:
|
|||
type, but a unary plus or minus applied to a "count" results in an
|
||||
"int".
|
||||
|
||||
In addition, "count" types support bitwise operations. You can use
|
||||
``&``, ``|``, and ``^`` for bitwise ``and'', ``or'', and ``xor''. You
|
||||
can also use ``~`` for bitwise (one's) complement.
|
||||
|
||||
.. bro:type:: double
|
||||
|
||||
A numeric type representing a double-precision floating-point
|
||||
|
@ -233,6 +237,14 @@ Here is a more detailed description of each type:
|
|||
is false since "oob" does not appear at the start of "foobar". The
|
||||
``!in`` operator would yield the negation of ``in``.
|
||||
|
||||
Finally, you can create a disjunction (either-or) of two literal patterns
|
||||
using the ``|`` operator. For example::
|
||||
|
||||
/foo/ | /bar/ in "foobar"
|
||||
|
||||
yields true, like in the similar example above. (This does not presently
|
||||
work for variables whose values are patterns, however.)
|
||||
|
||||
.. bro:type:: port
|
||||
|
||||
A type representing transport-level port numbers (besides TCP and
|
||||
|
@ -585,6 +597,9 @@ Here is a more detailed description of each type:
|
|||
The resulting vector of bool is the logical "and" (or logical "or") of
|
||||
each element of the operand vectors.
|
||||
|
||||
Vectors of type ``count`` can also be operands for the bitwise and/or/xor
|
||||
operators, ``&``, ``|`` and ``^``.
|
||||
|
||||
See the :bro:keyword:`for` statement for info on how to iterate over
|
||||
the elements in a vector.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue