diff --git a/libs/libc/stdio/lib_libvsprintf.c b/libs/libc/stdio/lib_libvsprintf.c index c331d815692a1..3df402d7e98f6 100644 --- a/libs/libc/stdio/lib_libvsprintf.c +++ b/libs/libc/stdio/lib_libvsprintf.c @@ -1018,7 +1018,11 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream, flags &= ~(FL_NEGATIVE | FL_ALT); if (x < 0) { - x = -x; +#ifndef CONFIG_HAVE_LONG_LONG + x = -(unsigned long)x; +#else + x = -(unsigned long long)x; +#endif flags |= FL_NEGATIVE; }