sys: fmt: use standard / for division by 10, not div.h
This commit is contained in:
parent
4ad2689144
commit
f2a2656bac
@ -21,7 +21,6 @@
|
|||||||
/* work around broken sys/posix/unistd.h */
|
/* work around broken sys/posix/unistd.h */
|
||||||
ssize_t write(int fildes, const void *buf, size_t nbyte);
|
ssize_t write(int fildes, const void *buf, size_t nbyte);
|
||||||
|
|
||||||
#include "div.h"
|
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
|
|
||||||
static const char _hex_chars[16] = "0123456789ABCDEF";
|
static const char _hex_chars[16] = "0123456789ABCDEF";
|
||||||
@ -89,14 +88,14 @@ size_t fmt_u32_dec(char *out, uint32_t val)
|
|||||||
|
|
||||||
/* count needed characters */
|
/* count needed characters */
|
||||||
for (uint32_t tmp = val; (tmp > 9); len++) {
|
for (uint32_t tmp = val; (tmp > 9); len++) {
|
||||||
tmp = div_u32_by_10(tmp);
|
tmp /= 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out) {
|
if (out) {
|
||||||
char *ptr = out + len;
|
char *ptr = out + len;
|
||||||
while(val) {
|
while(val) {
|
||||||
*--ptr = div_u32_mod_10(val) + '0';
|
*--ptr = (val % 10) + '0';
|
||||||
val = div_u32_by_10(val);
|
val /= 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user