Home  >  Article  >  Backend Development  >  php binary

php binary

巴扎黑
巴扎黑Original
2016-11-22 10:52:241922browse

Binary 0,1 seam binary 1
1. The highest bit of binary is the sign bit, 0 represents a positive number, 1 represents a negative number
2. The original code of a positive number, its complement and complement are the same
3. The inverse of a negative number Code = the sign bit of its original code remains unchanged, and the other bits are inverted, (0-》1, 1-》0)
4. The complement of a negative number = its complement + 1;
5.0’s complement of the complement is both is 0;
6. There are no unsigned numbers in php. In other words, the numbers in php are all signed.
7. When computers perform operations, they are always performed in the complement method

8.& Bitwise If both bits are 1, the result is 1
9.|Bitwise OR, if 1 is 1, it is 1
10.^XOR, if one is 1, and the other is 0, the result is 1
11,~bitwise To negate, 1——> 0 0->1

Shift left, the sign bit remains unchanged, the low bit is filled with 0,
Shift right, the low bit overflows, the sign bit remains unchanged, and the sign bit is used to fill the overflowed high bit

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn