Bitwise operatorsC provides six bitwise operators. These operators may only allow integer operands, namely char, short, Int, and long, regardless of signed or unsigned.& By-bit and| Bitwise OR^ Bitwise OR> Right shift~ Inverse (unary
Front.
Bitwise operators are very low-level operations and are not commonly used because they are not intuitive. However, its speed is very fast, and reasonable use can achieve very good results. This article will introduce the operator-bitwise
Bitwise AND Operator:&
Grammar
Expression
&
expression
NoteAn expression can be another "and" expression, or (follow the type restrictions described below) equality expressions, relational expressions, addition expressions,
We've explained PHP arithmetic operators, PHP string operators, assignment operators, and today we'll give you a detailed introduction to the PHP operator
"bitwise operator"。
Bit operators are not often used in PHP, but they are still very useful,
1. Expression: The expression is judged to have no result (value), the simplest expression is a constant or variable, such as: A, A, 3 + 1, a + B, a + 5 are expressions2.BOOL (Boolean) data type: In addition to the basic data types in the C language,
in C #, you can perform a bitwise logical operation on an integer operand. The meaning of the bitwise logical operation is that each bit of the operand is taken sequentially, and the logical operation of each bit is the result of each bit of the
Document directory
Bitwise AND operator (&)
Bitwise OR operator (|)
XOR operator (^)
Inverse Operator (~)
Left shift operator (
Shift right operator (>)
Compound assignment operator
Bitwise AND operator (&)
The two data involved in the
Bitwise operators allow us to manipulate a single "bit" in the primary data type of an integer, that is, bits. The bitwise operator performs a Boolean algebra on the corresponding bits in the two arguments and eventually produces a result.Bitwise
& Bitwise AND| By bit or^ Bitwise OR1. bitwise and operation bitwise AND operator "&" are binary operators. Its function is the binary phase corresponding to the two numbers involved in the operation. The result bit is 1 only when the two binary
Logical AND logical OR logical is not a Boolean worthwhile operation, it belongs to the discrete mathematics category.bitwise AND, bitwise OR, bitwise is not the operation of the computer bit, belongs to the computer bits operation category.Logic
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.