35 #include <type_traits> 67 template<
typename OutputIt,
typename T>
73 *
dest = (
static_cast<char>(i) & 0x7f) | 0x80;
78 *
dest =
static_cast<char>(i);
93 template<
int bits,
typename InputIt,
typename T>
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);
CXA_THROW_INFO_T void(* dest)(void *))
const GenericPointer< typename T::ValueType > T2 value