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:

```
=> setexpr i 0xf; while test ${i} -gt 0; do echo $i; setexpr i ${i} - 1; done
=> 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
=>
```

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örg Krause

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to