From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BB59C07E95 for ; Tue, 20 Jul 2021 19:28:48 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 532FA6101E for ; Tue, 20 Jul 2021 19:28:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 532FA6101E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CD2E282DB0; Tue, 20 Jul 2021 21:28:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="GeqIV9Kd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DD50982DB0; Tue, 20 Jul 2021 21:28:42 +0200 (CEST) Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B2F4382C61 for ; Tue, 20 Jul 2021 21:28:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf2e.google.com with SMTP id o9so10646986qvu.5 for ; Tue, 20 Jul 2021 12:28:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=oZz/mKi1aRAoWgYPrxgaD/frIkpBQpXAbKVccIH1GYo=; b=GeqIV9KdLdVfnZ2he5y2WWRCvq9NkW4zRyZ82oirITrFfVAYn4sQ8YKHDAqTFEF6PK blPgwZyYc9NM/rwdy7622c62U6yk7u2fQj82XfjZkqv71C4ZDdz9IgcMmY+r/xy6W7Nz WL0CPDiOowv3Wxse5G3RFuPtKYaq4ta614EmM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=oZz/mKi1aRAoWgYPrxgaD/frIkpBQpXAbKVccIH1GYo=; b=aCSlW1Vubva4VeuPVTVLSkJveIAE1wXmgQf4yp2jNyhxIs7OSOtuBMC8o0goW4RlHO KWvoxNFvXdqBUyuHn/IxVDZo+lH422V5eFC7bDOPhQN1dGlRkXt0m2XeoC9Ukeedyob6 eJ1IiT+B2JEv4bMnOhcT+1RrVJjIDlnUabCdBptLvDcBmtdIn+EePN3mGKtzSFMz9QWs uPKsmtZz4dmrbFgdcRWNT2lqU5wWc0dExWzdOEgz/hKxWC+e88flruCTvCZ8kYXczYph G8SfdrdQdNQsV4YL+7V7X8eJ3JHog5rWAJQbcamf5/8NGs2nWC2HJt1mA9gBX/5GK0oS vapA== X-Gm-Message-State: AOAM530y0PhvhzwrAugSP51uM4Ly10Y+eemwfvnxlU/FszFs6AIGa87f C16MudbM36YvXicMJJnkn1cabg== X-Google-Smtp-Source: ABdhPJycLQ9G4ldw2Rgvp0SdxB7IhLVYF+kisV2RJ2i5I7LOJepHA1dHVqS6IIUNlIwFDyP29aXz3w== X-Received: by 2002:a05:6214:ca5:: with SMTP id s5mr31969209qvs.58.1626809316388; Tue, 20 Jul 2021 12:28:36 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-9c8c-8f20-851e-7861.res6.spectrum.com. [2603:6081:7b01:cbda:9c8c:8f20:851e:7861]) by smtp.gmail.com with ESMTPSA id o2sm7965435qkm.109.2021.07.20.12.28.34 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Jul 2021 12:28:35 -0700 (PDT) Date: Tue, 20 Jul 2021 15:28:32 -0400 From: Tom Rini To: Simon Glass Cc: U-Boot Mailing List , Eugeniu Rosca , Roland Gaudig , Heinrich Schuchardt , Stefan Herbrechtsmeier , Sean Anderson , Marek =?iso-8859-1?Q?Beh=FAn?= , Marek Vasut , Joe Hershberger Subject: Re: [PATCH 00/15] lib: Add support for a decimal 0m prefix for numbers Message-ID: <20210720192832.GO9379@bill-the-cat> References: <20210720132940.1171011-1-sjg@chromium.org> <20210720142218.GI9379@bill-the-cat> <20210720160547.GM9379@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="NffpD3bBbNaSNdk0" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean --NffpD3bBbNaSNdk0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 20, 2021 at 12:33:14PM -0600, Simon Glass wrote: > Hi Tom. >=20 > On Tue, 20 Jul 2021 at 10:05, Tom Rini wrote: > > > > On Tue, Jul 20, 2021 at 09:57:55AM -0600, Simon Glass wrote: > > > Hi Tom, > > > > > > On Tue, 20 Jul 2021 at 08:22, Tom Rini wrote: > > > > > > > > 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 conven= ient 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 nu= mber. The > > > > > > > > I _really_ don't want to invent something here. When the setexpr t= hread > > > > came up before I went and did a little digging. Per > > > > https://en.wikipedia.org/wiki/Radix the general way to express a nu= mber > > > > 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 u= se > > > > and didn't bring it up at the time. > > > > > > Well I don't want to invent something either...but what to do? > > > > > > So for example (10)123 would mean decimal 123? I don't know how we > > > would parse brackets separately from expressions though. > > > > (123)10 would be "123" in decimal. Which is indeed a mouthful. But it > > would also be generic and (123)16 would be 0x123. So the parsing > > shouldn't be too hard, for most commands. But then yes, expressions > > become quite hard. > > > > > > If we're going to add some global way to always say a number is dec= imal, > > > > 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 partit= ion > > > > 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. > > > > > > Can you give examples for what you are thinking for radix notation? > > > > Well, since we don't have subscript in shell, '(number)base' would how > > it would be. Which I'm not convinced is better than making it clear to > > users that almost everything is hex input, including a few places that > > might surprise you such as partition numbers. >=20 > After a bit of thought and digging, I think that is a mathematical > thing and confusing/unworkable on the command line. I agree. > Should we consider 0t for decimal? My biggest concern is that when I search for "0t prefix" the first relevant answers are the MS links where 0t is for ocTal, and not the other examples where it's decimal (base Ten, I assume). --=20 Tom --NffpD3bBbNaSNdk0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmD3I9wACgkQFHw5/5Y0 tyxMgAwAoOtS3Nco79Mw3vUYx5teh7QJhAo6l5vVTeuFft9p34FFqOgTuPs6sQ5r lLxgyQbVmP77h4je2tbBrhgi83GPH12xJr6b3XBqYb1ZuaZKLeLeRQeBHf1QSExD BOcXfq8ti5WIEtNAS3027pw+kg3Zkl1I4GYiW+BXBCa+9tCV6vIm+J9df7VA8pKG u5f5f6I+CBPN/FHTOhDOmRpb8YBWtewOxMYf0eXzPwKQlCaNHYWCIyJuZgvIU2XP APhGjcoqrJvb+p5ljoTqU8PluBh3Y2HNoRY2j7OUGRwcK04Y4QMJFpHIuh6E0cDV RhuBKD1yfF5T5jP6fC6sPgmSFTPxqm7lCfbiOkMkcdC2h3zx2FUFQP6HP9/Jv20Z 8Zr/d5dW75O+wL0iF7KbpDGWOnpVdz980UAMGUCSfIkO03O5MWphATks8KO36ZwX ANCut5A77CGPOqphfNRQHrYE4GWT+q1DdxryTYSXAgm1oDQOPOSqKf366zOIRipD rnhi7uhg =MlVZ -----END PGP SIGNATURE----- --NffpD3bBbNaSNdk0--