9 lines
468 B
C#
9 lines
468 B
C#
namespace BlendFile;
|
|
|
|
public static class ByteArrayExt{
|
|
public static long ToMemAddr(this Byte[] bytes, bool isLittleEndian = true) =>
|
|
BitConverter.ToInt64(isLittleEndian == BitConverter.IsLittleEndian ? bytes : bytes.Reverse().ToArray(), 0);
|
|
|
|
public static IntPtr ToPointer(this Byte[] bytes, bool isLittleEndian = true) =>
|
|
new (BitConverter.ToInt64(isLittleEndian == BitConverter.IsLittleEndian ? bytes : bytes.Reverse().ToArray(), 0));
|
|
} |