單片機c語言位操作
發布時間: 2023-09-02 01:49:46
⑴ 單片機 移位操作 右移 C語言
aa=_crol_(aa,1); //左移一位
aa=_cror_(aa,1); //右移一位
可以打開:intrins.h,查看。
⑵ 單片機程序中數組中的值怎麼實現位左(右)移(C語言)
data
=
nBitmapDot[i]
>>
1;
//
nBitmap[i]右移一個二進制位,與
data
=
nBitmapDot[i]
/
2;
同效。
data
=
nBitmapDot[i]
<<
1;
//
nBitmap[i]左移一個二進制位,與
data
=
nBitmapDot[i]
*
2;
同效。
要說明的是移位操作(<<
或
>>)效率更高。
熱點內容