Skip to content

Commit

Permalink
std::math::big: fix empty string parses
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Mar 12, 2024
1 parent 48a1efd commit 77f6c93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 0 additions & 3 deletions std/math/big/conv.jule
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

// Parse bits from binary string.
fn parse_binary(s: str)!: bits {
if s == "" {
error(BigError.Format)
}
// Eliminate initial-zeros to normalize and fit minimum mandatory bit-size.
let mut j = 0
for j < s.len; j++ {
Expand Down
3 changes: 3 additions & 0 deletions std/math/big/nat.jule
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ impl Nat {
// - 2 for binary.
// - 16 for hexadecimal.
static fn parse(s: str, fmt: int)!: Nat {
if s == "" {
error(BigError.Format)
}
let mut r = Nat{}
match fmt {
| 2:
Expand Down

0 comments on commit 77f6c93

Please sign in to comment.