Check out Concise [0] or Roaring Bitmaps [1] before rolling your own compressed bitset scheme. Wish I had known about these sooner.
(I realize now this is offtopic, as this is bit fields not bit sets; nevermind, but still it's interesting!)
(I realize now this is offtopic, as this is bit fields not bit sets; nevermind, but still it's interesting!)