]> granicus.if.org Git - gc/commitdiff
Fix 'shift count >= width of type' compiler warning in GC_SQRT_SIZE_MAX
authorIvan Maidanski <ivmai@mail.ru>
Wed, 21 Sep 2016 18:25:35 +0000 (21:25 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 21 Sep 2016 18:25:35 +0000 (21:25 +0300)
(fix commits 83231d04e1a6f9)

* malloc.c (GC_SQRT_SIZE_MAX): Change type from unsigned to size_t.
* typd_mlc.c (GC_SQRT_SIZE_MAX): Likewise.

malloc.c
typd_mlc.c

index d6cb7abc0fe9e23721ecdc7c873a80726f8a6bff..986e8d6f667a101860f0cc9b34315b07c14ab89e 100644 (file)
--- 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)
   {
index 5cfde351a640662cb4caab431833a927b3f65257..d7a2bc46d96aabbb64a9bb3f876b49902c4c1028 100644 (file)
@@ -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)