public void WriteUInt16(UInt16 num) { CheckBufferPoll(3); if (num == 0) { _ms.WriteByte((byte)UShrotTypeEnum.Zero); return; } UShrotTypeEnum flag = UShrotTypeEnum.DEFAULT; byte[] bytes; if (num <= byte.MaxValue) { flag |= UShrotTypeEnum.ByteVal; bytes = new byte[] { (byte)num }; } else { bytes = BitConverter.GetBytes(num); } _ms.WriteByte((byte)flag); _ms.Write(bytes, 0, bytes.Length); }
public void WriteUInt16(UInt16 num) { CheckBufferPoll(3); if (num == 0) { _ms.WriteByte((byte)UShrotTypeEnum.Zero); return; } UShrotTypeEnum flag = UShrotTypeEnum.DEFAULT; byte[] bytes = BitConverter.GetBytes(num); _ms.WriteByte((byte)flag); _ms.Write(bytes, 0, bytes.Length); }