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 9D840C07E9B for ; Tue, 20 Jul 2021 16:06:00 +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 DCB4E60233 for ; Tue, 20 Jul 2021 16:05:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCB4E60233 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 E3BCA82D22; Tue, 20 Jul 2021 18:05:57 +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="iQk9b4sm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5B4FC82D4B; Tue, 20 Jul 2021 18:05:55 +0200 (CEST) Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) (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 7AB4982C61 for ; Tue, 20 Jul 2021 18:05:51 +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-qt1-x82e.google.com with SMTP id g8so15699372qtj.1 for ; Tue, 20 Jul 2021 09:05:51 -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=JtDAUT12FysmPcOv+O68uBDo16jUU7kHCU/zNiiDXQs=; b=iQk9b4smCvdVLRBINSAZBLuv8VX2YuOeq/JG8DS8e9RwwPH7LBS4PBpPwRolzRnP9N SnDzbDc59hNkmudyDdJdRshcOOFqy2pZy0EZdlhA1xBZU5LoHojocFE2v6OZzHkg91sN 1QiVPfw6UXVcahfntQ3qNR8jndIp6mbUQ2rJ8= 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=JtDAUT12FysmPcOv+O68uBDo16jUU7kHCU/zNiiDXQs=; b=s2hkSMDk6lG6X53s/R3pb2e3f0kYPCCszPzMOaqXMeIZUuKFuRbFtRtLFcugF9d+xH pM+4I1Ro1l/183v2zwBTNobPgKBGj2cMKcl+Q5gfttwM4Unqxhx9eSpTBD+NRovFo+qy uTd8jXEZU2qplpD1S4lPy+Mp+0BwnaeiE1X1RqKJRvVuk1ACPII73NdRFqD3tRXqkjgS nP2NS3eGJtKEQl68y7us2g945uFzRQD1KSVBScNcscLOEmm8sKTZjZ1jfMUQr92RJ3R6 74ZDH6zWd67K79abAN5fyVNOWTfpwmfX2o/Hdx1WCh9s/cB0Gmtmgobl+2sTfc0JmGJV Skkw== X-Gm-Message-State: AOAM533FqKMscgd4hKBlc9+3WzOA8Xp1U+UAbT9Fhbts+5tLlArOB+tu CrVp4FjFTS56vbECRN/kWcRdBA== X-Google-Smtp-Source: ABdhPJwLQEMEWHt3XsS+aRRIXD6VjZbYLJdFUnJKSfmc++OJquh9AOMocW+iDobb7YUd6x7rRN/P4Q== X-Received: by 2002:ac8:5490:: with SMTP id h16mr15008209qtq.217.1626797150102; Tue, 20 Jul 2021 09:05:50 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-64f9-b69d-b720-c9f2.res6.spectrum.com. [2603:6081:7b01:cbda:64f9:b69d:b720:c9f2]) by smtp.gmail.com with ESMTPSA id b15sm2558062qtt.9.2021.07.20.09.05.49 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Jul 2021 09:05:49 -0700 (PDT) Date: Tue, 20 Jul 2021 12:05:47 -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: <20210720160547.GM9379@bill-the-cat> References: <20210720132940.1171011-1-sjg@chromium.org> <20210720142218.GI9379@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="YOUJ+9SC2P4ELYXZ" 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 --YOUJ+9SC2P4ELYXZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 20, 2021 at 09:57:55AM -0600, Simon Glass wrote: > Hi Tom, >=20 > 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 convenient= to > > > provide a decimal value. This may be because the value comes from ano= ther > > > source, where its base cannot be controlled. > > > > > > This series adds support for a 0m prefix to indicate a decimal number= =2E 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. >=20 > Well I don't want to invent something either...but what to do? >=20 > 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 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. >=20 > 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. > BTW, quite a bit of the series is a clean-up, so can be reviewed separate= ly. OK. --=20 Tom --YOUJ+9SC2P4ELYXZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmD29FgACgkQFHw5/5Y0 tywnJAv/anpsQ8vSNkcjgcoGMLHetEah9WPgm05DGRxdnjSkTOPbU4ff+RjG66Eg x4S26hxl76Ki9hPDyHNLkpCuIHJaHoWf+Sad5yubs/+scb4NbxEaP3lWsW/RD2HK r0mgpRl+wwYd9ptAoGtRXdjuzZlSrUqXf3qAxaEmMbg31fA6mYe1sz6KPM8tBKgf 9Ag6zg/Y8qRnfwrC1/oQJXV1uuf1ur6yUm+svI8nWABqzS+SnefucSEPHeJOxikf ZNqhUu5NFQ17G1UQZZmNBCVcTXJuuGWQdqJnD9lD+UtrlF6QriSJ4ljO3qKuQzED 1Uq+ROtjgreRDLCM66w22t02OnmDlvu3C3elzyrN5rFWnZn+ZJo6pDp5OBjKptqT L8CrJOtvSKF/Kz9SGZlffSN4fHIuEwXq7sf25iHd5u2E+yiG1cSdQv+ZxXSVs4Zd LqiY8wGlB1VYME85jZeO+mPF2dxRFtjQZPyBwMm8Cwtny3NSC7GKk/5DbqgXZ6N5 L4la+9K9 =rhJQ -----END PGP SIGNATURE----- --YOUJ+9SC2P4ELYXZ--