public override Union ReadUnion(int size) { if (pos + size > this.size) { throw new EndOfStreamException(); } var u = new Union(); var up = &u; for (uint i = 0; i < size; i++) { Union.SetByte(up, i, buffer[pos + i]); } return(*up); }
public override Union ReadUnion(int size) { var u = new Union(); var up = &u; for (uint i = 0; i < size; i++) { var v = stream.ReadByte(); if (v == -1) { throw new EndOfStreamException(); } Union.SetByte(up, i, (byte)v); } return(*up); }
public override Union ReadUnion(int size) { if (setMaxSize > -1 && Position + size > setMaxSize) { throw new EndOfStreamException(); } if (Position + size > this.size) { this.size = Position + size; } var u = new Union(); var up = &u; for (uint i = 0; i < size; i++) { Union.SetByte(up, i, Marshal.ReadByte(address, (int)(Position + i))); } Position += size; return(*up); }