• Top
    • Documentation
    • Books
    • Boolean-reasoning
      • Ipasir
      • Aignet
      • Aig
        • Aig-constructors
        • Aig-vars
        • Aig-sat
        • Bddify
        • Aig-substitution
        • Aig-other
          • Best-aig
          • Aig2c
          • Expr-to-aig
          • Aiger-write
          • Aig-random-sim
            • Aig-vecsim60
            • 60-bit-fix
              • Logbitp-env60
              • Init-random-state
              • N-random-60-bit-nats
              • *60-bit-mask*
            • Aiger-read
            • Aig-print
            • Aig-cases
          • Aig-semantics
          • Aig-and-count
        • Satlink
        • Truth
        • Ubdds
        • Bdd
        • Faig
        • Bed
        • 4v
      • Projects
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Aig-random-sim

    60-bit-fix

    Coerce an object to a 60-bit natural.

    Signature
    (60-bit-fix x) → *

    A previous definition for this function was:

    (the (signed-byte 61)
      (if (integerp x)
          (logand x (the (signed-byte 61) *60-bit-mask*))
        0))

    But the new definition is slightly faster because we avoid the lookup of the *60-bit-mask*.

    We could make this almost twice as fast by redefining it under the hood as (if (typep x '(signed-byte 61)) x 0), but I had some trouble getting this to properly inline, and probably it's best to avoid a ttag for such a minor optimization.

    Definitions and Theorems

    Function: 60-bit-fix$inline

    (defun 60-bit-fix$inline (x)
      (declare (xargs :guard t))
      (let ((__function__ '60-bit-fix))
        (declare (ignorable __function__))
        (if (integerp x)
            (the (signed-byte 61)
                 (logand x (- (ash 1 60) 1)))
          0)))