Skip to content

Commit 1b79648

Browse files
committed
Support also hex literals (starting with 0x)
1 parent 319aa3c commit 1b79648

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Diff for: build.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,14 @@ fn main() {
133133
Err(env::VarError::NotUnicode(_)) => panic!(
134134
"The `BOOTLOADER_PHYSICAL_MEMORY_OFFSET` environment variable must be valid unicode"
135135
),
136-
Ok(s) => s.parse().expect(&format!(
137-
"The `BOOTLOADER_PHYSICAL_MEMORY_OFFSET` environment variable must be an\
138-
integer (is `{}`).",
136+
Ok(s) => if s.starts_with("0x") {
137+
u64::from_str_radix(&s[2..], 16)
138+
} else {
139+
u64::from_str_radix(&s, 10)
140+
}
141+
.expect(&format!(
142+
"The `BOOTLOADER_PHYSICAL_MEMORY_OFFSET` environment variable must be an integer\
143+
(is `{}`).",
139144
s
140145
)),
141146
};

0 commit comments

Comments
 (0)