public static void WriteShort(int v, Stream stream) { stream.WriteByte((byte)((v >> 8) & 0xff)); stream.WriteByte((byte)(v & 0xff)); }