Skip to content

Commit

Permalink
Improve the casting of the types
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Aug 30, 2024
1 parent 7d44197 commit 1f95386
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lwprintf/src/lwprintf/lwprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,11 +909,11 @@ prv_format(lwprintf_int_t* lwi, va_list arg) {
} else if (lwi->m.flags.umax_t) {
prv_longest_unsigned_int_to_str(lwi, (uint_maxtype_t)va_arg(arg, uintmax_t));
} else if (lwi->m.flags.longlong == 0 || lwi->m.base == 2) {
uint_maxtype_t v;
uint_maxtype_t v = va_arg(arg, unsigned int);
switch (lwi->m.flags.char_short) {
case 2: v = (uint_maxtype_t)va_arg(arg, unsigned int); break;
case 1: v = (uint_maxtype_t)va_arg(arg, unsigned int); break;
default: v = (uint_maxtype_t)va_arg(arg, unsigned int); break;
case 2: v = (uint_maxtype_t)((unsigned char)v); break;
case 1: v = (uint_maxtype_t)((unsigned short int)v); break;
default: v = (uint_maxtype_t)((unsigned int)v); break;
}
prv_longest_unsigned_int_to_str(lwi, v);
} else if (lwi->m.flags.longlong == 1) {
Expand Down

0 comments on commit 1f95386

Please sign in to comment.