From: =?ISO-8859-1?Q?J=F6rg?= Krause Date: Sat, 19 Jan 2019 23:05:24 +0100 Subject: [U-Boot] test vs itest command confusion when using setexpr Message-ID: <8ab1880deb1ea07aba31ed51b366edb0f00b23c0.camel@embedded.rocks> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de Hi, I noticed a difference between the `test` and the `itest` command when using `setexpr`: Running the test vs the itest command in the shell: ``` =3D> setexpr i 0xf; while test ${i} -gt 0; do echo $i; setexpr i ${i} - 1; = done =3D> setexpr i 0xf; while itest ${i} -gt 0; do echo $i; setexpr i ${i} - 1;= done f e d c b a 9 8 7 6 5 4 3 2 1 =3D> ``` The difference between the test and the itest command is that the integer operations for the test command is done using the base of 10 while for the itest command the operations are done using a base of 16. lib/test.c ``` simple_strtol(ap[0], NULL, 10) > simple_strtol(ap[2], NULL, 10); ``` lib/itest.c ``` simple_strtol(s, NULL, 16) > simple_strtol(t, NULL, 16); ``` As setexpr stores the variables as hex values, it becomes obvious why `itest` works, but `test` does not. Is this different behaviour intended? Best regards J=C3=B6rg Krause