~ubuntu-branches/ubuntu/lucid/mesa/lucid

« back to all changes in this revision

Viewing changes to src/gallium/auxiliary/util/u_bitmask.c

  • Committer: Bazaar Package Importer
  • Author(s): Timo Aaltonen, Timo Aaltonen, Robert Hooker
  • Date: 2010-02-19 15:52:12 UTC
  • mfrom: (3.1.10 experimental)
  • Revision ID: james.westby@ubuntu.com-20100219155212-blqov938av7m6exj
Tags: 7.7-3ubuntu1
[ Timo Aaltonen ]
* Merge from Debian experimental.

[ Robert Hooker ]
* Add 100_no_abi_tag.patch: Removes the ABI tag in /usr/lib/libGL.so.1
  which prevented ldconfig from using a libGL from another directory
  at a higher priority than the one in /usr/lib.
* Install libGL alternatives with libgl1-mesa-swx11 as well. (LP: #522048)

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
   if(!minimum_size)
98
98
      return FALSE;
99
99
      
100
 
   if(bm->size > minimum_size)
 
100
   if(bm->size >= minimum_size)
101
101
      return TRUE;
102
102
 
103
103
   assert(bm->size % UTIL_BITMASK_BITS_PER_WORD == 0);
104
104
   new_size = bm->size;
105
 
   while(!(new_size > minimum_size)) {
 
105
   while(new_size < minimum_size) {
106
106
      new_size *= 2;
107
107
      /* Check integer overflow */
108
108
      if(new_size < bm->size)
136
136
                        unsigned index)
137
137
{
138
138
   assert(bm->filled <= bm->size);
139
 
   assert(index <= bm->size);
 
139
   assert(index < bm->size);
140
140
   
141
141
   if(index == bm->filled) {
142
142
      ++bm->filled;
149
149
                          unsigned index)
150
150
{
151
151
   assert(bm->filled <= bm->size);
152
 
   assert(index <= bm->size);
 
152
   assert(index < bm->size);
153
153
   
154
154
   if(index < bm->filled)
155
155
      bm->filled = index;
182
182
      mask = 1;
183
183
   }
184
184
found:
185
 
   
 
185
 
186
186
   /* grow the bitmask if necessary */
187
187
   if(!util_bitmask_resize(bm, bm->filled))
188
188
      return UTIL_BITMASK_INVALID_INDEX;
198
198
util_bitmask_set(struct util_bitmask *bm, 
199
199
                 unsigned index)
200
200
{
201
 
   unsigned word = index / UTIL_BITMASK_BITS_PER_WORD;
202
 
   unsigned bit  = index % UTIL_BITMASK_BITS_PER_WORD;
203
 
   util_bitmask_word mask = 1 << bit;
 
201
   unsigned word;
 
202
   unsigned bit;
 
203
   util_bitmask_word mask;
204
204
   
205
205
   assert(bm);
206
206
   
208
208
   if(!util_bitmask_resize(bm, index))
209
209
      return UTIL_BITMASK_INVALID_INDEX;
210
210
 
 
211
   word = index / UTIL_BITMASK_BITS_PER_WORD;
 
212
   bit  = index % UTIL_BITMASK_BITS_PER_WORD;
 
213
   mask = 1 << bit;
 
214
 
211
215
   bm->words[word] |= mask;
212
216
 
213
217
   util_bitmask_filled_set(bm, index);
220
224
util_bitmask_clear(struct util_bitmask *bm, 
221
225
                   unsigned index)
222
226
{
223
 
   unsigned word = index / UTIL_BITMASK_BITS_PER_WORD;
224
 
   unsigned bit  = index % UTIL_BITMASK_BITS_PER_WORD;
225
 
   util_bitmask_word mask = 1 << bit;
 
227
   unsigned word;
 
228
   unsigned bit;
 
229
   util_bitmask_word mask;
226
230
   
227
231
   assert(bm);
228
232
   
229
233
   if(index >= bm->size)
230
234
      return;
231
235
 
 
236
   word = index / UTIL_BITMASK_BITS_PER_WORD;
 
237
   bit  = index % UTIL_BITMASK_BITS_PER_WORD;
 
238
   mask = 1 << bit;
 
239
 
232
240
   bm->words[word] &= ~mask;
233
241
   
234
242
   util_bitmask_filled_unset(bm, index);
250
258
      return TRUE;
251
259
   }
252
260
 
253
 
   if(index > bm->size)
 
261
   if(index >= bm->size)
254
262
      return FALSE;
255
263
 
256
264
   if(bm->words[word] & mask) {