Skip to content
BitVecFromIntegerAlloc

BitVecFromIntegerAlloc

Description

Build a bitvector from an integer using an explicit allocator.

Parameters

Name Direction Description
value in Integer value to convert.
bits in Number of bits to emit.
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 BitVecFromIntegerAlloc(u64 value, u64 bits, Allocator alloc) {
        BitVec result;
    #define BITVEC_FROM_INTEGER_HAS_ARGS(...)                         BITVEC_FROM_INTEGER_HAS_ARGS_IMPL(__VA_ARGS__, 3, 2, 1, 0)
    #define BitVecFromInteger(...)                                    CONCAT(BitVecFromInteger_, BITVEC_FROM_INTEGER_HAS_ARGS(__VA_ARGS__))(__VA_ARGS__)
    #define BitVecFromInteger_2(value, bits)                          BitVecFromIntegerAlloc((value), (bits), DefaultAllocator())
    #define BitVecFromInteger_3(value, bits, alloc)                   BitVecFromIntegerAlloc((value), (bits), (alloc))
    #define BitVecFromInteger(...)                                    CONCAT(BitVecFromInteger_, BITVEC_FROM_INTEGER_HAS_ARGS(__VA_ARGS__))(__VA_ARGS__)
    #define BitVecFromInteger_2(value, bits)                          BitVecFromIntegerAlloc((value), (bits), DefaultAllocator())
    #define BitVecFromInteger_3(value, bits, alloc)                   BitVecFromIntegerAlloc((value), (bits), (alloc))
    
    #endif // MISRA_STD_CONTAINER_BITVEC_CONVERT_H
Last updated on