public static unsafe byte[] ReadBytes(BufferSegment buf, ref int offset, int len) { byte[] ret = new byte[len]; //Marshal.Copy((IntPtr)(void*)(buf + offset), ret, 0, len); buf.CopyToBytes(offset, ret, 0, len); offset += len; return(ret); }
public static unsafe byte[] ReadBytes1(BufferSegment buf, ref int offset) { int len = ReadByte(buf, ref offset); byte[] ret = new byte[len]; buf.CopyToBytes(0, ret, 0, len); offset += len; return(ret); }
public static unsafe byte[] ReadBytes4(BufferSegment buf, ref int offset) { int len = ReadInt32(buf, ref offset); byte[] ret = new byte[len]; // Marshal.Copy((IntPtr)(void*)(buf + offset), ret, 0, len); buf.CopyToBytes(offset, ret, 0, len); offset += len; return ret; }
public static unsafe byte[] ReadBytes1(BufferSegment buf, ref int offset) { int len = ReadByte(buf, ref offset); byte[] ret = new byte[len]; buf.CopyToBytes(0, ret, 0, len); offset += len; return ret; }