Check out Concise [0] or Roaring Bitmaps [1] before rolling your own compressed bitset scheme. Wish I had known about these sooner.<p>(I realize now this is offtopic, as this is bit fields not bit sets; nevermind, but still it&#x27;s interesting!)<p>[0] <a href="http:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1004.0403.pdf" rel="nofollow">http:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1004.0403.pdf</a><p>[1] <a href="http:&#x2F;&#x2F;roaringbitmap.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;roaringbitmap.org&#x2F;</a>