diff options
-rw-r--r-- | config/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/nvim/charset.c | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index aab4b5c23d..a46f686d7c 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -5,6 +5,7 @@ include(CheckIncludeFiles) check_type_size("int" SIZEOF_INT) check_type_size("long" SIZEOF_LONG) +check_type_size("intmax_t" SIZEOF_INTMAX_T) check_type_size("off_t" SIZEOF_OFF_T) check_type_size("void *" SIZEOF_VOID_PTR) diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 8781e389ed..7356d91ac2 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1695,7 +1695,9 @@ intmax_t getdigits(char_u **pp) int getdigits_int(char_u **pp) { intmax_t number = getdigits(pp); +#if SIZEOF_INTMAX_T > SIZEOF_INT assert(number >= INT_MIN && number <= INT_MAX); +#endif return (int)number; } @@ -1705,7 +1707,9 @@ int getdigits_int(char_u **pp) long getdigits_long(char_u **pp) { intmax_t number = getdigits(pp); +#if SIZEOF_INTMAX_T > SIZEOF_LONG assert(number >= LONG_MIN && number <= LONG_MAX); +#endif return (long)number; } |