diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Profiler/SerializationUtility.cpp |
Diffstat (limited to 'Runtime/Profiler/SerializationUtility.cpp')
-rw-r--r-- | Runtime/Profiler/SerializationUtility.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Runtime/Profiler/SerializationUtility.cpp b/Runtime/Profiler/SerializationUtility.cpp new file mode 100644 index 0000000..d9214ba --- /dev/null +++ b/Runtime/Profiler/SerializationUtility.cpp @@ -0,0 +1,24 @@ +#include "UnityPrefix.h" +#include "SerializationUtility.h" + +void WriteString(dynamic_array<int>& bitstream, const char* str) +{ + int len = strlen(str); // length including null terminator + int startindex = bitstream.size(); + bitstream.resize_initialized( startindex + len/4 + 1); + memcpy((char*)&bitstream[startindex], str, len+1); +} + +void WriteIntArray(dynamic_array<int>& bitstream, int* data, int count) +{ + for(int i = 0; i < count; i++) + bitstream.push_back (data[i]); +} + +void ReadIntArray(int** bitstream, int* data, int count) +{ + for(int i = 0; i < count; i++) + data[i] = *((*bitstream)++); +} + + |