bitvector: more error diagnostics

This commit is contained in:
2026-02-05 14:29:45 +01:00
parent 7441b44251
commit 1d0d13f3a9

View File

@@ -79,21 +79,33 @@ public:
void set(const unsigned int i) void set(const unsigned int i)
{ {
#ifdef DEBUG #ifdef DEBUG
if(i>=size()) laerror("bitvector index out of range in"); if(i>=size())
{
std::cout<<"birvector index 0 < "<<i<<" "<<size()<<std::endl;
laerror("bitvector index out of range in");
}
#endif #endif
v[i/blockbits] |= (1UL<<(i%blockbits)); v[i/blockbits] |= (1UL<<(i%blockbits));
}; };
void reset(const unsigned int i) void reset(const unsigned int i)
{ {
#ifdef DEBUG #ifdef DEBUG
if(i>=size()) laerror("bitvector index out of range in"); if(i>=size())
{
std::cout<<"birvector index 0 < "<<i<<" "<<size()<<std::endl;
laerror("bitvector index out of range in");
}
#endif #endif
v[i/blockbits] &= ~(1UL<<(i%blockbits)); v[i/blockbits] &= ~(1UL<<(i%blockbits));
}; };
void flip(const unsigned int i) void flip(const unsigned int i)
{ {
#ifdef DEBUG #ifdef DEBUG
if(i>=size()) laerror("bitvector index out of range in"); if(i>=size())
{
std::cout<<"birvector index 0 < "<<i<<" "<<size()<<std::endl;
laerror("bitvector index out of range in");
}
#endif #endif
v[i/blockbits] ^= (1UL<<(i%blockbits)); v[i/blockbits] ^= (1UL<<(i%blockbits));
}; };