Skip to content

Commit

Permalink
fmt: Adjust stack allocated buffer, add comments
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Joakim Nohlgård committed Feb 7, 2018
1 parent 47bbeb8 commit 9fe024b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sys/fmt/fmt.c
Expand Up @@ -414,14 +414,14 @@ void print(const char *s, size_t n)

void print_u32_dec(uint32_t val)
{
char buf[10];
char buf[10]; /* "4294967295" */
size_t len = fmt_u32_dec(buf, val);
print(buf, len);
}

void print_s32_dec(int32_t val)
{
char buf[11];
char buf[11]; /* "-2147483648" */
size_t len = fmt_s32_dec(buf, val);
print(buf, len);
}
Expand All @@ -448,7 +448,7 @@ void print_u64_hex(uint64_t val)

void print_u64_dec(uint64_t val)
{
char buf[18];
char buf[20]; /* "18446744073709551615" */
size_t len = fmt_u64_dec(buf, val);
print(buf, len);
}
Expand Down

0 comments on commit 9fe024b

Please sign in to comment.