Skip to content

Commit

Permalink
Merge pull request fast-pack#93 from pps83/master-fixes2
Browse files Browse the repository at this point in the history
Move impl headers to codecfactory.cpp + svb_encode signarture fix
  • Loading branch information
lemire authored Dec 20, 2022
2 parents e6d5e15 + df63dcd commit bd065e0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 33 deletions.
29 changes: 1 addition & 28 deletions headers/codecfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,8 @@

#ifndef CODECFACTORY_H_
#define CODECFACTORY_H_
#include "common.h"

#include "codecs.h"
#include "vsencoding.h"
#include "util.h"
#include "simple16.h"
#include "simple9.h"
#include "simple9_rle.h"
#include "simple8b.h"
#include "simple8b_rle.h"
#include "newpfor.h"
#include "simdnewpfor.h"
#include "optpfor.h"
#include "simdoptpfor.h"
#include "fastpfor.h"
#include "simdfastpfor.h"
#include "variablebyte.h"
#include "compositecodec.h"
#include "blockpacking.h"
#include "pfor.h"
#include "simdpfor.h"
#include "pfor2008.h"
#include "VarIntG8IU.h"
#include "simdbinarypacking.h"
#include "snappydelta.h"
#include "varintgb.h"
#include "simdvariablebyte.h"
#include "streamvariablebyte.h"
#include "simdgroupsimple.h"

namespace FastPForLib {

Expand All @@ -56,7 +30,6 @@ class CODECFactory {
CodecMap scodecmap;
};


} // namespace FastPFor

#endif /* CODECFACTORY_H_ */
36 changes: 32 additions & 4 deletions src/codecfactory.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
#include "codecfactory.h"
#include "common.h"
#include "codecs.h"
#include "vsencoding.h"
#include "util.h"
#include "simple16.h"
#include "simple9.h"
#include "simple9_rle.h"
#include "simple8b.h"
#include "simple8b_rle.h"
#include "newpfor.h"
#include "simdnewpfor.h"
#include "optpfor.h"
#include "simdoptpfor.h"
#include "fastpfor.h"
#include "simdfastpfor.h"
#include "variablebyte.h"
#include "compositecodec.h"
#include "blockpacking.h"
#include "pfor.h"
#include "simdpfor.h"
#include "pfor2008.h"
#include "VarIntG8IU.h"
#include "simdbinarypacking.h"
#include "snappydelta.h"
#include "varintgb.h"
#include "simdvariablebyte.h"
#include "streamvariablebyte.h"
#include "simdgroupsimple.h"

namespace FastPForLib {
std::vector<std::shared_ptr<IntegerCODEC>> CODECFactory::allSchemes() {
Expand Down Expand Up @@ -31,9 +59,7 @@ std::shared_ptr<IntegerCODEC> &CODECFactory::getFromName(std::string name) {
return scodecmap[name];
}

// C++11 allows better than this, but neither Microsoft nor Intel support C++11
// fully.
inline CodecMap initializefactory() {
static CodecMap initializefactory() {
CodecMap map;
map["fastbinarypacking8"] = std::shared_ptr<IntegerCODEC>(
new CompositeCodec<FastBinaryPacking<8>, VariableByte>);
Expand Down Expand Up @@ -96,5 +122,7 @@ inline CodecMap initializefactory() {
map["copy"] = std::shared_ptr<IntegerCODEC>(new JustCopy());
return map;
}
CODECFactory::CODECFactory() : scodecmap(initializefactory()) {}

CODECFactory::CODECFactory() : scodecmap(initializefactory()) {}

} // namespace FastPForLib
2 changes: 1 addition & 1 deletion src/streamvbyte.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ uint8_t *svb_decode_avx_simple(uint32_t *out, uint8_t *__restrict__ keyPtr,
return svb_decode_scalar(out, keyPtr + consumedkeys, dataPtr, count & 31);
}

uint64_t svb_encode(uint8_t *out, uint32_t *in, uint32_t count, int delta,
uint64_t svb_encode(uint8_t *out, const uint32_t *in, uint32_t count, int delta,
int type) {
*(uint32_t *)out = count; // first 4 bytes is number of ints
uint8_t *keyPtr = out + 4; // keys come immediately after 32-bit count
Expand Down

0 comments on commit bd065e0

Please sign in to comment.