zephyr/tests/unit/cbprintf
Nicolas Pitre 5a384b9ea8 lib/os/cbprintf_nano.c: avoid sign extension on unsigned formats
There might be a sign extension when a long is promoted to
int_value_type and the former type is smaller than the later.
This produces the wrong output if the specified format is unsigned.

Let's avoid this problem by handling signed and unsigned cases
explicitly. When the type already matches int_value_type then the
compiler is smart enough to recognize the redundancy and removes
unneeded duplications automatically, meaning that the code will stay
small when code size matters.

A similar issue also existed in the restricted %llu case.
The fix is the same as above.

Those fixes exposed wrong results in the printk.c test with %llx
so fix that as well.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-09-02 19:37:06 -04:00
..
CMakeLists.txt tests: unit: cbprintf: force libc substitutes in test case 2021-02-23 19:39:59 +01:00
main.c lib/os/cbprintf_nano.c: avoid sign extension on unsigned formats 2021-09-02 19:37:06 -04:00
testcase.yaml lib: os: cbprintf: Add support for conversion to fsc package 2021-07-27 14:50:45 +02:00