c language shift instead of multiplication and division to be noted that the sign bit

Use the sign bit shift easily transformed, but not multiplication.

For example a = 0b1011 1110, it is -66.

If the left one in place by 2, the result left

a = 0b0111 1100 = 124, the number of negative to positive, the sign bit is removed.

In fact a * 2 = -132. Therefore, when the sign bit must pay attention to a shift Multiplying

Published 11 original articles · won praise 0 · Views 613

Guess you like

Origin blog.csdn.net/wuqi1003/article/details/104083077