/** * Calculates the size of the bbox in varints in the form: * xmin, xdelta, ymin, ydelta */ static size_t sizeof_bbox(TWKB_STATE *ts, int ndims) { int i; uint8_t buf[16]; size_t size = 0; LWDEBUGF(2, "Entered %s", __func__); for ( i = 0; i < ndims; i++ ) { size += varint_s64_encode_buf(ts->bbox_min[i], buf); size += varint_s64_encode_buf((ts->bbox_max[i] - ts->bbox_min[i]), buf); } return size; }
/** * Writes a signed varInt to the buffer */ void bytebuffer_append_varint(bytebuffer_t *b, const int64_t val) { size_t size; bytebuffer_makeroom(b, 8); size = varint_s64_encode_buf(val, b->writecursor); b->writecursor += size; return; }