Bitwise operations: Difference between revisions

m
Line 682:
 
(defun shr (x width bits)
"Compute bitwise rigthright shift of x by 'bits' bits, represented on 'width' bits"
(logand (ash x (- bits))
(1- (ash 1 width))))
Line 698:
 
(defun rotr (x width bits)
"Compute bitwise rigthright rotation of x by 'bits' bits, represented on 'width' bits"
(logior (logand (ash x (- (mod bits width)))
(1- (ash 1 width)))