Skip to content
BitVecFromBytesAlloc

BitVecFromBytesAlloc

Description

Build a bitvector from raw bytes using an explicit allocator.

Parameters

Name Direction Description
bytes in Source byte buffer.
bit_len in Number of bits to read from bytes.
alloc in Allocator to bind to the returned bitvector.

Success

Returns initialized bitvector.

Failure

Returns an empty bitvector if allocation fails.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    BitVec BitVecFromBytesAlloc(const u8 *bytes, u64 bit_len, Allocator alloc) {
        BitVec result;
    #define BITVEC_FROM_BYTES_HAS_ARGS(...)                         BITVEC_FROM_BYTES_HAS_ARGS_IMPL(__VA_ARGS__, 3, 2, 1, 0)
    #define BitVecFromBytes(...)                                    CONCAT(BitVecFromBytes_, BITVEC_FROM_BYTES_HAS_ARGS(__VA_ARGS__))(__VA_ARGS__)
    #define BitVecFromBytes_2(bytes, bit_len)                       BitVecFromBytesAlloc((bytes), (bit_len), DefaultAllocator())
    #define BitVecFromBytes_3(bytes, bit_len, alloc)                BitVecFromBytesAlloc((bytes), (bit_len), (alloc))
    #define BitVecFromBytes(...)                                    CONCAT(BitVecFromBytes_, BITVEC_FROM_BYTES_HAS_ARGS(__VA_ARGS__))(__VA_ARGS__)
    #define BitVecFromBytes_2(bytes, bit_len)                       BitVecFromBytesAlloc((bytes), (bit_len), DefaultAllocator())
    #define BitVecFromBytes_3(bytes, bit_len, alloc)                BitVecFromBytesAlloc((bytes), (bit_len), (alloc))
    
    ///
Last updated on