Commit a0e9a217 authored by Giuseppe Ottaviano's avatar Giuseppe Ottaviano Committed by Facebook GitHub Bot

Codemod EliasFanoEncoderV2 -> EliasFanoEncoder

Summary: There hasn't been a V1 for a very long time.

Reviewed By: philippv, luciang

Differential Revision: D32170751

fbshipit-source-id: f495a81657cf53f870ce93572d46d835c7fb8496
parent 7139fa7a
...@@ -96,7 +96,7 @@ template < ...@@ -96,7 +96,7 @@ template <
size_t kSkipQuantum = 0, // 0 = disabled size_t kSkipQuantum = 0, // 0 = disabled
size_t kForwardQuantum = 0, // 0 = disabled size_t kForwardQuantum = 0, // 0 = disabled
bool kUpperFirst = false> bool kUpperFirst = false>
struct EliasFanoEncoderV2 { struct EliasFanoEncoder {
static_assert( static_assert(
std::is_integral_v<Value> && std::is_unsigned_v<Value>, std::is_integral_v<Value> && std::is_unsigned_v<Value>,
"Value should be unsigned integral"); "Value should be unsigned integral");
...@@ -136,14 +136,14 @@ struct EliasFanoEncoderV2 { ...@@ -136,14 +136,14 @@ struct EliasFanoEncoderV2 {
if (begin == end) { if (begin == end) {
return MutableCompressedList(); return MutableCompressedList();
} }
EliasFanoEncoderV2 encoder(size_t(end - begin), *(end - 1)); EliasFanoEncoder encoder(size_t(end - begin), *(end - 1));
for (; begin != end; ++begin) { for (; begin != end; ++begin) {
encoder.add(*begin); encoder.add(*begin);
} }
return encoder.finish(); return encoder.finish();
} }
explicit EliasFanoEncoderV2(const MutableCompressedList& result) explicit EliasFanoEncoder(const MutableCompressedList& result)
: lower_(result.lower), : lower_(result.lower),
upper_(result.upper), upper_(result.upper),
skipPointers_(reinterpret_cast<SkipValueType*>(result.skipPointers)), skipPointers_(reinterpret_cast<SkipValueType*>(result.skipPointers)),
...@@ -153,8 +153,8 @@ struct EliasFanoEncoderV2 { ...@@ -153,8 +153,8 @@ struct EliasFanoEncoderV2 {
std::fill(result.data.begin(), result.data.end(), '\0'); std::fill(result.data.begin(), result.data.end(), '\0');
} }
EliasFanoEncoderV2(size_t size, ValueType upperBound) EliasFanoEncoder(size_t size, ValueType upperBound)
: EliasFanoEncoderV2( : EliasFanoEncoder(
Layout::fromUpperBoundAndSize(upperBound, size).allocList()) {} Layout::fromUpperBoundAndSize(upperBound, size).allocList()) {}
void add(ValueType value) { void add(ValueType value) {
...@@ -237,7 +237,7 @@ template < ...@@ -237,7 +237,7 @@ template <
size_t kSkipQuantum, size_t kSkipQuantum,
size_t kForwardQuantum, size_t kForwardQuantum,
bool kUpperFirst> bool kUpperFirst>
struct EliasFanoEncoderV2< struct EliasFanoEncoder<
Value, Value,
SkipValue, SkipValue,
kSkipQuantum, kSkipQuantum,
......
...@@ -46,7 +46,7 @@ TEST(EliasFanoCoding, defaultNumLowerBits) { ...@@ -46,7 +46,7 @@ TEST(EliasFanoCoding, defaultNumLowerBits) {
// Encoder::defaultNumLowerBits agree. // Encoder::defaultNumLowerBits agree.
static constexpr size_t kNumIterations = 750; static constexpr size_t kNumIterations = 750;
auto compare = [](size_t upperBound, size_t size) { auto compare = [](size_t upperBound, size_t size) {
using Encoder = EliasFanoEncoderV2<size_t>; using Encoder = EliasFanoEncoder<size_t>;
EXPECT_EQ( EXPECT_EQ(
int(slowDefaultNumLowerBits(upperBound, size)), int(slowDefaultNumLowerBits(upperBound, size)),
int(Encoder::defaultNumLowerBits(upperBound, size))) int(Encoder::defaultNumLowerBits(upperBound, size)))
...@@ -86,7 +86,7 @@ TEST(EliasFanoCoding, defaultNumLowerBits) { ...@@ -86,7 +86,7 @@ TEST(EliasFanoCoding, defaultNumLowerBits) {
class EliasFanoCodingTest : public ::testing::Test { class EliasFanoCodingTest : public ::testing::Test {
public: public:
void doTestEmpty() { void doTestEmpty() {
using Encoder = EliasFanoEncoderV2<uint32_t, size_t>; using Encoder = EliasFanoEncoder<uint32_t, size_t>;
using Reader = EliasFanoReader<Encoder>; using Reader = EliasFanoReader<Encoder>;
testEmpty<Reader, Encoder>(); testEmpty<Reader, Encoder>();
} }
...@@ -98,7 +98,7 @@ class EliasFanoCodingTest : public ::testing::Test { ...@@ -98,7 +98,7 @@ class EliasFanoCodingTest : public ::testing::Test {
typename SkipValueType, typename SkipValueType,
bool kUpperFirst> bool kUpperFirst>
void doTest() { void doTest() {
using Encoder = EliasFanoEncoderV2< using Encoder = EliasFanoEncoder<
ValueType, ValueType,
SkipValueType, SkipValueType,
kSkipQuantum, kSkipQuantum,
...@@ -138,7 +138,7 @@ class EliasFanoCodingTest : public ::testing::Test { ...@@ -138,7 +138,7 @@ class EliasFanoCodingTest : public ::testing::Test {
// corresponding types, by using 16-bit types for everything. // corresponding types, by using 16-bit types for everything.
template <size_t kSkipQuantum, size_t kForwardQuantum, bool kUpperFirst> template <size_t kSkipQuantum, size_t kForwardQuantum, bool kUpperFirst>
void doTestDense() { void doTestDense() {
using Encoder = EliasFanoEncoderV2< using Encoder = EliasFanoEncoder<
uint16_t, uint16_t,
uint16_t, uint16_t,
kSkipQuantum, kSkipQuantum,
...@@ -208,7 +208,7 @@ TEST_F(EliasFanoCodingTest, SkipForwardPointersDense) { ...@@ -208,7 +208,7 @@ TEST_F(EliasFanoCodingTest, SkipForwardPointersDense) {
} }
TEST_F(EliasFanoCodingTest, BugLargeGapInUpperBits) { // t16274876 TEST_F(EliasFanoCodingTest, BugLargeGapInUpperBits) { // t16274876
typedef EliasFanoEncoderV2<uint32_t, uint32_t, 2, 2> Encoder; typedef EliasFanoEncoder<uint32_t, uint32_t, 2, 2> Encoder;
typedef EliasFanoReader<Encoder, instructions::Default> Reader; typedef EliasFanoReader<Encoder, instructions::Default> Reader;
constexpr uint32_t kLargeValue = 127; constexpr uint32_t kLargeValue = 127;
...@@ -233,7 +233,7 @@ TEST_F(EliasFanoCodingTest, BugLargeGapInUpperBits) { // t16274876 ...@@ -233,7 +233,7 @@ TEST_F(EliasFanoCodingTest, BugLargeGapInUpperBits) { // t16274876
namespace bm { namespace bm {
typedef EliasFanoEncoderV2<uint32_t, uint32_t, 128, 128> Encoder; typedef EliasFanoEncoder<uint32_t, uint32_t, 128, 128> Encoder;
std::vector<uint64_t> data; std::vector<uint64_t> data;
std::vector<size_t> order; std::vector<size_t> order;
...@@ -344,7 +344,7 @@ BENCHMARK(Encode) { ...@@ -344,7 +344,7 @@ BENCHMARK(Encode) {
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK(defaultNumLowerBits, iters) { BENCHMARK(defaultNumLowerBits, iters) {
using Encoder = EliasFanoEncoderV2<size_t>; using Encoder = EliasFanoEncoder<size_t>;
size_t i = 0; size_t i = 0;
while (iters--) { while (iters--) {
......
...@@ -108,7 +108,7 @@ const folly::F14FastSet<uint64_t>& getF14Baseline() { ...@@ -108,7 +108,7 @@ const folly::F14FastSet<uint64_t>& getF14Baseline() {
} }
using EFEncoder = using EFEncoder =
folly::compression::EliasFanoEncoderV2<uint64_t, uint64_t, 128, 128>; folly::compression::EliasFanoEncoder<uint64_t, uint64_t, 128, 128>;
const folly::compression::MutableEliasFanoCompressedList& getEFBaseline() { const folly::compression::MutableEliasFanoCompressedList& getEFBaseline() {
folly::BenchmarkSuspender guard; folly::BenchmarkSuspender guard;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment