From 89120fa7ead9b2770f7ddc3912807e6e6bcca1f3 Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Fri, 22 Nov 2024 19:31:10 +0100 Subject: [PATCH] fixed bitmap inversion --- util/bitvec.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/bitvec.h b/util/bitvec.h index 7a67b6c4..29716ff1 100644 --- a/util/bitvec.h +++ b/util/bitvec.h @@ -49,11 +49,14 @@ class BitVec_T void Invert ( int iMinBit=-1, int iMaxBit=-1 ) { + if ( !m_iSize ) + return; + if ( iMinBit<0 ) iMinBit = 0; if ( iMaxBit<0 ) - iMaxBit = m_iSize; + iMaxBit = m_iSize-1; int iMinId = iMinBit>>SHIFT; int iMaxId = (iMaxBit+SIZEBITS)>>SHIFT;