summaryrefslogtreecommitdiff
path: root/WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2023-05-30 14:27:59 +0800
committerchai <215380520@qq.com>2023-05-30 14:27:59 +0800
commit2fcb4625389b1594bbefdbaf2e038b2cfffa8ead (patch)
tree87f57dbfdaf3d11ebf33869b76f12cc475c9a033 /WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs
parent38e177b0fdf130d6a361ab51c80b5b56ee83f28e (diff)
+ json extends
Diffstat (limited to 'WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs')
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs53
1 files changed, 53 insertions, 0 deletions
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