mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
lib: Allow using 0x when a decimal value is requested
U-Boot mostly uses hex for value input, largely because addresses are much easier to understand in hex. But in some cases a decimal value is requested, such as where the value is small or hex does not make sense in the context. In these cases it is sometimes useful to be able to provide a hex value in any case, if only to resolve any ambiguity. Add this functionality, for increased flexibility. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
5f4b356121
commit
e6951139c0
4 changed files with 37 additions and 17 deletions
|
@ -89,7 +89,7 @@ static int str_simple_strtoul(struct unit_test_state *uts)
|
|||
ut_assertok(run_strtoul(uts, str2, 10, 1099, 4, upper));
|
||||
ut_assertok(run_strtoul(uts, str2, 16, 0x1099ab, 6, upper));
|
||||
ut_assertok(run_strtoul(uts, str3, 16, 0xb, 3, upper));
|
||||
ut_assertok(run_strtoul(uts, str3, 10, 0, 1, upper));
|
||||
ut_assertok(run_strtoul(uts, str3, 10, 0xb, 3, upper));
|
||||
|
||||
/* Octal */
|
||||
ut_assertok(run_strtoul(uts, str6, 0, 63, 3, upper));
|
||||
|
@ -144,7 +144,7 @@ static int str_simple_strtoull(struct unit_test_state *uts)
|
|||
ut_assertok(run_strtoull(uts, str2, 10, 1099, 4, upper));
|
||||
ut_assertok(run_strtoull(uts, str2, 16, 0x1099ab, 6, upper));
|
||||
ut_assertok(run_strtoull(uts, str3, 16, 0xb, 3, upper));
|
||||
ut_assertok(run_strtoull(uts, str3, 10, 0, 1, upper));
|
||||
ut_assertok(run_strtoull(uts, str3, 10, 0xb, 3, upper));
|
||||
|
||||
/* Octal */
|
||||
ut_assertok(run_strtoull(uts, str6, 0, 63, 3, upper));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue