1 (in-package "SB-ROTATE-BYTE")
3 (defun rotate-byte (count byte integer)
4 #+sb-doc "FIXME: Write a docstring"
5 (rotate-byte count byte integer))
7 (defun %rotate-byte (count size pos integer)
8 (let ((count (nth-value 1 (round count size)))
9 (mask (1- (ash 1 size))))
10 (logior (logand integer (lognot (ash mask pos)))
11 (let ((field (logand (ash mask pos) integer)))
12 (logand (ash mask pos)
14 (logior (ash field count)
15 (ash field (- count size)))
16 (logior (ash field count)
17 (ash field (+ count size)))))))))
19 (defun %unsigned-32-rotate-byte (count integer)
21 (declare (notinline %rotate-byte))
22 (%rotate-byte count 32 0 integer))