This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][LTO] Bug fix for mask computation in lto_{get,set}_flags


Doug Kwan (???) wrote:

oops, so sorry.
Hi,

I am going to commit this trivial patch.

-Doug

2008-06-17 Doug Kwan <dougkwan@google.com>

        * lto-section-in.c (lto_get_flags): Fix bug in mask computation.
        * lto-section-out.c (lto_set_flags): Same.

ndex: gcc/gcc/lto-section-in.c
===================================================================
--- gcc/gcc/lto-section-in.c    (revision 136882)
+++ gcc/gcc/lto-section-in.c    (working copy)
@@ -70,7 +70,7 @@ lto_get_flag (unsigned HOST_WIDEST_INT *
 unsigned int
 lto_get_flags (unsigned HOST_WIDEST_INT *flags, unsigned int width)
 {
-  unsigned HOST_WIDEST_INT mask = 1 << (((unsigned HOST_WIDEST_INT)width) - 1);
+  unsigned HOST_WIDEST_INT mask = (((unsigned HOST_WIDEST_INT) 1) <<
width) - 1;
   unsigned int result = *flags & mask;
   *flags = *flags >> width;
   return result;
Index: gcc/gcc/lto-section-out.c
===================================================================
--- gcc/gcc/lto-section-out.c   (revision 136882)
+++ gcc/gcc/lto-section-out.c   (working copy)
@@ -68,7 +68,7 @@ lto_set_flag (unsigned HOST_WIDEST_INT *
 void
 lto_set_flags (unsigned HOST_WIDEST_INT *base, unsigned int flag,
unsigned int width)
 {
-  unsigned HOST_WIDEST_INT mask = 1 < (((unsigned HOST_WIDEST_INT)width) - 1);
+  unsigned HOST_WIDEST_INT mask = (((unsigned HOST_WIDEST_INT) 1) <<
width) - 1;

*base = *base << width;
*base |= (flag & mask);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]