1271 views|0 replies

6570

Posts

0

Resources
The OP
 

Shift operation of C [Copy link]

When the logical left shift is performed, the highest bit is lost and the lowest bit is filled with 0; When the logical right shift is performed, the highest bit is filled with 0 and the lowest bit is lost; When the arithmetic left shift is performed, the bits are shifted left one by one, the tail is filled with 0, and the highest sign bit remains unchanged; When the arithmetic right shift is performed, the bits are shifted right one by one, the tail is lost, and after the sign bit is shifted right, a sign bit is copied to the original position; When the circular left shift is performed, the highest bit is replaced to the lowest bit; When the circular right shift is performed, the lowest bit is replaced to the highest bit; One purpose of using the circular operation is to place each bit continuously to the leftmost to determine the sign of the data. If you want to swap the high and low bits of a number, it is very convenient and fast to use a one-bit operation.

This post is from Microcontroller MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list