Fix EliasFanoReader position() when past-the-end
authorGiuseppe Ottaviano <ott@fb.com>
Fri, 13 Feb 2015 01:46:14 +0000 (17:46 -0800)
committerAlecs King <int@fb.com>
Tue, 3 Mar 2015 03:18:03 +0000 (19:18 -0800)
commitc7c65f54afa6e0927c1a9a5ee818a79de337151a
tree2e9663f12eb4cb7ed2de6219638576a712da6f0d
parentc3ca39e2cdd69292f281c9ef09a8b225f72cfc87
Fix EliasFanoReader position() when past-the-end

Summary:
`EliasFanoReader::position()` used to return `size() - 1` both when
the reader is positioned on the last element, and after `next()` is
called after that (and it return `false`). Now in the latter case
`position()` returns `size()` (consistently with the usual behaviour
of past-the-end iterators).

Also fix the return type of `jumpTo`.

Test Plan:
fbconfig folly/experimental/test:eliasfano_test && fbmake runtests_opt

Reviewed By: philipp@fb.com

Subscribers: trunkagent, folly-diffs@, yfeldblum

FB internal diff: D1846275

Signature: t1:1846275:1423790264:151f5d2e1e09d4e24dfb758473dfb9cd52c070bd
folly/experimental/EliasFanoCoding.h
folly/experimental/test/CodingTestUtils.h