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 <
size_t kSkipQuantum = 0, // 0 = disabled
size_t kForwardQuantum = 0, // 0 = disabled
bool kUpperFirst = false>
struct EliasFanoEncoderV2 {
struct EliasFanoEncoder {
static_assert(
std::is_integral_v<Value> && std::is_unsigned_v<Value>,
"Value should be unsigned integral");
......@@ -136,14 +136,14 @@ struct EliasFanoEncoderV2 {
if (begin == end) {
return MutableCompressedList();
}
EliasFanoEncoderV2 encoder(size_t(end - begin), *(end - 1));
EliasFanoEncoder encoder(size_t(end - begin), *(end - 1));
for (; begin != end; ++begin) {
encoder.add(*begin);
}
return encoder.finish();
}
explicit EliasFanoEncoderV2(const MutableCompressedList& result)
explicit EliasFanoEncoder(const MutableCompressedList& result)
: lower_(result.lower),
upper_(result.upper),
skipPointers_(reinterpret_cast<SkipValueType*>(result.skipPointers)),
......@@ -153,8 +153,8 @@ struct EliasFanoEncoderV2 {
std::fill(result.data.begin(), result.data.end(), '\0');
}
EliasFanoEncoderV2(size_t size, ValueType upperBound)
: EliasFanoEncoderV2(
EliasFanoEncoder(size_t size, ValueType upperBound)
: EliasFanoEncoder(
Layout::fromUpperBoundAndSize(upperBound, size).allocList()) {}
void add(ValueType value) {
......@@ -237,7 +237,7 @@ template <
size_t kSkipQuantum,
size_t kForwardQuantum,
bool kUpperFirst>
struct EliasFanoEncoderV2<
struct EliasFanoEncoder<
Value,
SkipValue,
kSkipQuantum,
......
......@@ -46,7 +46,7 @@ TEST(EliasFanoCoding, defaultNumLowerBits) {
// Encoder::defaultNumLowerBits agree.
static constexpr size_t kNumIterations = 750;
auto compare = [](size_t upperBound, size_t size) {
using Encoder = EliasFanoEncoderV2<size_t>;
using Encoder = EliasFanoEncoder<size_t>;
EXPECT_EQ(
int(slowDefaultNumLowerBits(upperBound, size)),
int(Encoder::defaultNumLowerBits(upperBound, size)))
......@@ -86,7 +86,7 @@ TEST(EliasFanoCoding, defaultNumLowerBits) {
class EliasFanoCodingTest : public ::testing::Test {
public:
void doTestEmpty() {
using Encoder = EliasFanoEncoderV2<uint32_t, size_t>;
using Encoder = EliasFanoEncoder<uint32_t, size_t>;
using Reader = EliasFanoReader<Encoder>;
testEmpty<Reader, Encoder>();
}
......@@ -98,7 +98,7 @@ class EliasFanoCodingTest : public ::testing::Test {
typename SkipValueType,
bool kUpperFirst>
void doTest() {
using Encoder = EliasFanoEncoderV2<
using Encoder = EliasFanoEncoder<
ValueType,
SkipValueType,
kSkipQuantum,
......@@ -138,7 +138,7 @@ class EliasFanoCodingTest : public ::testing::Test {
// corresponding types, by using 16-bit types for everything.
template <size_t kSkipQuantum, size_t kForwardQuantum, bool kUpperFirst>
void doTestDense() {
using Encoder = EliasFanoEncoderV2<
using Encoder = EliasFanoEncoder<
uint16_t,
uint16_t,
kSkipQuantum,
......@@ -208,7 +208,7 @@ TEST_F(EliasFanoCodingTest, SkipForwardPointersDense) {
}
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;
constexpr uint32_t kLargeValue = 127;
......@@ -233,7 +233,7 @@ TEST_F(EliasFanoCodingTest, BugLargeGapInUpperBits) { // t16274876
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<size_t> order;
......@@ -344,7 +344,7 @@ BENCHMARK(Encode) {
BENCHMARK_DRAW_LINE();
BENCHMARK(defaultNumLowerBits, iters) {
using Encoder = EliasFanoEncoderV2<size_t>;
using Encoder = EliasFanoEncoder<size_t>;
size_t i = 0;
while (iters--) {
......
......@@ -108,7 +108,7 @@ const folly::F14FastSet<uint64_t>& getF14Baseline() {
}
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() {
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