mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
math.unsigned: change uint256_from_dec_str to return a result, instead of an option (#19041)
This commit is contained in:
parent
5ec7ee916a
commit
ef5c3cdb73
@ -382,7 +382,7 @@ pub fn (u_ Uint256) str() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// uint256_from_dec_str creates a new `unsigned.Uint256` from the given string if possible
|
// uint256_from_dec_str creates a new `unsigned.Uint256` from the given string if possible
|
||||||
pub fn uint256_from_dec_str(value string) ?Uint256 {
|
pub fn uint256_from_dec_str(value string) !Uint256 {
|
||||||
mut res := unsigned.uint256_zero
|
mut res := unsigned.uint256_zero
|
||||||
for b_ in value.bytes() {
|
for b_ in value.bytes() {
|
||||||
b := b_ - '0'.bytes()[0]
|
b := b_ - '0'.bytes()[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user