70 lwerror(
"%s: Got out of infinite loop. Consciousness achieved.", __func__);
114 const uint8_t *ptr = the_start;
117 while( ptr < the_end )
126 nVal |= ((uint64_t)(nByte & 0x7f)) << nShift;
138 *size = ptr - the_start;
139 return nVal | ((uint64_t)nByte << nShift);
142 lwerror(
"%s: varint extends past end of buffer", __func__);
149 const uint8_t *ptr = the_start;
152 while( ptr < the_end )
162 return ptr - the_start;
171 ((uint64_t)val) << 1 :
172 ((((uint64_t)(-1 - val)) << 1) | 0x01);
179 ((((
uint32_t)(-1 - val)) << 1) | 0x01);
186 ((((
uint8_t)(-1 - val)) << 1) | 0x01);
191 return !(val & 0x01) ?
192 ((int64_t)(val >> 1)) :
193 (-1 * (int64_t)((val+1) >> 1));
198 return !(val & 0x01) ?
199 ((int32_t)(val >> 1)) :
200 (-1 * (int32_t)((val+1) >> 1));
205 return !(val & 0x01) ?
206 ((int8_t)(val >> 1)) :
207 (-1 * (int8_t)((val+1) >> 1));
This library is the generic geometry handling section of PostGIS.
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
int64_t unzigzag64(uint64_t val)
int32_t unzigzag32(uint32_t val)
size_t varint_s32_encode_buf(int32_t val, uint8_t *buf)
size_t varint_size(const uint8_t *the_start, const uint8_t *the_end)
size_t varint_s64_encode_buf(int64_t val, uint8_t *buf)
int8_t unzigzag8(uint8_t val)
size_t varint_u64_encode_buf(uint64_t val, uint8_t *buf)
int64_t varint_s64_decode(const uint8_t *the_start, const uint8_t *the_end, size_t *size)
uint64_t zigzag64(int64_t val)
uint64_t varint_u64_decode(const uint8_t *the_start, const uint8_t *the_end, size_t *size)
uint32_t zigzag32(int32_t val)
static size_t _varint_u64_encode_buf(uint64_t val, uint8_t *buf)
uint8_t zigzag8(int8_t val)
size_t varint_u32_encode_buf(uint32_t val, uint8_t *buf)