diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2012-10-23 09:04:57 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2012-10-23 16:06:50 +0400 |
commit | e03d9ecba5eec971170690e2065332decfd1d4b5 (patch) | |
tree | e6252acb78f43e58b37e46cb3cd8762dca913c8d /typd_mlc.c | |
parent | c7ddccb3cf540d0345fe79ef15ec6da987c8d786 (diff) | |
download | bdwgc-e03d9ecba5eec971170690e2065332decfd1d4b5.tar.gz |
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).
Diffstat (limited to 'typd_mlc.c')
-rw-r--r-- | typd_mlc.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -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(); } |