Skip to content

Commit

Permalink
Document behavior of bitwise operators with boolean arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Jun 16, 2015
1 parent 1035645 commit a8f666f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/doc/reference.md
Expand Up @@ -2768,22 +2768,24 @@ meaning of the operators on standard types is given here.
Like the [arithmetic operators](#arithmetic-operators), bitwise operators are
syntactic sugar for calls to methods of built-in traits. This means that
bitwise operators can be overridden for user-defined types. The default
meaning of the operators on standard types is given here.
meaning of the operators on standard types is given here. Bitwise `&`, `|` and
`^` applied to boolean arguments are equivalent to logical `&&`, `||` and `!=`
evaluated in non-lazy fashion.

* `&`
: And.
: Bitwise AND.
Calls the `bitand` method of the `std::ops::BitAnd` trait.
* `|`
: Inclusive or.
: Bitwise inclusive OR.
Calls the `bitor` method of the `std::ops::BitOr` trait.
* `^`
: Exclusive or.
: Bitwise exclusive OR.
Calls the `bitxor` method of the `std::ops::BitXor` trait.
* `<<`
: Left shift.
Calls the `shl` method of the `std::ops::Shl` trait.
* `>>`
: Right shift.
: Right shift (arithmetic).
Calls the `shr` method of the `std::ops::Shr` trait.

#### Lazy boolean operators
Expand Down

0 comments on commit a8f666f

Please sign in to comment.