diff options
| author | Ada Christine <adachristine18@gmail.com> | 2022-02-17 10:53:00 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2022-02-17 10:53:00 +0000 |
| commit | b8ef8b401d9dd1e15f2703eb997fb79a70ae531a (patch) | |
| tree | 54f3ecb9d871cd42ad8188b52bb96bb2e84321e5 | |
| parent | b9c58864298ebdf858248cfe79d972dbbe1a7331 (diff) | |
minor change to prevent potential weirdness with type width
| -rw-r--r-- | kc/core/kprint.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/kc/core/kprint.c b/kc/core/kprint.c index 6e73601..5d2fbdc 100644 --- a/kc/core/kprint.c +++ b/kc/core/kprint.c @@ -359,9 +359,23 @@ static int print_integer( char buffer[65] = {0}; char *s; bool negative = false; - uint64_t value = va_arg(*arguments, uint64_t); + uint64_t value = 0; int r = 0; + switch (spec->integer_width) + { + case BYTE_WIDTH: + case SHORT_WIDTH: + case INT_WIDTH: + value = va_arg(*arguments, unsigned int); + break; + case LONG_WIDTH: + value = va_arg(*arguments, uint64_t); + break; + default: + return -1; + } + // check if we need to bother with signs if (spec->flags & SIGNED_TYPE_FLAG) { |
