fn setString(self: *Mutable, base: u8, value: []const u8, limbs_buffer: []Limb, allocator: ?Allocator) error{InvalidCharacter}!void
Set self from the string representation value
.
value
must contain only digits <= base
and is case insensitive. Base prefixes are not allowed (e.g. 0x43 should simply be 43). Underscores in the input string are ignored and can be used as digit separators.
Asserts there is enough memory for the value in self.limbs
. An upper bound on number of limbs can be determined with calcSetStringLimbCount
. Asserts the base is in the range [2, 16].
Returns an error if the value has invalid digits for the requested base.
limbs_buffer
is used for temporary storage. The size required can be found with calcSetStringLimbsBufferLen
.
If allocator
is provided, it will be used for temporary storage to improve multiplication performance. error.OutOfMemory
is handled with a fallback algorithm.