Skip to content

Commit

Permalink
lib/os/cbprintf_nano.c: several improvements
Browse files Browse the repository at this point in the history
This makes cbprintf_nano.c much closer to the standard printf and
therefore more useful. The following are now implemented:

- right justification for everything (only for numbers previously)
- precision value for numbers, chars and strings
- width/precision passed as arguments with *
- "unlimited" padding length
- lower/uppercase hex output
- the #, + and ' ' flags are supported

And the code was heavily reworked to reduce its size as much as
possible to mitigate the size growth. Still, the binary resulting
from cbprintf_nano.c is now between 10% and 20% bigger depending on
the architecture. This is still far smaller than cbprintf_complete.c
which remains about twice as big on average even without FP support.

Many unit tests that were skipped with CONFIG_CBPRINTF_NANO are now
enabled, and a few more were added for good measure.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
  • Loading branch information
Nicolas Pitre authored and carlescufi committed Feb 23, 2021
1 parent 99425de commit fb73ac3
Show file tree
Hide file tree
Showing 3 changed files with 284 additions and 309 deletions.
Loading

0 comments on commit fb73ac3

Please sign in to comment.