summaryrefslogtreecommitdiffstats
path: root/utility.h
diff options
context:
space:
mode:
Diffstat (limited to 'utility.h')
-rw-r--r--utility.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/utility.h b/utility.h
new file mode 100644
index 0000000..bb2b623
--- /dev/null
+++ b/utility.h
@@ -0,0 +1,24 @@
+//
+// Created by lag1924 on 24.03.17.
+//
+
+#ifndef PROJECT_UTILITY_H
+#define PROJECT_UTILITY_H
+
+#include <algorithm>
+
+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<class T>
+void endswap(T *objp) {
+ unsigned char *memp = reinterpret_cast<unsigned char *>(objp);
+ std::reverse(memp, memp + sizeof(T));
+}
+
+#endif //PROJECT_UTILITY_H