diff --git a/src/main.rs b/src/main.rs index c89e9bc..14dfbd5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -53,15 +53,15 @@ fn extract_operand(statement: Pair) -> &str { line } -fn parse_constant(text: &str) -> Result { +fn parse_constant(text: &str) -> Result { if text.starts_with("\"") { let c = text.chars().nth(1).unwrap(); - Ok(c as i32) + Ok(c as u32) } else if text.starts_with("0x") { let without_prefix = text.trim_start_matches("0x"); - i32::from_str_radix(without_prefix, 16) + u32::from_str_radix(without_prefix, 16) } else { - i32::from_str_radix(text, 10) + u32::from_str_radix(text, 10) } }