Skip to content
BitVecTryToStr

BitVecTryToStr

Description

Convert a bitvector to a string.

This public API supports both forms:

  • BitVecTryToStr(out, bv)
  • BitVecTryToStr(out, bv, alloc)

Omitting the allocator makes the output string inherit the bitvector allocator configuration.

Success

Returns true and initializes out.

Failure

Returns false if allocation fails.

Usage example (Cross-references)

Usage examples (Cross-references)
        // Convert to string
        Str  str;
        bool ok = BitVecTryToStr(&str, &bv);
    
        // Check result
        bool   result = ok && (bv.allocator.effort == alloc.effort) && (bv.allocator.retry_limit == alloc.retry_limit);
    
        ok     = BitVecTryToStr(&str, &bv);
        result = result && ok && (str.allocator.effort == alloc.effort) && (str.allocator.retry_limit == alloc.retry_limit) &&
                 (ZstrCompare(str.data, "101001") == 0);
Last updated on