From e03d9ecba5eec971170690e2065332decfd1d4b5 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 23 Oct 2012 09:04:57 +0400 Subject: [PATCH] Eliminate warning and simplify expression in GC_init_explicit_typing * typd_mlc.c (GC_init_explicit_typing): Cast -1 argument of WORDS_TO_BYTES() to word (instead of casting its result) to avoid "overflow in signed shift operation" warning (issued by some static code analysis tools). * typd_mlc.c (GC_init_explicit_typing): Simplify expression for computing GC_bm_table elements (remove redundant right shift of unsigned -1 before left shift for the same amount of bits). --- typd_mlc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/typd_mlc.c b/typd_mlc.c index 827cc4f3..e1d3b2ab 100644 --- a/typd_mlc.c +++ b/typd_mlc.c @@ -361,7 +361,7 @@ STATIC void GC_init_explicit_typing(void) GC_eobjfreelist = (ptr_t *)GC_new_free_list_inner(); GC_explicit_kind = GC_new_kind_inner( (void **)GC_eobjfreelist, - (((word)WORDS_TO_BYTES(-1)) | GC_DS_PER_OBJECT), + (WORDS_TO_BYTES((word)-1) | GC_DS_PER_OBJECT), TRUE, TRUE); /* Descriptors are in the last word of the object. */ GC_typed_mark_proc_index = GC_new_proc_inner(GC_typed_mark_proc); @@ -373,9 +373,7 @@ STATIC void GC_init_explicit_typing(void) GC_MAKE_PROC(GC_array_mark_proc_index, 0), FALSE, TRUE); for (i = 0; i < WORDSZ/2; i++) { - GC_descr d = (((word)(-1)) >> (WORDSZ - i)) << (WORDSZ - i); - d |= GC_DS_BITMAP; - GC_bm_table[i] = d; + GC_bm_table[i] = (((word)-1) << (WORDSZ - i)) | GC_DS_BITMAP; } UNLOCK(); } -- 2.40.0