pub enum BitOp {
And,
Or,
Xor,
Shl,
Shr,
UShr,
}
Expand description
A bitwise operator is an operator used to perform bitwise operations on bit patterns or binary numerals that involve the manipulation of individual bits.
More information:
Variants
And
Performs the AND operation on each pair of bits. a AND b yields 1 only if both a and b are 1.
Syntax: x & y
More information:
Or
Performs the OR operation on each pair of bits. a OR b yields 1 if either a or b is 1.
Syntax: x | y
More information:
Xor
Performs the XOR operation on each pair of bits. a XOR b yields 1 if a and b are different.
Syntax: x ^ y
More information:
Shl
This operator shifts the first operand the specified number of bits to the left.
Syntax: x << y
Excess bits shifted off to the left are discarded. Zero bits are shifted in from the right.
More information:
Shr
This operator shifts the first operand the specified number of bits to the right.
Syntax: x >> y
Excess bits shifted off to the right are discarded. Copies of the leftmost bit are shifted in from the left. Since the new leftmost bit has the same value as the previous leftmost bit, the sign bit (the leftmost bit) does not change. Hence the name “sign-propagating”.
More information:
UShr
This operator shifts the first operand the specified number of bits to the right.
Syntax: x >>> y
Excess bits shifted off to the right are discarded. Zero bits are shifted in from the left. The sign bit becomes 0, so the result is always non-negative. Unlike the other bitwise operators, zero-fill right shift returns an unsigned 32-bit integer.
More information: