35 #include <type_traits>
67 template<
typename OutputIt,
typename T>
69 typename std::enable_if<std::is_integral<T>::value && std::is_unsigned<T>::value,
void>::type
73 *
dest = (
static_cast<char>(i) & 0x7f) | 0x80;
78 *
dest =
static_cast<char>(i);
93 template<
int bits,
typename InputIt,
typename T>
94 typename std::enable_if<std::is_integral<T>::value && std::is_unsigned<T>::value && 0 <=
bits && bits <= std::numeric_limits<T>::digits,
int>::type
95 read_varint(InputIt &&first, InputIt &&last,
T &write) {
98 for (
int shift = 0;; shift += 7) {
102 unsigned char byte = *first;
105 if (shift + 7 >=
bits &&
byte >= 1 << (
bits - shift)) {
108 if (
byte == 0 && shift != 0) {
112 write |=
static_cast<T>(
byte & 0x7f) << shift;
115 if ((
byte & 0x80) == 0) {
125 template<
typename InputIt,
typename T>
126 int read_varint(InputIt &&first, InputIt &&last,
T &i) {
127 return read_varint<std::numeric_limits<T>::digits>(std::forward<InputIt>(first), std::forward<InputIt>(last), i);
const uint32_t T[512]
Definition: groestl_tables.h:37
unsigned int bits[ATOMS]
Definition: rctTypes.h:136
CXA_THROW_INFO_T void(* dest)(void *))
Definition: stack_trace.cpp:91