summaryrefslogtreecommitdiff
path: root/src/ram.rs
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2019-10-01 00:07:36 +0300
committerOxore <oxore@protonmail.com>2019-10-01 00:07:36 +0300
commit6195de98c48a43f1c9d7838e8d2d9d11a1ae3571 (patch)
tree51485977426e72c7597adb7566ef38c3f8ed4ca8 /src/ram.rs
parent0832a0dddad7782b8ac7a06c76d3e58ab2a56864 (diff)
Fix hex parsing using radix 16 instead of 10
Diffstat (limited to 'src/ram.rs')
-rw-r--r--src/ram.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ram.rs b/src/ram.rs
index 34723cb..a886db3 100644
--- a/src/ram.rs
+++ b/src/ram.rs
@@ -46,11 +46,11 @@ impl HexLine {
if &s[0..1] != ":" {
return Err(0)
}
- let offset = match (&s[3..7]).parse::<u16>() {
+ let offset = match u16::from_str_radix(&s[3..7], 16) {
Ok(value) => value,
Err(_) => return Err(3),
};
- let bytecount = match(&s[1..3]).parse::<usize>() {
+ let bytecount = match usize::from_str_radix(&s[1..3], 16) {
Ok(value) => value,
Err(_) => return Err(1),
};
@@ -62,7 +62,7 @@ impl HexLine {
let mut counter = 9;
let mut data = vec![];
while counter < s.len() - 2 && counter < (9 + bytecount * 2) {
- data.push(match(&s[counter..counter+2]).parse::<u8>() {
+ data.push(match u8::from_str_radix(&s[counter..counter+2], 16) {
Ok(value) => value,
Err(_) => return Err(counter),
});