@@ -153,7 +153,7 @@ class GBitVec {
153153
154154
155155 void bitSizeError () {
156- GError (" Error at GBitVec: unsupported BitWord size (%d)!\n " ,
156+ GError (" Error at GBitVec: unsupported BitWord size (%d)!\n " ,
157157 sizeof (BitWord));
158158 }
159159 // / count - Returns the number of bits which are set.
@@ -277,6 +277,9 @@ class GBitVec {
277277 }
278278
279279 GBitVec &set (uint Idx) {
280+ #ifndef NDEBUG
281+ indexCheck (Idx, Size);
282+ #endif
280283 fBits [Idx / BITWORD_SIZE] |= 1L << (Idx % BITWORD_SIZE);
281284 return *this ;
282285 }
@@ -287,6 +290,9 @@ class GBitVec {
287290 }
288291
289292 GBitVec &reset (uint Idx) {
293+ #ifndef NDEBUG
294+ indexCheck (Idx, Size);
295+ #endif
290296 fBits [Idx / BITWORD_SIZE] &= ~(1L << (Idx % BITWORD_SIZE));
291297 return *this ;
292298 }
@@ -299,6 +305,9 @@ class GBitVec {
299305 }
300306
301307 GBitVec &flip (uint Idx) {
308+ #ifndef NDEBUG
309+ indexCheck (Idx, Size);
310+ #endif
302311 fBits [Idx / BITWORD_SIZE] ^= 1L << (Idx % BITWORD_SIZE);
303312 return *this ;
304313 }
@@ -310,7 +319,7 @@ class GBitVec {
310319
311320 inline static void indexCheck (uint vIdx, uint vSize) {
312321 if (vIdx >= vSize)
313- GError (" Error at GBitVec: index %d out of bounds (size %d)\n " ,
322+ GError (" Error at GBitVec: index %d out of bounds (size %d)\n " ,
314323 (int )vIdx, vSize);
315324 }
316325
@@ -439,7 +448,7 @@ class GBitVec {
439448
440449 // Then set any stray high bits of the last used word.
441450 uint ExtraBits = Size % BITWORD_SIZE;
442-
451+
443452 if (ExtraBits) {
444453 BitWord ExtraBitMask = ~0UL << ExtraBits;
445454 if (value)
0 commit comments