Function ROTATE-BYTE

Syntax:

rotate-byte count bytespec integer => result

Arguments and Values:

count---an integer.

bytespec---a byte specifier.

integer---an integer.

result---an integer.

Description:

Rotates a field of bits within integer; specifically, returns an integer that contains the bits of integer rotated count times leftwards within the byte specified by bytespec, and elsewhere contains the bits of integer.

Examples:

    (rotate-byte 3 (byte 32 0) 3) => 24
    (rotate-byte 3 (byte 5 5) 3) => 3
    (rotate-byte 6 (byte 8 0) -3) => -129

Side Effects: None.

Affected By: None.

Exceptional Situations: None.

See Also:

byte, dpb, ldb

Implementation notes

SBCL provides the sb-rotate-byte extension to do this efficiently. On SBCL, cl-utilities uses this extension automatically. On other implementations, portable Common Lisp code is used instead.

Manual Index