15#ifndef DRACO_CORE_VARINT_DECODING_H_
16#define DRACO_CORE_VARINT_DECODING_H_
29template <
typename IntTypeT>
30bool DecodeVarintUnsigned(
int depth, IntTypeT *out_val,
DecoderBuffer *buffer) {
31 constexpr IntTypeT max_depth =
sizeof(IntTypeT) + 1 + (
sizeof(IntTypeT) >> 3);
32 if (depth > max_depth) {
39 if (!buffer->Decode(&in)) {
44 if (!DecodeVarintUnsigned<IntTypeT>(depth + 1, out_val, buffer)) {
49 *out_val |= in & ((1 << 7) - 1);
62template <
typename IntTypeT>
64 if (std::is_unsigned<IntTypeT>::value) {
65 if (!DecodeVarintUnsigned<IntTypeT>(1, out_val, buffer)) {
70 typename std::make_unsigned<IntTypeT>::type symbol;
71 if (!DecodeVarintUnsigned(1, &symbol, buffer)) {
Definition decoder_buffer.h:30
Definition attribute_octahedron_transform.cc:21
bool DecodeVarint(IntTypeT *out_val, DecoderBuffer *buffer)
Definition varint_decoding.h:63
std::make_signed< IntTypeT >::type ConvertSymbolToSignedInt(IntTypeT val)
Definition bit_utils.h:108