chromium/v8/src/base/vlq.h

// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_BASE_VLQ_H_
#define V8_BASE_VLQ_H_

#include <limits>
#include <vector>

#include "src/base/memory.h"

namespace v8 {
namespace base {

static constexpr uint32_t kContinueShift =;
static constexpr uint32_t kContinueBit =;
static constexpr uint32_t kDataMask =;

// Encodes an unsigned value using variable-length encoding and stores it using
// the passed process_byte function.
template <typename Function>
inline void VLQEncodeUnsigned(Function&& process_byte, uint32_t value) {}

inline uint32_t VLQConvertToUnsigned(int32_t value) {}

// Encodes value using variable-length encoding and stores it using the passed
// process_byte function.
template <typename Function>
inline void VLQEncode(Function&& process_byte, int32_t value) {}

// Wrapper of VLQEncode for std::vector backed storage containers.
template <typename A>
inline void VLQEncode(std::vector<uint8_t, A>* data, int32_t value) {}

// Wrapper of VLQEncodeUnsigned for std::vector backed storage containers.
template <typename A>
inline void VLQEncodeUnsigned(std::vector<uint8_t, A>* data, uint32_t value) {}

// Decodes a variable-length encoded unsigned value from bytes returned by
// successive calls to the given function.
template <typename GetNextFunction>
inline typename std::enable_if<
    std::is_same<decltype(std::declval<GetNextFunction>()()), uint8_t>::value,
    uint32_t>::type
VLQDecodeUnsigned(GetNextFunction&& get_next) {}

// Decodes a variable-length encoded unsigned value stored in contiguous memory
// starting at data_start + index, updating index to where the next encoded
// value starts.
inline uint32_t VLQDecodeUnsigned(const uint8_t* data_start, int* index) {}

// Decodes a variable-length encoded value stored in contiguous memory starting
// at data_start + index, updating index to where the next encoded value starts.
inline int32_t VLQDecode(const uint8_t* data_start, int* index) {}

}  // namespace base
}  // namespace v8

#endif  // V8_BASE_VLQ_H_