postgis/liblwgeom/varint.h
Nicklas Avén 553272c215 going back to put varint functions in varint.c
git-svn-id: http://svn.osgeo.org/postgis/trunk@12883 b70326c6-7e19-0410-871a-916f4a2858ee
2014-08-11 04:49:12 +00:00

48 lines
1.5 KiB
C

/**********************************************************************
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.net
*
* Copyright (C) 2014 Sandro Santilli <strk@keybit.net>
* Copyright (C) 2013 Nicklas Avén
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
*
**********************************************************************
*
* Handle varInt values, as described here:
* http://developers.google.com/protocol-buffers/docs/encoding#varints
*
**********************************************************************/
#ifndef _LIBLWGEOM_VARINT_H
#define _LIBLWGEOM_VARINT_H 1
#include <stdint.h>
/* Find encoded size for unsigned 32bit integer */
unsigned varint_u32_encoded_size(uint32_t val);
/* Encode unsigned 32bit integer */
uint8_t* varint_u32_encode_buf(uint32_t val, uint8_t *buf);
/* Find encoded size for signed 32bit integer */
unsigned varint_s32_encoded_size(int32_t val);
/* Encode signed 32bit integer */
uint8_t* varint_s32_encode_buf(int32_t val, uint8_t *buf);
/* Find encoded size for unsigned 64bit integer */
unsigned varint_u64_encoded_size(uint64_t val);
/* Encode unsigned 64bit integer */
uint8_t* varint_u64_encode_buf(uint64_t val, uint8_t *buf);
/* Find encoded size for signed 64bit integer */
unsigned varint_s64_encoded_size(int64_t val);
/* Encode unsigned 64bit integer */
uint8_t* varint_s64_encode_buf(int64_t val, uint8_t *buf);
#endif /* !defined _LIBLWGEOM_VARINT_H */