[PATCH 00/15] lib: Add support for a decimal 0m prefix for numbers

Tom Rini trini at konsulko.com
Tue Jul 20 16:22:18 CEST 2021


On Tue, Jul 20, 2021 at 07:29:24AM -0600, Simon Glass wrote:

> U-Boot mostly uses hex for value input, largely because addresses are much
> easier to understand in hex.
> 
> But in some cases a hex value is requested, but it is more convenient to
> provide a decimal value. This may be because the value comes from another
> source, where its base cannot be controlled.
> 
> This series adds support for a 0m prefix to indicate a decimal number. The

I _really_ don't want to invent something here.  When the setexpr thread
came up before I went and did a little digging.  Per
https://en.wikipedia.org/wiki/Radix the general way to express a number
is (x)y where x is the number and y is the base (and y is in base10, and
also a subscript).  I thought it was a bit cumbersome for general use
and didn't bring it up at the time.

If we're going to add some global way to always say a number is decimal,
and I'm not sure I think that's a good idea even (I kind of think it
might be better on a case by case basis to maybe tweak some prints so
that for example "ls mmc 0:10" tells the user it's accessing partition
16 would lead to a quick "oh that's hex, #$%@!"), I think it should
follow the radix notation, or if not, some other well known example.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210720/bcc40356/attachment.sig>


More information about the U-Boot mailing list