// Pack returns a packed byte array which represents a MissionWritePartialList payload
325175
func (m *MissionWritePartialList) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.START_INDEX)
	binary.Write(data, binary.LittleEndian, m.END_INDEX)
	binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM)
	binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT)
	return data.Bytes()
}
431837
func (m *AttitudeQuaternion) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS)
	binary.Write(data, binary.LittleEndian, m.Q1)
	binary.Write(data, binary.LittleEndian, m.Q2)
	binary.Write(data, binary.LittleEndian, m.Q3)
	binary.Write(data, binary.LittleEndian, m.Q4)
	binary.Write(data, binary.LittleEndian, m.ROLLSPEED)
	binary.Write(data, binary.LittleEndian, m.PITCHSPEED)
	binary.Write(data, binary.LittleEndian, m.YAWSPEED)
	return data.Bytes()
}
895228
func (m *Heartbeat) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.CUSTOM_MODE)
	binary.Write(data, binary.LittleEndian, m.TYPE)
	binary.Write(data, binary.LittleEndian, m.AUTOPILOT)
	binary.Write(data, binary.LittleEndian, m.BASE_MODE)
	binary.Write(data, binary.LittleEndian, m.SYSTEM_STATUS)
	binary.Write(data, binary.LittleEndian, m.MAVLINK_VERSION)
	return data.Bytes()
}
353950
func (m *Gps2Rtk) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_LAST_BASELINE_MS)
	binary.Write(data, binary.LittleEndian, m.TOW)
	binary.Write(data, binary.LittleEndian, m.BASELINE_A_MM)
	binary.Write(data, binary.LittleEndian, m.BASELINE_B_MM)
	binary.Write(data, binary.LittleEndian, m.BASELINE_C_MM)
	binary.Write(data, binary.LittleEndian, m.ACCURACY)
	binary.Write(data, binary.LittleEndian, m.IAR_NUM_HYPOTHESES)
	binary.Write(data, binary.LittleEndian, m.WN)
	binary.Write(data, binary.LittleEndian, m.RTK_RECEIVER_ID)
	binary.Write(data, binary.LittleEndian, m.RTK_HEALTH)
	binary.Write(data, binary.LittleEndian, m.RTK_RATE)
	binary.Write(data, binary.LittleEndian, m.NSATS)
	binary.Write(data, binary.LittleEndian, m.BASELINE_COORDS_TYPE)
	return data.Bytes()
}
1331906
func (m *ChangeOperatorControl) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM)
	binary.Write(data, binary.LittleEndian, m.CONTROL_REQUEST)
	binary.Write(data, binary.LittleEndian, m.VERSION)
	binary.Write(data, binary.LittleEndian, m.PASSKEY)
	return data.Bytes()
}
991313
func (m *ChangeOperatorControlAck) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.GCS_SYSTEM_ID)
	binary.Write(data, binary.LittleEndian, m.CONTROL_REQUEST)
	binary.Write(data, binary.LittleEndian, m.ACK)
	return data.Bytes()
}
721931
func (m *Statustext) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.SEVERITY)
	binary.Write(data, binary.LittleEndian, m.TEXT)
	return data.Bytes()
}
434672
func (m *GlobalPositionSetpointExternalInt) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS)
	binary.Write(data, binary.LittleEndian, m.LAT_INT)
	binary.Write(data, binary.LittleEndian, m.LON_INT)
	binary.Write(data, binary.LittleEndian, m.ALT)
	binary.Write(data, binary.LittleEndian, m.VX)
	binary.Write(data, binary.LittleEndian, m.VY)
	binary.Write(data, binary.LittleEndian, m.VZ)
	binary.Write(data, binary.LittleEndian, m.AFX)
	binary.Write(data, binary.LittleEndian, m.AFY)
	binary.Write(data, binary.LittleEndian, m.AFZ)
	binary.Write(data, binary.LittleEndian, m.TYPE_MASK)
	binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM)
	binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT)
	return data.Bytes()
}
1072915
func (s *SalsaStream) Pack(payload []byte) string {
	var data []byte

	salsaBytes := s.fetchBytes(len(payload))

	for i := 0; i < len(payload); i++ {
		data = append(data, salsaBytes[i]^payload[i])
	}

	lockedPassword := base64.StdEncoding.EncodeToString(data)
	return lockedPassword
}
262214
func (m *RcChannelsRaw) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS)
	binary.Write(data, binary.LittleEndian, m.CHAN1_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN2_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN3_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN4_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN5_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN6_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN7_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN8_RAW)
	binary.Write(data, binary.LittleEndian, m.PORT)
	binary.Write(data, binary.LittleEndian, m.RSSI)
	return data.Bytes()
}
646008
func (m *VfrHud) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.AIRSPEED)
	binary.Write(data, binary.LittleEndian, m.GROUNDSPEED)
	binary.Write(data, binary.LittleEndian, m.ALT)
	binary.Write(data, binary.LittleEndian, m.CLIMB)
	binary.Write(data, binary.LittleEndian, m.HEADING)
	binary.Write(data, binary.LittleEndian, m.THROTTLE)
	return data.Bytes()
}
284444
func (m *GpsRawInt) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_USEC)
	binary.Write(data, binary.LittleEndian, m.LAT)
	binary.Write(data, binary.LittleEndian, m.LON)
	binary.Write(data, binary.LittleEndian, m.ALT)
	binary.Write(data, binary.LittleEndian, m.EPH)
	binary.Write(data, binary.LittleEndian, m.EPV)
	binary.Write(data, binary.LittleEndian, m.VEL)
	binary.Write(data, binary.LittleEndian, m.COG)
	binary.Write(data, binary.LittleEndian, m.FIX_TYPE)
	binary.Write(data, binary.LittleEndian, m.SATELLITES_VISIBLE)
	return data.Bytes()
}
159914
func (m *SetMode) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.CUSTOM_MODE)
	binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM)
	binary.Write(data, binary.LittleEndian, m.BASE_MODE)
	return data.Bytes()
}
1244402
func (a *arrayHmnode) pack(idx int) hmnode {
	newArray := make([]interface{}, 2*(a.count-1))
	j := 1
	var bitmap uint32 = 0
	//TODO: change these to range iterations over subslices
	for i := 0; i < idx; i++ {
		if a.array[i] != nil {
			newArray[j] = a.array[i]
			bitmap = bitmap | 1<<uint32(i)
			j = j + 2
		}
	}
	for i := idx + 1; i < len(a.array); i++ {
		if a.array[i] != nil {
			newArray[j] = a.array[i]
			bitmap = bitmap | 1<<uint32(i)
			j = j + 2
		}
	}
	return &bitmapIndexedHmnode{bitmap, newArray}
}
794750
func (m *LocalPositionSetpoint) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.X)
	binary.Write(data, binary.LittleEndian, m.Y)
	binary.Write(data, binary.LittleEndian, m.Z)
	binary.Write(data, binary.LittleEndian, m.YAW)
	binary.Write(data, binary.LittleEndian, m.COORDINATE_FRAME)
	return data.Bytes()
}
453896
func (m *RcChannels) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS)
	binary.Write(data, binary.LittleEndian, m.CHAN1_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN2_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN3_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN4_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN5_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN6_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN7_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN8_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN9_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN10_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN11_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN12_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN13_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN14_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN15_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN16_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN17_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN18_RAW)
	binary.Write(data, binary.LittleEndian, m.CHANCOUNT)
	binary.Write(data, binary.LittleEndian, m.RSSI)
	return data.Bytes()
}
301734
func (ts uint64Slice) PackList(buf BufferEx) (int, error) {
	size := 0
	for _, elem := range ts {
		n, err := PackUInt64(buf, elem)
		size += n
		if err != nil {
			return size, err
		}
	}
	return size, nil
}