BitVec or counters

When should one use a BitVec vs using a counter struct like:

struct Counter {
    ones: u32,
    zeroes: u32,
}

When is one better suited to the situation than the other ? I have a failure of imagination I think.

BitVec tracks the position every 1 and 0. If you don't care about that, then your Counter is probably going to be a lot easier and faster.

4 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.