Skip to content
BitVecTryFromBytes

BitVecTryFromBytes

Description

Build a bitvector from raw bytes.

This public API supports both forms:

  • BitVecTryFromBytes(out, bytes, bit_len)
  • BitVecTryFromBytes(out, bytes, bit_len, alloc)

Omitting the allocator binds the destination to DefaultAllocator().

Success

Returns true and initializes out.

Failure

Returns false if allocation fails.

Usage example (Cross-references)

Usage examples (Cross-references)
        u8     bytes[] = {0xB3}; // 10110011 in binary
        BitVec bv;
        bool   ok = BitVecTryFromBytes(&bv, bytes, 8); // 8 bits from the byte
    
        // Check result (8 bits from 1 byte)
Last updated on