2 * Copyright 2017-present Facebook, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @author Giuseppe Ottaviano <ott@fb.com>
20 * Shared utils for BitVectorCoding.h and EliasFanoCoding.h.
26 namespace compression {
30 * Helpers to store pointers to forward and skip pointer arrays only
31 * if they are used, that is, the quantum is nonzero. If it is 0, the
32 * class is empty, and the member is static to keep the syntax valid,
33 * thus it will take no space in a derived class thanks to empty base
37 class ForwardPointers {
39 explicit ForwardPointers(const unsigned char* ptr) : forwardPointers_(ptr) {}
40 const unsigned char* const forwardPointers_;
43 class ForwardPointers<0> {
45 explicit ForwardPointers(const unsigned char*) {}
46 constexpr static const unsigned char* const forwardPointers_{};
52 explicit SkipPointers(const unsigned char* ptr) : skipPointers_(ptr) {}
53 const unsigned char* const skipPointers_;
56 class SkipPointers<0> {
58 explicit SkipPointers(const unsigned char*) {}
59 constexpr static const unsigned char* const skipPointers_{};
62 } // namespace compression