diff --git a/bitvector.cc b/bitvector.cc index ad5180b..b1bcf83 100644 --- a/bitvector.cc +++ b/bitvector.cc @@ -260,11 +260,20 @@ zero_padding(); +//with before>0 only the ones at positions 0..before-1 are counted unsigned int bitvector::population(const unsigned int before) const { -if(before) laerror("before parameter in population() not implemented yet"); int i; unsigned int s=0; +if(before) + { + if(before>size()) laerror("before parameter beyond the size in population()"); + int full=before/blockbits; + for(i=0; i