• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
      • 100-theorems
      • Arithmetic
      • Bit-vectors
        • Sparseint
        • Bitops
          • Bitops/merge
          • Bitops-compatibility
          • Bitops-books
          • Logbitp-reasoning
          • Bitops/signed-byte-p
          • Fast-part-select
          • Bitops/integer-length
          • Bitops/extra-defs
          • Install-bit
          • Trailing-0-count
          • Bitops/defaults
          • Logbitp-mismatch
          • Trailing-1-count
          • Bitops/rotate
          • Bitops/equal-by-logbitp
          • Bitops/ash-bounds
          • Bitops/fast-logrev
          • Limited-shifts
          • Bitops/part-select
          • Bitops/parity
          • Bitops/saturate
          • Bitops/part-install
          • Bitops/logbitp-bounds
          • Bitops/ihsext-basics
          • Bitops/fast-rotate
            • Fast-rotate
              • Rotate-left-9
              • Rotate-left-8
              • Rotate-left-65
              • Rotate-left-64
              • Rotate-left-33
              • Rotate-left-32
              • Rotate-left-17
              • Rotate-left-16
              • Rotate-right-65
              • Rotate-right-64
              • Rotate-right-33
              • Rotate-right-32
              • Rotate-right-17
                • Rotate-right-16
                • Rotate-right-9
                • Rotate-right-8
            • Bitops/fast-logext
            • Bitops/ihs-extensions
          • Bv
          • Ihs
          • Rtl
        • Algebra
      • Testing-utilities
    • Fast-rotate

    Rotate-right-17

    Signature
    (rotate-right-17 x places) → *
    Arguments
    x — The bit vector to be rotated right.
    places — The number of places to rotate right.

    Definitions and Theorems

    Function: rotate-right-17$inline

    (defun rotate-right-17$inline (x places)
     (declare (type (unsigned-byte 17) x)
              (type (unsigned-byte 17) places))
     (let ((__function__ 'rotate-right-17))
      (declare (ignorable __function__))
      (mbe
        :logic (rotate-right x 17 places)
        :exec
        (let* ((x (mbe :logic (loghead 17 x) :exec x))
               (places (mbe :logic (lnfix places)
                            :exec places))
               (places (if (< places 17)
                           (the (integer 0 16) places)
                         (the (integer 0 16) (rem places 17))))
               (mask (the (unsigned-byte 17)
                          (1- (the (unsigned-byte 17)
                                   (ash 1 places)))))
               (xl (the (unsigned-byte 17)
                        (logand x mask)))
               (xh-shift (the (unsigned-byte 17)
                              (ash x (the (integer -17 0) (- places)))))
               (high-num (the (integer 0 17) (- 17 places)))
               (xl-shift (the (unsigned-byte 17)
                              (ash xl high-num)))
               (ans (the (unsigned-byte 17)
                         (logior xl-shift xh-shift))))
          ans))))