static int format_decode(const char *fmt, struct printf_spec *spec)
 {
        const char *start = fmt;
-       bool sign = false;
 
        /* we finished early by reading the field width */
        if (spec->type == FORMAT_TYPE_WITDH) {
 
        case 'd':
        case 'i':
-               sign = true;
+               spec->flags |= SIGN;
        case 'u':
                break;
 
        if (spec->qualifier == 'L')
                spec->type = FORMAT_TYPE_LONG_LONG;
        else if (spec->qualifier == 'l') {
-               if (sign)
+               if (spec->flags & SIGN)
                        spec->type = FORMAT_TYPE_LONG;
                else
                        spec->type = FORMAT_TYPE_ULONG;
        } else if (spec->qualifier == 't') {
                spec->type = FORMAT_TYPE_PTRDIFF;
        } else if (spec->qualifier == 'h') {
-               if (sign)
+               if (spec->flags & SIGN)
                        spec->type = FORMAT_TYPE_SHORT;
                else
                        spec->type = FORMAT_TYPE_USHORT;
        } else {
-               if (sign)
+               if (spec->flags & SIGN)
                        spec->type = FORMAT_TYPE_INT;
                else
                        spec->type = FORMAT_TYPE_UINT;
                        case FORMAT_TYPE_SHORT:
                                num = (short) va_arg(args, int);
                                break;
-                       case FORMAT_TYPE_UINT:
-                               num = va_arg(args, unsigned int);
+                       case FORMAT_TYPE_INT:
+                               num = (int) va_arg(args, int);
                                break;
                        default:
                                num = va_arg(args, unsigned int);