// Decode accepts a packed byte array and populates the fields of the SetGlobalPositionSetpointInt
488532
func (m *SetGlobalPositionSetpointInt) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.LATITUDE)
	binary.Read(data, binary.LittleEndian, &m.LONGITUDE)
	binary.Read(data, binary.LittleEndian, &m.ALTITUDE)
	binary.Read(data, binary.LittleEndian, &m.YAW)
	binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME)
}
261297
func Decode(upper, lower byte) Type {
	return Type(binary.BigEndian.Uint16([]byte{upper, lower}))
}
515514
func (a *ChannelReestablish) Decode(r io.Reader, pver uint32) error {
	err := ReadElements(r,
		&a.ChanID,
		&a.NextLocalCommitHeight,
		&a.RemoteCommitTailHeight,
	)
	if err != nil {
		return err
	}

	// This message has to currently defined optional fields. As a result,
	// we'll only proceed if there's still bytes remaining within the
	// reader.
	//
	// We'll manually parse out the optional fields in order to be able to
	// still utilize the io.Reader interface.

	// We'll first attempt to read the optional commit secret, if we're at
	// the EOF, then this means the field wasn't included so we can exit
	// early.
	var buf [32]byte
	_, err = io.ReadFull(r, buf[:32])
	if err == io.EOF {
		return nil
	} else if err != nil {
		return err
	}

	// If the field is present, then we'll copy it over and proceed.
	copy(a.LastRemoteCommitSecret[:], buf[:])

	// We'll conclude by parsing out the commitment point. We don't check
	// the error in this case, as it hey included the commit secret, then
	// they MUST also include the commit point.
	return ReadElement(r, &a.LocalUnrevokedCommitPoint)
}
423574
func (g *Geometry) Decode() (geom.T, error) {
	switch g.Type {
	case "Point":
		if g.Coordinates == nil {
			return geom.NewPoint(geom.NoLayout), nil
		}
		var coords geom.Coord
		if err := json.Unmarshal(*g.Coordinates, &coords); err != nil {
			return nil, err
		}
		layout, err := guessLayout0(coords)
		if err != nil {
			return nil, err
		}
		return geom.NewPoint(layout).SetCoords(coords)
	case "LineString":
		if g.Coordinates == nil {
			return geom.NewLineString(geom.NoLayout), nil
		}
		var coords []geom.Coord
		if err := json.Unmarshal(*g.Coordinates, &coords); err != nil {
			return nil, err
		}
		layout, err := guessLayout1(coords)
		if err != nil {
			return nil, err
		}
		return geom.NewLineString(layout).SetCoords(coords)
	case "Polygon":
		if g.Coordinates == nil {
			return geom.NewPolygon(geom.NoLayout), nil
		}
		var coords [][]geom.Coord
		if err := json.Unmarshal(*g.Coordinates, &coords); err != nil {
			return nil, err
		}
		layout, err := guessLayout2(coords)
		if err != nil {
			return nil, err
		}
		return geom.NewPolygon(layout).SetCoords(coords)
	case "MultiPoint":
		if g.Coordinates == nil {
			return geom.NewMultiPoint(geom.NoLayout), nil
		}
		var coords []geom.Coord
		if err := json.Unmarshal(*g.Coordinates, &coords); err != nil {
			return nil, err
		}
		layout, err := guessLayout1(coords)
		if err != nil {
			return nil, err
		}
		return geom.NewMultiPoint(layout).SetCoords(coords)
	case "MultiLineString":
		if g.Coordinates == nil {
			return geom.NewMultiLineString(geom.NoLayout), nil
		}
		var coords [][]geom.Coord
		if err := json.Unmarshal(*g.Coordinates, &coords); err != nil {
			return nil, err
		}
		layout, err := guessLayout2(coords)
		if err != nil {
			return nil, err
		}
		return geom.NewMultiLineString(layout).SetCoords(coords)
	case "MultiPolygon":
		if g.Coordinates == nil {
			return geom.NewMultiPolygon(geom.NoLayout), nil
		}
		var coords [][][]geom.Coord
		if err := json.Unmarshal(*g.Coordinates, &coords); err != nil {
			return nil, err
		}
		layout, err := guessLayout3(coords)
		if err != nil {
			return nil, err
		}
		return geom.NewMultiPolygon(layout).SetCoords(coords)
	case "GeometryCollection":
		geoms := make([]geom.T, len(g.Geometries))
		for i, subGeometry := range g.Geometries {
			var err error
			geoms[i], err = subGeometry.Decode()
			if err != nil {
				return nil, err
			}
		}
		gc := geom.NewGeometryCollection()
		if err := gc.Push(geoms...); err != nil {
			return nil, err
		}
		return gc, nil
	default:
		return nil, ErrUnsupportedType(g.Type)
	}
}
479387
func Decode(h int64) (int32, int32) {
	var ry, rx int64
	var x, y int32
	t := h

	for s := int64(1); s < int64(n); s *= 2 {
		rx = 1 & (t / 2)
		ry = 1 & (t ^ rx)
		rotate(int32(s), int32(rx), int32(ry), &x, &y)
		x += int32(s * rx)
		y += int32(s * ry)
		t /= 4
	}

	return x, y
}
419991
func NewGlobalPositionSetpointInt(LATITUDE int32, LONGITUDE int32, ALTITUDE int32, YAW int16, COORDINATE_FRAME uint8) *GlobalPositionSetpointInt {
	m := GlobalPositionSetpointInt{}
	m.LATITUDE = LATITUDE
	m.LONGITUDE = LONGITUDE
	m.ALTITUDE = ALTITUDE
	m.YAW = YAW
	m.COORDINATE_FRAME = COORDINATE_FRAME
	return &m
}
868786
func (m *ParamValue) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.PARAM_VALUE)
	binary.Read(data, binary.LittleEndian, &m.PARAM_COUNT)
	binary.Read(data, binary.LittleEndian, &m.PARAM_INDEX)
	binary.Read(data, binary.LittleEndian, &m.PARAM_ID)
	binary.Read(data, binary.LittleEndian, &m.PARAM_TYPE)
}
318443
func (m *GpsInjectData) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM)
	binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT)
	binary.Read(data, binary.LittleEndian, &m.LEN)
	binary.Read(data, binary.LittleEndian, &m.DATA)
}
1202429
func (_ AlgebraicNotation) Decode(pos *Position, s string) (*Move, error) {
	s = removeSubstrings(s, "?", "!", "+", "#", "e.p.")
	for _, m := range pos.ValidMoves() {
		str := AlgebraicNotation{}.Encode(pos, m)
		str = removeSubstrings(str, "?", "!", "+", "#", "e.p.")
		if str == s {
			return m, nil
		}
	}
	return nil, fmt.Errorf("chess: could not decode algebraic notation %s for position %s", s, pos.String())
}
690246
func (m *VisionSpeedEstimate) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.USEC)
	binary.Read(data, binary.LittleEndian, &m.X)
	binary.Read(data, binary.LittleEndian, &m.Y)
	binary.Read(data, binary.LittleEndian, &m.Z)
}
612607
func (pl *Payload) Decode(data []byte) error {
	// Note that this method can't be named UnmarshalBinary, because the gob encoder would call
	// this method, resulting in infinite recursion.
	return pl.ReadBinary(bytes.NewBuffer(data))
}
536521
func Decode(d Decoder, data []byte) (Object, error) {
	obj, _, err := d.Decode(data, nil, nil)
	return obj, err
}
225559
func (jd *JSONDecoder) Decode(byteSet []byte) ([]*FileDataEntry, error) {
	if len(byteSet) == 0 {
		return []*FileDataEntry{}, nil
	}
	// Decode to type-specific structure
	jsonFile := jsonFile{}
	err := json.Unmarshal(byteSet, &jsonFile)
	if err != nil {
		return nil, fmt.Errorf("failed to decode json file: %v", err)
	}
	// Convert to common file data entry list structure
	var dataEntries []*FileDataEntry
	for _, dataEntry := range jsonFile.Data {
		dataEntries = append(dataEntries, &FileDataEntry{Key: dataEntry.Key, Value: dataEntry.Value})
	}
	return dataEntries, nil
}
889810
func (d *Decoder) Decode(payload []byte, fPort uint8) (map[string]interface{}, bool, error) {
	decoder := protocol.NewDecoder(bytes.NewBuffer(payload))
	d.result = make(map[string]interface{})
	if err := decoder.DecodeUplink(d); err != nil {
		return nil, false, err
	}
	return d.result, true, nil
}
55957
func Decode(out interface{}, in string) error {
	obj, err := Parse(in)
	if err != nil {
		return err
	}

	return DecodeObject(out, obj)
}
717411
func (c *FundingLocked) Decode(r io.Reader, pver uint32) error {
	return ReadElements(r,
		&c.ChanID,
		&c.NextPerCommitmentPoint)
}
25152
func (a *AnnounceSignatures) Decode(r io.Reader, pver uint32) error {
	err := ReadElements(r,
		&a.ChannelID,
		&a.ShortChannelID,
		&a.NodeSignature,
		&a.BitcoinSignature,
	)
	if err != nil {
		return err
	}

	// Now that we've read out all the fields that we explicitly know of,
	// we'll collect the remainder into the ExtraOpaqueData field. If there
	// aren't any bytes, then we'll snip off the slice to avoid carrying
	// around excess capacity.
	a.ExtraOpaqueData, err = ioutil.ReadAll(r)
	if err != nil {
		return err
	}
	if len(a.ExtraOpaqueData) == 0 {
		a.ExtraOpaqueData = nil
	}

	return nil
}