From 6c5d6e1f721cd3eb369b93e4a1931d180a55a873 Mon Sep 17 00:00:00 2001 From: Daan Date: Fri, 10 May 2024 17:24:52 -0700 Subject: [PATCH] fix max allocation size on 32-bit systems (issue #882) --- include/mimalloc/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mimalloc/types.h b/include/mimalloc/types.h index 97438569..e2b9ce38 100644 --- a/include/mimalloc/types.h +++ b/include/mimalloc/types.h @@ -214,7 +214,7 @@ typedef int32_t mi_ssize_t; // we never allocate more than PTRDIFF_MAX (see also ) // on 64-bit+ systems we also limit the maximum allocation size such that the slice count fits in 32-bits. (issue #877) -#if PTRDIFF_MAX >= (MI_SEGMENT_SLIZE_SIZE * UINT32_MAX) +#if (PTRDIFF_MAX > INT32_MAX) && (PTRDIFF_MAX >= (MI_SEGMENT_SLIZE_SIZE * UINT32_MAX)) #define MI_MAX_ALLOC_SIZE (MI_SEGMENT_SLICE_SIZE * (UINT32_MAX-1)) #else #define MI_MAX_ALLOC_SIZE PTRDIFF_MAX