Skip to content
BitVecTryFromStr

BitVecTryFromStr

Description

Parse a bitvector from a null-terminated string.

This public API supports both forms:

  • BitVecTryFromStr(out, str)
  • BitVecTryFromStr(out, str, alloc)

Omitting the allocator binds the destination to DefaultAllocator().

Success

Returns true and initializes out.

Failure

Returns false on invalid input or allocation failure.

Usage example (Cross-references)

Usage examples (Cross-references)
        const char *str = "1011";
        BitVec      bv;
        bool        ok = BitVecTryFromStr(&bv, str);
    
        // Check result
        BitVec bv;
        Str    str;
        bool   ok = BitVecTryFromStr(&bv, "101001", alloc);
        bool   result = ok && (bv.allocator.effort == alloc.effort) && (bv.allocator.retry_limit == alloc.retry_limit);
Last updated on