算術移位
在程序設計中,算術移位是一種位操作,有時被稱為有符號移位。它分為算術左移和算術右移。對於二進制數來說,算術移位可以移動每個數字的位置,即每個數字都能被移動,而空出的位置又被其他數字填充。當向右移動時,最左邊的位置依舊保留原有位置的數值[1]。
![](http://images.weserv.nl/?url=//upload.wikimedia.org/wikipedia/commons/thumb/3/37/Rotate_right_arithmetically.svg/300px-Rotate_right_arithmetically.svg.png)
![](http://images.weserv.nl/?url=//upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Rotate_left_logically.svg/300px-Rotate_left_logically.svg.png)
參考文獻
- ^ Thomas R. Cain and Alan T. Sherman. "How to break Gifford's cipher". Section 8.1: "Sticky versus Non-Sticky Bit-shifting". Cryptologia. 1997.