Current location - Education and Training Encyclopedia - Graduation thesis - sign

Move all the binary bits of the operand to the left by several bits (the binary bits on the left are discarded and the ones on the right are filled with zeros).

For example: a = a

sign

Move all the binary bits of the operand to the left by several bits (the binary bits on the left are discarded and the ones on the right are filled with zeros).

For example: a = a

sign

Move all the binary bits of the operand to the left by several bits (the binary bits on the left are discarded and the ones on the right are filled with zeros).

For example: a = a

A = a * 2; after left shift 1 bit;

If the high bits discarded during the left shift do not include 1, each left shift is equivalent to multiplying the number by 2.

Right shift operator (>>)

The binary bits of a number are all shifted to the right by several bits, positive numbers are left supplemented by 0, negative numbers are left supplemented by 1, and right discarded.

Every right shift of the operand is equivalent to dividing the number by 2.

For example, a = a >>2 shifts the binary bit of a by 2 bits to the right,

Left complement 0 or complement 1 depends on whether the shifted number is positive or negative.