OSDN Git Service

2006-12-05 H.J. Lu <hongjiu.lu@intel.com>
[pf3gnuchains/gcc-fork.git] / gcc / sbitmap.h
index fe23cbf..21c6974 100644 (file)
@@ -15,8 +15,8 @@ for more details.
 
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.  */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
 
 #ifndef GCC_SBITMAP_H
 #define GCC_SBITMAP_H
@@ -66,7 +66,7 @@ typedef struct {
   /* The current word index.  */
   unsigned int word_num;
 
-  /* The current bit index.  */
+  /* The current bit index (not modulo SBITMAP_ELT_BITS).  */
   unsigned int bit_num;
 
   /* The words currently visited.  */
@@ -80,14 +80,15 @@ static inline void
 sbitmap_iter_init (sbitmap_iterator *i, sbitmap bmp, unsigned int min)
 {
   i->word_num = min / (unsigned int) SBITMAP_ELT_BITS;
-  i->bit_num = min % (unsigned int) SBITMAP_ELT_BITS;
+  i->bit_num = min;
   i->size = bmp->size;
   i->ptr = bmp->elms;
 
   if (i->word_num >= i->size)
     i->word = 0;
   else
-    i->word = i->ptr[i->word_num] >> i->bit_num;
+    i->word = (i->ptr[i->word_num]
+              >> (i->bit_num % (unsigned int) SBITMAP_ELT_BITS));
 }
 
 /* Return true if we have more bits to visit, in which case *N is set