源战役客户端
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 

52 líneas
1.3 KiB

using System;
using UnityEditor.MemoryProfiler;
using UnityEngine;
namespace MemoryProfilerWindow
{
internal struct BytesAndOffset
{
public byte[] bytes;
public int offset;
public int pointerSize;
public bool IsValid { get { return bytes != null; }}
public UInt64 ReadPointer()
{
if (pointerSize == 4)
return BitConverter.ToUInt32(bytes, offset);
if (pointerSize == 8)
return BitConverter.ToUInt64(bytes, offset);
throw new ArgumentException("Unexpected pointersize: " + pointerSize);
}
public Int32 ReadInt32()
{
return BitConverter.ToInt32(bytes, offset);
}
public Int64 ReadInt64()
{
return BitConverter.ToInt64(bytes, offset);
}
public BytesAndOffset Add(int add)
{
return new BytesAndOffset() {bytes = bytes, offset = offset + add, pointerSize = pointerSize};
}
public void WritePointer(UInt64 value)
{
for (int i = 0; i < pointerSize; i++)
{
bytes[i + offset] = (byte)value;
value >>= 8;
}
}
public BytesAndOffset NextPointer()
{
return Add(pointerSize);
}
}
}