• 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
        • Bv
        • Ihs
          • Logops-definitions
            • Logops-byte-functions
            • Defword
            • Defbytetype
            • Logext
              • Fast-logext
                • Fast-logext-exec
                • Fast-logext64
                • Fast-logext16
                  • Fast-logext8
                  • Fast-logext32
                  • Fast-logext-fn
                • Ihs/logext-lemmas
                • Logext-basics
                • Logext*
              • Logrev
              • Loghead
              • Logops-bit-functions
              • Logtail
              • Logapp
              • Logsat
              • Binary--
              • Logcdr
              • Logcar
              • Logbit
              • Logextu
              • Logcons
              • Lshu
              • Logrpl
              • Ashu
              • Logmaskp
              • Lognotu
              • Logmask
              • Imod
              • Ifloor
              • Bfix
              • Bitmaskp
              • Logite
              • Expt2
              • Zbp
              • *logops-functions*
              • Word/bit-macros
              • Logops-definitions-theory
              • Logops-functions
              • Lbfix
              • Logextu-guard
              • Lshu-guard
              • Logtail-guard
              • Logrpl-guard
              • Logrev-guard
              • Lognotu-guard
              • Logmask-guard
              • Loghead-guard
              • Logext-guard
              • Logbit-guard
              • Logapp-guard
              • Ashu-guard
            • Math-lemmas
            • Ihs-theories
            • Ihs-init
            • Logops
          • Rtl
        • Algebra
      • Testing-utilities
    • Fast-logext

    Fast-logext16

    Optimized implementation of 16-bit sign-extension.

    Signature
    (fast-logext16 x) → *
    Arguments
    x — Guard (integerp x).

    Definitions and Theorems

    Function: fast-logext16$inline

    (defun fast-logext16$inline (x)
      (declare (xargs :guard (integerp x)))
      (let ((__function__ 'fast-logext16))
        (declare (ignorable __function__))
        (mbe :logic (logext 16 x)
             :exec (the (signed-byte 16)
                        (- (the (unsigned-byte 16)
                                (logxor (the (unsigned-byte 16)
                                             (logand 65535 x))
                                        (the (unsigned-byte 16) 32768)))
                           32768)))))