Skip to content

Commit

Permalink
Minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishdaulatabad committed Apr 4, 2024
1 parent d25319b commit e173081
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/u256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl U256 {
pub fn from_string(string: &str) -> Result<Self, ParseUintError> {
let mut value = U256::ZERO;

for chr in string.chars() {
for chr in string.chars().filter(|c| *c != '_') {
let digit = chr.to_digit(10);
if let Some(dig) = digit {
let (value_x_8, value_x_2) = (value << 3, value << 1);
Expand Down Expand Up @@ -178,7 +178,7 @@ impl U256 {
_ => 0,
};

for chr in string.chars().skip(skip) {
for chr in string.chars().skip(skip).filter(|c| *c != '_') {
let digit = chr.to_digit(radix);

if let Some(dig) = digit {
Expand Down
3 changes: 2 additions & 1 deletion src/u512.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,8 @@ mod test {
assert_eq!(a % b, "229622695252588468980047866375".parse::<U512>()?);

let a = "3912093812908391208428194902184908123982189742178629873982173391238912".parse::<U512>()?;
let b = "940899340494892899287232134329048329473287439824732982141".parse::<U512>()?;
let b = "940899340494892899287232134329048329473287439824732982141"
.parse::<U512>()?;
let c = a % b;

assert_eq!(
Expand Down

0 comments on commit e173081

Please sign in to comment.