BitVecTryFromBytes
Description
Build a bitvector from raw bytes using an explicit allocator.
Parameters
| Name | Direction | Description |
|---|---|---|
out |
out | Destination bitvector. |
bytes |
in | Source byte buffer. |
bit_len |
in | Number of bits to read from bytes. |
alloc |
in | Allocator to bind to the destination bitvector. |
Success
Returns true and initializes out.
Failure
Returns false if allocation fails.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:522:
}
if (!BitVecTryFromBytes(INT_BITS(&result), bytes, len * 8, alloc)) {
return result;
} u8 bytes[] = {0xB3}; // 10110011 in binary
BitVec bv;
bool ok = BitVecTryFromBytes(&bv, bytes, 8, ALLOCATOR_OF(&alloc)); // 8 bits from the byte
// Check result (8 bits from 1 byte)
Last updated on