算术移位
在程序设计中,算术移位是一种位操作,有时被称为有符号移位。它分為算术左移和算术右移。对于二进制数来说,算术移位可以移动每個數字的位置,即每個數字都能被移动,而空出的位置又被其他數字填充。当向右移动时,最左边的位置依舊保留原有位置的數值[1]。

二进制数算术右移1位。最左邊的數值不變

二进制数算术左移1位。最右邊的位置則用零填充。
参考文献
- Thomas R. Cain and Alan T. Sherman. "How to break Gifford's cipher". Section 8.1: "Sticky versus Non-Sticky Bit-shifting". Cryptologia. 1997.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.