Fix a corner case in EliasFanoReader::previousValue
authorGiuseppe Ottaviano <ott@fb.com>
Fri, 24 Feb 2017 01:51:16 +0000 (17:51 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 24 Feb 2017 02:04:51 +0000 (18:04 -0800)
commite639eac298aa914b7b56b3d78115b5abc1132e11
tree55a62e0422f1dfbf9f7e60ec3bb9464bf150afeb
parent3900132e235520bee366c554279af09ca4208667
Fix a corner case in EliasFanoReader::previousValue

Summary:
`previousValue` makes the incorrect assumption that `outer_`
is a multiple of the word size. This is incorrect because `skipToNext`
can reposition at an arbitrary point.

The bug is very rare because it can only happen if there is a gap
larger than the skip quantum after the first element in the upper
bits.

Reviewed By: philippv

Differential Revision: D4607270

fbshipit-source-id: ff016f09f3f1f87314b68370e3dc137b82694f45
folly/experimental/EliasFanoCoding.h
folly/experimental/test/EliasFanoCodingTest.cpp