public void Write(short value) { BitShort bits = new BitShort(value); if (BitConverter.IsLittleEndian) { Buffer[Position] = bits.ByteOffset1; Buffer[Position + 1] = bits.ByteOffset0; } else { Buffer[Position] = bits.ByteOffset0; Buffer[Position + 1] = bits.ByteOffset1; } Position += sizeof(short); }
public short ReadShort() { BitShort bits = new BitShort(); if (BitConverter.IsLittleEndian) { bits.ByteOffset1 = Buffer[Position]; bits.ByteOffset0 = Buffer[Position + 1]; } else { bits.ByteOffset0 = Buffer[Position]; bits.ByteOffset1 = Buffer[Position + 1]; } Position += sizeof(short); return(bits.Value); }