From 4d7b1da29e0957ac798ee8e6da8288cbd4ae5c79 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Thu, 18 May 2017 19:03:05 +0500 Subject: 2017-05-18 --- src/utility/utility.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/utility/utility.h (limited to 'src/utility/utility.h') diff --git a/src/utility/utility.h b/src/utility/utility.h new file mode 100644 index 0000000..32120cb --- /dev/null +++ b/src/utility/utility.h @@ -0,0 +1,16 @@ +#pragma once +#include + +int VarIntRead(unsigned char *data, size_t &readed); + +size_t VarIntWrite(unsigned int value, unsigned char *data); + +long long int ReadVarLong(unsigned char *data, int &readed); + +unsigned char *WriteVarLong(unsigned long long int value, int &len); + +template +void endswap(T *objp) { + unsigned char *memp = reinterpret_cast(objp); + std::reverse(memp, memp + sizeof(T)); +} \ No newline at end of file -- cgit v1.2.3