Skip to content
Snippets Groups Projects
Verified Commit 63b7b76a authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Format

parent 54e2e84b
No related branches found
No related tags found
No related merge requests found
......@@ -661,7 +661,7 @@ macro_rules! strtou_impl {
};
($type:ident, $ptr:expr, $base:expr, $negative:expr) => {{
let mut base = $base;
if (base == 16 || base == 0)
&& *$ptr == '0' as wchar_t
&& (*$ptr.add(1) == 'x' as wchar_t || *$ptr.add(1) == 'X' as wchar_t)
......@@ -669,18 +669,13 @@ macro_rules! strtou_impl {
$ptr = $ptr.add(2);
base = 16;
}
if base == 0 {
base = if *$ptr == '0' as wchar_t {
8
} else {
10
};
base = if *$ptr == '0' as wchar_t { 8 } else { 10 };
};
let mut result: $type = 0;
while let Some(digit) = char::from_u32(*$ptr as u32).and_then(|c| c.to_digit(base as u32))
{
while let Some(digit) = char::from_u32(*$ptr as u32).and_then(|c| c.to_digit(base as u32)) {
let new = result.checked_mul(base as $type).and_then(|result| {
if $negative {
result.checked_sub(digit as $type)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment