Make EliasFanoReader and BitVectorReader API more consistent
authorGiuseppe Ottaviano <ott@fb.com>
Thu, 10 Sep 2015 15:26:36 +0000 (08:26 -0700)
committerfacebook-github-bot-4 <folly-bot@fb.com>
Thu, 10 Sep 2015 16:20:16 +0000 (09:20 -0700)
commit2baf3f69a2d82034e8afc1bbbd612a82bb98ea35
tree347dbfb392f81efbdea02e0f38b8ad4459b253fd
parentfc0470a93d86dec8fe9fa3db7bc05672cc8979b0
Make EliasFanoReader and BitVectorReader API more consistent

Summary: This diff introduces a few breaking API changes to both EliasFanoReader and BitVectorReader in order to fix some inconsistencies:

- As initalized, `EliasFanoReader` and `BitVectorReader` held a value of `0`, thus if `0` is present in the list `skipTo(0)` would not update the position to `0`, as it happens with any other `skipTo(<first element>)`. This fixes `jumpTo` accordingly.
- `jump(i + 1)` would go at position `i`. Now `reader.jump(i)`'s postcondition is `reader.position() == i`.
- It is now illegal to retrieve `value()` from a reader in an out-of-bounds position (before-the-begin or past-the-end). Validity of a reader can be checked with `valid()`.

Reviewed By: @philippv

Differential Revision: D2420023
folly/experimental/BitVectorCoding.h
folly/experimental/EliasFanoCoding.h
folly/experimental/test/CodingTestUtils.h
folly/experimental/test/EliasFanoCodingTest.cpp