Commit 9101d63b authored by edo9300's avatar edo9300

Updated bufferio functions

parent 84566be2
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
class BufferIO { class BufferIO {
public: public:
inline static unsigned long long ReadInt64(char*& p) { inline static long long ReadInt64(char*& p) {
unsigned long long ret = *(unsigned long long*)p; long long ret = *(long long*)p;
p += 8; p += 8;
return ret; return ret;
} }
...@@ -32,16 +32,20 @@ public: ...@@ -32,16 +32,20 @@ public:
p++; p++;
return ret; return ret;
} }
inline static void WriteInt64(char*& p, long long val) {
std::memcpy(p, &val, sizeof(val));
p += 8;
}
inline static void WriteInt32(char*& p, int val) { inline static void WriteInt32(char*& p, int val) {
(*(int*)p) = val; std::memcpy(p, &val, sizeof(val));
p += 4; p += 4;
} }
inline static void WriteInt16(char*& p, short val) { inline static void WriteInt16(char*& p, short val) {
(*(short*)p) = val; std::memcpy(p, &val, sizeof(val));
p += 2; p += 2;
} }
inline static void WriteInt8(char*& p, char val) { inline static void WriteInt8(char*& p, char val) {
*p = val; std::memcpy(p, &val, sizeof(val));
p++; p++;
} }
template<typename T1, typename T2> template<typename T1, typename T2>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment