/[bison]/bison/lib/bitset.h
ViewVC logotype

Diff of /bison/lib/bitset.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by akim, Tue Jul 2 13:51:26 2002 UTC revision 1.5 by eggert, Mon Aug 12 14:19:02 2002 UTC
# Line 107  static inline void bitset_set (bset, bit Line 107  static inline void bitset_set (bset, bit
107    bitset_windex offset = index - bset->b.cindex;    bitset_windex offset = index - bset->b.cindex;
108        
109    if (offset < bset->b.csize)    if (offset < bset->b.csize)
110      bset->b.cdata[offset] |= (1 << (bitno % BITSET_WORD_BITS));      bset->b.cdata[offset] |= ((bitset_word) 1 << (bitno % BITSET_WORD_BITS));
111    else    else
112      BITSET_SET_ (bset, bitno);      BITSET_SET_ (bset, bitno);
113  }  }
# Line 122  static inline void bitset_reset (bset, b Line 122  static inline void bitset_reset (bset, b
122    bitset_windex offset = index - bset->b.cindex;    bitset_windex offset = index - bset->b.cindex;
123        
124    if (offset < bset->b.csize)    if (offset < bset->b.csize)
125      bset->b.cdata[offset] &= ~(1 << (bitno % BITSET_WORD_BITS));      bset->b.cdata[offset] &= ~((bitset_word) 1 << (bitno % BITSET_WORD_BITS));
126    else    else
127      BITSET_RESET_ (bset, bitno);      BITSET_RESET_ (bset, bitno);
128  }  }
# Line 154  do                                                             \ Line 154  do                                                             \
154    bitset_windex _offset = _index - (bset)->b.cindex;            \    bitset_windex _offset = _index - (bset)->b.cindex;            \
155                                                                  \                                                                  \
156    if (_offset < (bset)->b.csize)                                        \    if (_offset < (bset)->b.csize)                                        \
157      (bset)->b.cdata[_offset] |= (1 << (_bitno % BITSET_WORD_BITS));     \      (bset)->b.cdata[_offset] |=                                 \
158          ((bitset_word) 1 << (_bitno % BITSET_WORD_BITS));         \
159    else                                                          \    else                                                          \
160      BITSET_SET_ ((bset), _bitno);                               \      BITSET_SET_ ((bset), _bitno);                               \
161  } while (0)  } while (0)
# Line 169  do                                                             \ Line 170  do                                                             \
170    bitset_windex _offset = _index - (bset)->b.cindex;            \    bitset_windex _offset = _index - (bset)->b.cindex;            \
171                                                                  \                                                                  \
172    if (_offset < (bset)->b.csize)                                        \    if (_offset < (bset)->b.csize)                                        \
173      (bset)->b.cdata[_offset] &= ~(1 << (_bitno % BITSET_WORD_BITS));    \      (bset)->b.cdata[_offset] &=                                 \
174          ~((bitset_word) 1 << (_bitno % BITSET_WORD_BITS));        \
175    else                                                          \    else                                                          \
176      BITSET_RESET_ ((bset), _bitno);                             \      BITSET_RESET_ ((bset), _bitno);                             \
177  } while (0)  } while (0)
# Line 178  do                                                             \ Line 180  do                                                             \
180  /* Test bit BITNO in bitset BSET.  */  /* Test bit BITNO in bitset BSET.  */
181  #define bitset_test(bset, bitno) \  #define bitset_test(bset, bitno) \
182  (((((bitno) / BITSET_WORD_BITS) - (bset)->b.cindex) < (bset)->b.csize) \  (((((bitno) / BITSET_WORD_BITS) - (bset)->b.cindex) < (bset)->b.csize) \
183    ? ((bset)->b.cdata[(((bitno) / BITSET_WORD_BITS) - (bset)->b.cindex)] \    ? (((int)                                                     \
184       >> ((bitno) % BITSET_WORD_BITS)) & 1 \        ((bset)->b.cdata[(((bitno) / BITSET_WORD_BITS) - (bset)->b.cindex)] \
185    : (unsigned int) BITSET_TEST_ ((bset), (bitno)))         >> ((bitno) % BITSET_WORD_BITS)))                        \
186         & 1)                                                       \
187      : BITSET_TEST_ ((bset), (bitno)))
188  #endif  #endif
189    
190    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26