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| 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
Bitwise operators include: & (bitwise AND), | (bitwise OR), ^ (bitwise OR), and ),~ (Bitwise inversion ).
The priority ranges from high to low ~ , &, ^, |
Bitwise AND operation have two typical usage: one is to take a certain bit of the
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,
& Bitwise AND
| By bit or^ Bitwise OR
1. 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
Bitwise operations in Java
Java bit operator
Bitwise operators are used to operate binary bits. Java provides bitwise operators as shown below:
Bitwise operator (>>,>>,&, |, ^ ,~ ), In the bitwise operator, ~ The others are binary operators. The
1. cBitwise operators in languages
Because the C language is designed to replace the assembly language, it must support the computing power of the assembly language, so the C language supports all bitwise operators ). Bit operations are used to test,
Conversion from: c |, |, &, &, Or ,~ ,! Operation
Bitwise operation
The bitwise operation component can only be integer or numeric type data. bitwise operations regard the operation object as Bit String information consisting of binary digits to
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.