[PATCH v1 1/1] cmd: setexpr: add dec operation for converting variable to decimal

Tom Rini trini at konsulko.com
Fri Jun 25 14:57:46 CEST 2021


On Wed, Jun 23, 2021 at 08:08:50AM +0200, Wolfgang Denk wrote:
> Dear Simon,
> 
> In message <CAPnjgZ13=2SCsZC1Y+m-HZOiBhpGiEFe2dRWwK9sAZHutgaO7Q at mail.gmail.com> you wrote:
> >
> > >  > 0m123 ? ('m' for deciMal).
> > >
> > > Perhaps 0d123? Though I would prefer to remove many of the implicit
> > > assumptions of hex input.
> >
> > Right, we can't use 'd' because it is valid hex.
> >
> > I believe hex is the right default. We just need an easy way to use decimal.
> 
> Maybe we should make this more general and support an even wirder
> range of formats?  Instead of just converting to decimal, we could
> pass a format string for sprintf() ?
> 
> Like:
> 
> 	# setexpr foo fmt %d $value

I like this idea as well.

-- 
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/20210625/9fd1adf8/attachment.sig>


More information about the U-Boot mailing list