From: Ivan Maidanski Date: Wed, 21 Sep 2016 18:25:35 +0000 (+0300) Subject: Fix 'shift count >= width of type' compiler warning in GC_SQRT_SIZE_MAX X-Git-Tag: v8.0.0~1146 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b4eb5c14a7d540af1f79cfa59fdecc70204f32a3;p=gc Fix 'shift count >= width of type' compiler warning in GC_SQRT_SIZE_MAX (fix commits 83231d0, 4e1a6f9) * malloc.c (GC_SQRT_SIZE_MAX): Change type from unsigned to size_t. * typd_mlc.c (GC_SQRT_SIZE_MAX): Likewise. --- diff --git a/malloc.c b/malloc.c index d6cb7abc..986e8d6f 100644 --- a/malloc.c +++ b/malloc.c @@ -423,7 +423,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_uncollectable(size_t lb) # define GC_SIZE_MAX (~(size_t)0) # endif -# define GC_SQRT_SIZE_MAX ((1U << (WORDSZ / 2)) - 1) +# define GC_SQRT_SIZE_MAX ((((size_t)1) << (WORDSZ / 2)) - 1) void * calloc(size_t n, size_t lb) { diff --git a/typd_mlc.c b/typd_mlc.c index 5cfde351..d7a2bc46 100644 --- a/typd_mlc.c +++ b/typd_mlc.c @@ -634,7 +634,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL # define GC_SIZE_MAX (~(size_t)0) #endif -#define GC_SQRT_SIZE_MAX ((1U << (WORDSZ / 2)) - 1) +#define GC_SQRT_SIZE_MAX ((((size_t)1) << (WORDSZ / 2)) - 1) GC_API GC_ATTR_MALLOC void * GC_CALL GC_calloc_explicitly_typed(size_t n, size_t lb, GC_descr d)