Calculation of displacement

  Displacement calculation scenarios: high and low intercept, hash calculation, arithmetic multiplication and division; the actual programming shift operation acts only on the integral (32) and a long integer (64-bit) number; bitwise operation is an operation of direct memory ,efficient.

  (1) a rightward approximately represented by 2, but after the odd converted decimal binary number, while moving to the right, the right-most 1 will be erased directly, indicating that the mobile is not right for the odd fully equivalent divided by 2 ;

  (2) positive when a positive result may be moved to the left, it may be negative; negative result is also likely to be left in the positive, may be negative;

  (3) there is only unsigned right (>>>), the absence of unsigned moved leftward (<<<); unsigned moved rightward operation at high rpm low common scene;

  (4) an unsigned positive number when moved to the right for the minimum value is 0, and a negative minimum value is an unsigned 1 moves to the right;

  (5) movable in the number of bits is 32-bits integers, whether the sign bit and a moving direction of the strip, the result is itself, because the number of bits is the result of a movement of the MOD 32 (32 divided by 32 mold, the result is 0).

  (6) a logical OR, logical AND operation only for the Boolean expressions operation conditions.

  Other, using the same operator, can reduce the overhead of the intermediate storage variable, which reduces the design complexity of the internal CPU, the internal structure is more streamlined, more efficient calculation, regardless of the instruction register, or operator will greatly reduce burden.

Guess you like

Origin www.cnblogs.com/bien94/p/12502393.html