MrKevinWeiss
7a68fb0d5e
*Kconfig*: Remove dep-only Kconfig files
2024-03-26 14:54:22 +01:00
Benjamin Valentin
f5181732de
sys/fmt: don't include stdio_base.h
2024-02-09 15:31:21 +01:00
Teufelchen1
4a62b9ff31
tests: Slightly increase coverage of fmt unittests
2023-12-19 18:11:28 +01:00
bors[bot]
8c2a4b43b3
Merge #19027
...
19027: sys/fmt: optimize scn_u32_dec scn_u32_hex r=benpicco a=kfessel
### Contribution description
Improves the compilation result for `scn_u32_dec` `scn_u32_hex` especially on `cortex-m` reducing either stack usage and or code size.
This makes use of unsigned int overflow (slightly less better without doing that `hexn`).
See godbolt (original versions got an `o` attached, modified versions got `k`s) all functions are marked `_S_` defined to `static`
by assigning the global at end the compiled function can be changed (`deco deck hexo hexk hexkk hexn`)
this PR is `hexkk` and `deck`
### Testing procedure
run unit-test/test-fmt
```
<RIOT>/tests/unittests$ make tests-fmt
<RIOT>/tests/unittests$ make term
```
### Issues/PRs references
[godbolt](https://godbolt.org/z/MzT1zh4q1 )
Co-authored-by: Karl Fessel <karl.fessel@ovgu.de>
2023-02-17 20:09:53 +00:00
Karl Fessel
18a783d21c
sys/fmt: optimize scn_u32_dec scn_u32_hex
2023-02-17 16:20:19 +01:00
f31d5a93b5
sys/fmt: print()
: use fflush(); stdio_write()
vs. fwrite()
2023-02-07 22:42:43 +01:00
Benjamin Valentin
95e654f232
sys/fmt: add print_bytes_hex()
2022-11-15 22:05:42 +01:00
Marian Buschsieweke
4f9e35254a
sys/fmt: fix print() for native
2022-06-10 11:02:40 +02:00
Marian Buschsieweke
ceeb28fb69
sys/fmt: uncrustify
2022-06-03 09:10:15 +02:00
Marian Buschsieweke
68dcf27eab
sys/fmt: fix interaction with stdio
...
Use fwrite instead of write to not bypass caching stdio. Other fmt's
print function are too much of a footgun to use.
2022-06-03 09:10:15 +02:00
Karl Fessel
909ffc9d34
sys/fmt: include kernel_defines.h
2022-02-12 18:30:58 +01:00
61c62c2ed6
sys/fmt: make fmt_s32_dfp() string based
2021-11-22 14:11:01 +01:00
Marian Buschsieweke
00a8a8bd83
sys/fmt_table: fix infinite loop
2021-01-21 10:03:44 +01:00
Leandro Lanzieri
25917b1986
sys/fmt/Kconfig: make module available only for testing
2020-12-02 10:14:43 +01:00
Leandro Lanzieri
3ce7dc8f1d
sys/fmt: Add module to Kconfig
2020-11-06 15:57:58 +01:00
Bas Stottelaar
b32baa0f72
sys/*: remove unused assert.h include
2020-10-22 11:29:27 +02:00
Juergen Fitschen
aeb1230266
sys/fmt: add fmt_hex_bytes size probing
2020-05-12 17:39:25 +02:00
Hauke Petersen
ab3669294b
sys/fmt: add fmt_is_number()
2019-12-05 15:39:24 +01:00
Hauke Petersen
d9229af9d9
sys/fmt: move _is_digit and _is_upper to public API
2019-12-05 14:10:49 +01:00
d6356bdc08
Merge pull request #11692 from maribu/fmt_table
...
sys/fmt: Added submodule fmt_table for printing tables
2019-08-20 22:18:54 +02:00
Marian Buschsieweke
26d73116f6
sys/fmt: Added submodule fmt_table
...
print_col_u32_dec() / print_col_s32_dec() can be used to print an
uint32_t / int32_t as a column of the given width
2019-08-20 14:32:49 +02:00
Benjamin Valentin
e8dc1119b8
sys: make use of ARRAY_SIZE macro
2019-08-06 19:43:54 +02:00
3b76a2c2be
fmt: fix fmt_s32_dec() and fmt_s64_dec() sign bit handling
...
"val = -val" causes UB for INTMIN, thus explicitly cast to unsigned.
2019-01-16 15:23:19 +01:00
Vincent Dupont
695a94449a
fmt: add scn_u32_hex()
2018-10-03 10:44:14 +02:00
Vincent Dupont
8c5ffa0a8d
fmt: add fmt_char
2018-10-03 10:44:14 +02:00
Vincent Dupont
71455b692f
fmt: add fmt_to_lower()
2018-10-03 10:44:14 +02:00
Vincent Dupont
a542e954cf
fmt: add fmt_u16_hex()
2018-10-03 10:44:03 +02:00
Toon Stegen
3a69e0fa98
sys/fmt: remove useless assignment
2018-08-20 16:19:30 +02:00
Toon Stegen
9f90f31291
sys/fmt: add function for converting hex byte
2018-08-20 16:19:30 +02:00
1778dbde85
fmt: Add fmt_strnlen function
2018-06-14 11:57:11 +02:00
Hauke Petersen
78df885fc7
sys/fmt: use also positive scaling for s32_dfp
2018-04-06 11:58:43 +02:00
Joakim Nohlgård
9fe024b87e
fmt: Adjust stack allocated buffer, add comments
...
Adjusted buffer size for u64 case to fit the largest 64 bit decimal
number, added comments on all decimal buffers to explain which number
will fit.
2018-02-07 10:21:22 +01:00
Joakim Nohlgård
5ec44c82ba
fmt: Add fmt_s64_dec, print_s64_dec
2018-02-06 11:04:42 +01:00
2d02bc0394
sys/fmt: add new byte to hex converters:
...
- fmt_bytes_hex: converts an array of bytes to an array of hex bytes
- fmt_hex_bytes: convert an array of hex bytes to an array of bytes
2018-01-10 21:30:39 +01:00
Vincent Dupont
43a902b1ab
sys/fmt: fix overflow in fmt_u32_dec()
...
If the value was 10 digits long it caused an overflow in the multiply loop.
The case is now tested before looping over.
2017-12-07 17:48:05 -08:00
smlng
65a230d1f1
sys,fmt: simplify fmt_s16_dfp
...
- allow formating of val=12345 with fp_digits=6 as 0.012345
- use assert instead of explicit if
- remove unused pwr function
2017-09-28 15:44:35 +02:00
Joakim Nohlgård
301a5d8e70
fmt: Remove unused pwr function
2017-09-20 10:49:00 +02:00
Joakim Nohlgård
1e43bd4211
sys/fmt: Small optimizations
2017-09-06 21:29:40 +02:00
smlng
f3e8c8c82c
fmt: add signed 32 bit float point formating
2017-08-15 12:31:07 +02:00
Joakim Nohlgård
084db19107
sys/fmt: Fix unintentional pointer advancement for negative numbers in fmt_float
2017-06-21 18:28:11 +02:00
da519a3abc
sys: fmt: add fmt_float() and print_float()
2017-05-20 14:47:29 +02:00
eb5ff902fa
sys: fmt: fix fmt_lpad() documentation and (str==NULL) case
2017-03-28 16:07:30 +02:00
003b71b323
sys: fmt: add fmt_lpad()
2017-03-27 17:44:51 +02:00
Neil Jones
e3c8386d12
sys: fmt: include stdio.h for mips.
2017-02-09 12:25:52 +00:00
Martine Lenders
0cd2b746cc
fmt: add print_byte_hex() helper
2017-02-03 15:16:53 +01:00
5923f6b137
sys: fmt: add fmt_u64_dec()
2016-06-02 10:40:19 +02:00
Hauke Petersen
95d26d3b94
sys/fmt: added format for fixed floating points
2016-03-29 15:23:04 +02:00
2567feebf2
sys: fmt: fix includes
2016-02-28 22:46:28 +01:00
8c6f373b98
sys: fmt: fix converting "0" in fmt_u32_dec()
2015-12-07 16:42:39 +01:00
157f8c93ad
sys: fmt: add workaround for AVR libc's missing write()
2015-11-26 20:41:36 +01:00