In programming, one of the bitwise operator operators. In C + +, the shift operators have binocular shift operators:<< (left) and >> (move right). An expression consisting of a shift operator also belongs to an arithmetic expression whose value is an arithmetic value. The left shift operation is to shift the operand of a bits to the left by the specified number of digits, remove the bit, and all the vacancies on the right complement 0. The right shift operation is to move a bits operand to the right by the specified number of digits to move, remove the bit to be discarded, leave the left blank or all fill 0, or complement the symbol bit, depending on the machine. In a machine that uses the complement as a machine, a positive sign is 0, and a negative number has a sign bit of 1.
In shift operations, the results of the byte, short, and char types shift to the int type, and when the byte, short, char, and int are shifted, the actual number of moves is the amount of movement and the remainder of the 32, which is the same result as the shift 33 times and the displacement 1 times. When you move a long value, you specify that the number of moves is the number of moves and the remainder of the 64, which is the same result of moving 66 times and moving 2 times.
[Root@legion10 ~]# echo 233 | awk ' {print lshift ($1,5), Rshift ($1,5), $} ' 7456 7 233 [Root@legion10 ~]#
[Root@legion10 ~]# echo 233 | awk ' {print lshift ($1,5), Rshift ($1,5), $} ' 7456 7 233 [Root@legion10 ~]# cat 2 Dec bin | Dec bin 233 0000011101001 | 233 11101001 7456 1110100100000 | 7 00000111----Left-shift 5-bit------------- | ----Right 5-bit------------ [Root@legion10 ~]#
A right shift operation computes IP.
[Root@legion10 ~]# Echo 134744072|awk ' { a=0xff000000; b=0xff0000; c=0xff00; D=0xff; E=rshift (and ($1,a),); F=rshift (and ($1,b); G=rshift (and ($1,c), 8); H=and ($1,d); printf ("%d.%d.%d.%d\n", E,f,g,h)} ' 8.8.8.8 [Root@legion10 ~]#