Offset is irrelevant for the number of records

We are interested in how many records there are, since we extract one
item per record. The offset is just used to index into each record, and
doesn't affect the total number of records.
This commit is contained in:
Roland Kaufmann 2013-11-28 01:04:03 +01:00
parent a0a574b01a
commit a997c17a51

View File

@ -211,8 +211,14 @@ private:
// don't jump out of the set when trying to // don't jump out of the set when trying to
assert(stride > 0 && stride < num - offset); assert(stride > 0 && stride < num - offset);
// number of (strided) entries it will provide // number of (strided) entries it will provide. it is assumed that the
const div_t d = std::div (data.size () - offset, stride); // data is organized into a number of records, each with equal number
// of items (the stride), and that the offset *always* can be used to
// index into such a record. if we wanted to support a partial record
// at the end, then we should add one if the offset is less-or-equal
// to the remainder.
const div_t d = std::div (data.size (), stride);
assert (d.rem == 0);
return d.quot; return d.quot;
} }
}; };