• 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
            • Signed-saturate
              • Signed-saturate-fn
              • Signed-saturate64
                • Signed-saturate32
                • Signed-saturate16
                • Signed-saturate8
              • Unsigned-saturate
            • Bitops/part-install
            • Bitops/logbitp-bounds
            • Bitops/ihsext-basics
            • Bitops/fast-rotate
            • Bitops/fast-logext
            • Bitops/ihs-extensions
          • Bv
          • Ihs
          • Rtl
        • Algebra
      • Testing-utilities
    • Signed-saturate

    Signed-saturate64

    Optimized implementation of 64-bit signed saturation.

    Signature
    (signed-saturate64 x) → *
    Arguments
    x — Guard (integerp x).

    Definitions and Theorems

    Function: signed-saturate64$inline

    (defun signed-saturate64$inline (x)
      (declare (xargs :guard (integerp x)))
      (let ((__function__ 'signed-saturate64))
        (declare (ignorable __function__))
        (mbe :logic (signed-saturate-fn 64 x)
             :exec (cond ((>= x 9223372036854775807)
                          9223372036854775807)
                         ((<= x -9223372036854775808)
                          9223372036854775808)
                         (t (the (unsigned-byte 64)
                                 (logand (the (signed-byte 64) x)
                                         18446744073709551615)))))))