tools/nolibc: ensure fast64 integer types have 64 bits

On 32bit platforms size_t is not enough to represent [u]int_fast64_t.

Fixes: 3e9fd4e9a1 ("tools/nolibc: add integer types and integer limit macros")
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
Thomas Weißschuh 2023-05-30 11:18:00 +02:00 committed by Paul E. McKenney
parent ed495f0945
commit f9bf5944d3
2 changed files with 8 additions and 8 deletions

View File

@ -36,8 +36,8 @@ typedef ssize_t int_fast16_t;
typedef size_t uint_fast16_t; typedef size_t uint_fast16_t;
typedef ssize_t int_fast32_t; typedef ssize_t int_fast32_t;
typedef size_t uint_fast32_t; typedef size_t uint_fast32_t;
typedef ssize_t int_fast64_t; typedef int64_t int_fast64_t;
typedef size_t uint_fast64_t; typedef uint64_t uint_fast64_t;
typedef int64_t intmax_t; typedef int64_t intmax_t;
typedef uint64_t uintmax_t; typedef uint64_t uintmax_t;
@ -84,16 +84,16 @@ typedef uint64_t uintmax_t;
#define INT_FAST8_MIN INT8_MIN #define INT_FAST8_MIN INT8_MIN
#define INT_FAST16_MIN INTPTR_MIN #define INT_FAST16_MIN INTPTR_MIN
#define INT_FAST32_MIN INTPTR_MIN #define INT_FAST32_MIN INTPTR_MIN
#define INT_FAST64_MIN INTPTR_MIN #define INT_FAST64_MIN INT64_MIN
#define INT_FAST8_MAX INT8_MAX #define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MAX INTPTR_MAX #define INT_FAST16_MAX INTPTR_MAX
#define INT_FAST32_MAX INTPTR_MAX #define INT_FAST32_MAX INTPTR_MAX
#define INT_FAST64_MAX INTPTR_MAX #define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX #define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX SIZE_MAX #define UINT_FAST16_MAX SIZE_MAX
#define UINT_FAST32_MAX SIZE_MAX #define UINT_FAST32_MAX SIZE_MAX
#define UINT_FAST64_MAX SIZE_MAX #define UINT_FAST64_MAX UINT64_MAX
#endif /* _NOLIBC_STDINT_H */ #endif /* _NOLIBC_STDINT_H */

View File

@ -702,9 +702,9 @@ int run_stdlib(int min, int max)
CASE_TEST(limit_int_fast32_min); EXPECT_EQ(1, INT_FAST32_MIN, (int_fast32_t) INTPTR_MIN); break; CASE_TEST(limit_int_fast32_min); EXPECT_EQ(1, INT_FAST32_MIN, (int_fast32_t) INTPTR_MIN); break;
CASE_TEST(limit_int_fast32_max); EXPECT_EQ(1, INT_FAST32_MAX, (int_fast32_t) INTPTR_MAX); break; CASE_TEST(limit_int_fast32_max); EXPECT_EQ(1, INT_FAST32_MAX, (int_fast32_t) INTPTR_MAX); break;
CASE_TEST(limit_uint_fast32_max); EXPECT_EQ(1, UINT_FAST32_MAX, (uint_fast32_t) UINTPTR_MAX); break; CASE_TEST(limit_uint_fast32_max); EXPECT_EQ(1, UINT_FAST32_MAX, (uint_fast32_t) UINTPTR_MAX); break;
CASE_TEST(limit_int_fast64_min); EXPECT_EQ(1, INT_FAST64_MIN, (int_fast64_t) INTPTR_MIN); break; CASE_TEST(limit_int_fast64_min); EXPECT_EQ(1, INT_FAST64_MIN, (int_fast64_t) INT64_MIN); break;
CASE_TEST(limit_int_fast64_max); EXPECT_EQ(1, INT_FAST64_MAX, (int_fast64_t) INTPTR_MAX); break; CASE_TEST(limit_int_fast64_max); EXPECT_EQ(1, INT_FAST64_MAX, (int_fast64_t) INT64_MAX); break;
CASE_TEST(limit_uint_fast64_max); EXPECT_EQ(1, UINT_FAST64_MAX, (uint_fast64_t) UINTPTR_MAX); break; CASE_TEST(limit_uint_fast64_max); EXPECT_EQ(1, UINT_FAST64_MAX, (uint_fast64_t) UINT64_MAX); break;
#if __SIZEOF_LONG__ == 8 #if __SIZEOF_LONG__ == 8
CASE_TEST(limit_intptr_min); EXPECT_EQ(1, INTPTR_MIN, (intptr_t) 0x8000000000000000LL); break; CASE_TEST(limit_intptr_min); EXPECT_EQ(1, INTPTR_MIN, (intptr_t) 0x8000000000000000LL); break;
CASE_TEST(limit_intptr_max); EXPECT_EQ(1, INTPTR_MAX, (intptr_t) 0x7fffffffffffffffLL); break; CASE_TEST(limit_intptr_max); EXPECT_EQ(1, INTPTR_MAX, (intptr_t) 0x7fffffffffffffffLL); break;