static int decode_short (byte[] packet, ref int offset) { int res = ((int)packet [offset] << 8) | (int)packet [offset + 1]; offset += 2; return res; }