BitVecTryFromIntegerAlloc
Description
Build a bitvector from an integer using an explicit allocator.
Parameters
| Name | Direction | Description |
|---|---|---|
out |
out | Destination bitvector. |
value |
in | Integer value to convert. |
bits |
in | Number of bits to emit. |
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
Float.c:103:
}
if (!BitVecTryFromIntegerAlloc(&out->bits, value, bits, alloc)) {
IntDeinit(out);
*out = IntInit(alloc);- In
Int.c:64:
}
if (!BitVecTryFromIntegerAlloc(INT_BITS(out), value, bits, alloc)) {
IntDeinit(out);
*out = IntInit(alloc);- In
BitVec.c:971:
}
bool BitVecTryFromIntegerAlloc(BitVec *out, u64 value, u64 bits, Allocator alloc) {
if (!out) {
LOG_FATAL("out is NULL");- In
BitVec.c:1004:
BitVec result;
if (!BitVecTryFromIntegerAlloc(&result, value, bits, alloc)) {
result = BitVecInit(alloc);
}- In
Convert.h:326:
#define BitVecTryFromInteger(...) \
CONCAT(BitVecTryFromInteger_, BITVEC_TRY_FROM_INTEGER_HAS_ARGS(__VA_ARGS__))(__VA_ARGS__)
#define BitVecTryFromInteger_3(out, value, bits) BitVecTryFromIntegerAlloc((out), (value), (bits), DefaultAllocator())
#define BitVecTryFromInteger_4(out, value, bits, alloc) BitVecTryFromIntegerAlloc((out), (value), (bits), (alloc))- In
Convert.h:327:
CONCAT(BitVecTryFromInteger_, BITVEC_TRY_FROM_INTEGER_HAS_ARGS(__VA_ARGS__))(__VA_ARGS__)
#define BitVecTryFromInteger_3(out, value, bits) BitVecTryFromIntegerAlloc((out), (value), (bits), DefaultAllocator())
#define BitVecTryFromInteger_4(out, value, bits, alloc) BitVecTryFromIntegerAlloc((out), (value), (bits), (alloc))
///
Last updated on