• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
          • Byte-to-bits
            • Bits-to-byte-little
            • Bits-to-byte
            • Byte-to-bits-little
            • Bvchop
            • Bvuminus
            • Bvplus
            • Bvminus
          • Imp-language
          • Event-macros
          • Java
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Bv

    Byte-to-bits

    Convert a byte to a list of bits (big-endian).

    ;; Convert a byte into a list of 8 bits. The most significant bit comes first,
    ;; so this is "big endian."  We could define this as (unpackbv 8 1 byte), but
    ;; that seems too complicated.
    (defund byte-to-bits (byte)
      (declare (xargs :guard (integerp byte)
                      ;;(unsigned-byte-p 8 byte) ;todo: strengthen guard to this
                      ))
      (list (getbit 7 byte)
            (getbit 6 byte)
            (getbit 5 byte)
            (getbit 4 byte)
            (getbit 3 byte)
            (getbit 2 byte)
            (getbit 1 byte)
            (getbit 0 byte)))