diff --git a/README.md b/README.md index 2787c39..d4ee148 100644 --- a/README.md +++ b/README.md @@ -258,7 +258,7 @@ Notes: * The `L` modifier, for `long double`, is not currently supported. * A `"%zd"` or `"%zi"` takes a signed integer of the same size as `size_t`. -* The implementation currently assumes each of `intmax_t`, signed `size_t`, and `ptrdiff_t` has the same size as `long int` or as `long long int`. If this is not the case for your platform, please open an issue. +* The implementation currently assumes `intmax_t` and `ptrdiff_t` each has the same size as either `long int` or `long long int`. If this is not the case for your platform, please open an issue. * The `Ixx` length modifiers are not in the C (nor C++) standard, but are somewhat popular, as it makes it easier to handle integer types of specific size. One must specify the argument size in bits immediately after the `I`. The printing is "integer-promotion-safe", i.e. the fact that an `int8_t` may actually be passed in promoted into a larger `int` will not prevent it from being printed using its original value. ### Return Value diff --git a/src/printf/printf.c b/src/printf/printf.c index 863dfac..318211d 100644 --- a/src/printf/printf.c +++ b/src/printf/printf.c @@ -1186,7 +1186,7 @@ static inline void format_string_loop(output_gadget_t* output, const char* forma ADVANCE_IN_FORMAT_STRING(format); break; case 'z' : - flags |= (sizeof(size_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG); + flags |= (sizeof(size_t) <= sizeof(int) ) ? FLAGS_INT : (sizeof(size_t) == sizeof(long)) ? FLAGS_LONG : FLAGS_LONG_LONG; ADVANCE_IN_FORMAT_STRING(format); break; default: