From 2fcb4625389b1594bbefdbaf2e038b2cfffa8ead Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Tue, 30 May 2023 14:27:59 +0800 Subject: + json extends --- .../Assets/ThirdParty/UnsafeFunction.cs | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs (limited to 'WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs') diff --git a/WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs b/WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs new file mode 100644 index 0000000..3362626 --- /dev/null +++ b/WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs @@ -0,0 +1,53 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + + +public class UnsafeFunction +{ + + public unsafe static void memcpyimpl(byte* src, byte* dest, int len) + { + if (len >= 16) + { + do + { + *(int*)dest = *(int*)src; + *(int*)(dest + 4) = *(int*)(src + 4); + *(int*)(dest + 8) = *(int*)(src + 8); + *(int*)(dest + 12) = *(int*)(src + 12); + dest += 16; + src += 16; + } + while ((len -= 16) >= 16); + } + if (len > 0) + { + if ((len & 8) != 0) + { + *(int*)dest = *(int*)src; + *(int*)(dest + 4) = *(int*)(src + 4); + dest += 8; + src += 8; + } + if ((len & 4) != 0) + { + *(int*)dest = *(int*)src; + dest += 4; + src += 4; + } + if ((len & 2) != 0) + { + *(short*)dest = *(short*)src; + dest += 2; + src += 2; + } + if ((len & 1) != 0) + { + *(dest++) = *(src++); + } + } + } + +} \ No newline at end of file -- cgit v1.1-26-g67d0