// UnmarshalBinary decodes a binary representation of the point into a point struct.
761675
func (p *point) UnmarshalBinary(b []byte) error {
	var n int

	// Read key length.
	if len(b) < 4 {
		return io.ErrShortBuffer
	}
	n, b = int(binary.BigEndian.Uint32(b[:4])), b[4:]

	// Read key.
	if len(b) < n {
		return io.ErrShortBuffer
	}
	p.key, b = b[:n], b[n:]

	// Read fields length.
	if len(b) < 4 {
		return io.ErrShortBuffer
	}
	n, b = int(binary.BigEndian.Uint32(b[:4])), b[4:]

	// Read fields.
	if len(b) < n {
		return io.ErrShortBuffer
	}
	p.fields, b = b[:n], b[n:]

	// Read timestamp.
	return p.time.UnmarshalBinary(b)
}
1249398
func (v *mvccValue) UnmarshalBinary(data []byte) error {
	var mh marshalHelper
	buf := bytes.NewBuffer(data)
	var vt int64
	mh.ReadNumber(buf, &vt)
	v.valueType = mvccValueType(vt)
	mh.ReadNumber(buf, &v.startTS)
	mh.ReadNumber(buf, &v.commitTS)
	mh.ReadSlice(buf, &v.value)
	return errors.Trace(mh.err)
}
224753
func (l *mvccLock) UnmarshalBinary(data []byte) error {
	var mh marshalHelper
	buf := bytes.NewBuffer(data)
	mh.ReadNumber(buf, &l.startTS)
	mh.ReadSlice(buf, &l.primary)
	mh.ReadSlice(buf, &l.value)
	mh.ReadNumber(buf, &l.op)
	mh.ReadNumber(buf, &l.ttl)
	return errors.Trace(mh.err)
}
1210789
func (m *ChMask) UnmarshalBinary(data []byte) error {
	if len(data) != 2 {
		return errors.New("lorawan: 2 bytes of data are expected")
	}
	for i, b := range data {
		for j := uint8(0); j < 8; j++ {
			if b&(1<<j) > 0 {
				m[uint8(i)*8+j] = true
			}
		}
	}
	return nil
}
1374794
func (p *RXParamSetupReqPayload) UnmarshalBinary(data []byte) error {
	if len(data) != 4 {
		return errors.New("lorawan: 4 bytes of data are expected")
	}
	if err := p.DLSettings.UnmarshalBinary(data[0:1]); err != nil {
		return err
	}
	// append one block of empty bits at the end of the slice since the
	// binary to uint32 expects 32 bits.
	b := make([]byte, len(data))
	copy(b, data)
	b = append(b, byte(0))
	p.Frequency = binary.LittleEndian.Uint32(b[1:5]) * 100
	return nil
}
1251040
func (h *MerkleHash) UnmarshalBinary(data []byte) error {
	return h.h.UnmarshalBinary(data)
}
183517
func (r *RequestCreateSessionV4) UnmarshalBinary(data []byte) error {
	buf := bytes.NewBuffer(data)

	fields := []*uint32{
		&r.NumCapabilities,
		&r.MaxPacketSize,
		&r.Flags,
		&r.Reserved,
	}

	for _, p := range fields {
		err := binary.Read(buf, binary.LittleEndian, p)
		if err != nil {
			return err
		}
	}

	for i := uint32(0); i < r.NumCapabilities; i++ {
		var cap Capability
		err := binary.Read(buf, binary.LittleEndian, &cap)
		if err != nil {
			return err
		}

		r.Capabilities = append(r.Capabilities, cap)
	}

	return nil
}
829602
func (u *UUID) UnmarshalBinary(data []byte) error {
	t := uuid.UUID{}
	err := t.UnmarshalBinary(data)
	for i, b := range t.Bytes() {
		u[i] = b
	}
	return err
}
524601
func (p *ADRParam) UnmarshalBinary(data []byte) error {
	if len(data) != 1 {
		return errors.New("lorawan: 1 byte of data is expected")
	}

	p.DelayExp = data[0] & ((1 << 3) | (1 << 2) | (1 << 1) | 1)
	p.LimitExp = (data[0] >> 4)

	return nil
}
20493
func (a *Sources) UnmarshalBinary(buf []byte) error {
	var pb internal.Measurements
	if err := proto.Unmarshal(buf, &pb); err != nil {
		return err
	}
	*a = make(Sources, len(pb.GetItems()))
	for i := range pb.GetItems() {
		mm, err := decodeMeasurement(pb.GetItems()[i])
		if err != nil {
			return err
		}
		(*a)[i] = mm
	}
	return nil
}
348591
func (s *StatusCode) UnmarshalBinary(p []byte) error {
	b := buffer.New(p)
	// Too short to contain valid StatusCode
	if b.Len() < 2 {
		return io.ErrUnexpectedEOF
	}

	s.Code = dhcp6.Status(b.Read16())
	s.Message = string(b.Remaining())
	return nil
}
3745
func (h *HLL) UnmarshalBinary(data []byte) error {
	var s serializable
	err := gob.NewDecoder(bytes.NewReader(data)).Decode(&s)
	if err != nil {
		return err
	}
	h.P = s.P
	h.m1 = s.M1
	h.m2 = s.M2
	h.alpha = s.Alpha
	h.format = s.Format
	h.tempSet = &s.TempSet
	h.sparseList = &s.SparseList
	h.registers = s.Registers

	if h.Hasher == nil {
		h.Hasher = MMH3Hash
	}
	return nil
}
111633
func (po *Po) UnmarshalBinary(data []byte) error {
	buff := bytes.NewBuffer(data)
	obj := new(TranslatorEncoding)

	decoder := gob.NewDecoder(buff)
	err := decoder.Decode(obj)
	if err != nil {
		return err
	}

	po.Headers = obj.Headers
	po.Language = obj.Language
	po.PluralForms = obj.PluralForms
	po.nplurals = obj.Nplurals
	po.plural = obj.Plural
	po.translations = obj.Translations
	po.contexts = obj.Contexts

	if expr, err := plurals.Compile(po.plural); err == nil {
		po.pluralforms = expr
	}

	return nil
}
1235638
func (n *NetID) UnmarshalBinary(data []byte) error {
	if len(data) != len(n) {
		return fmt.Errorf("lorawan: %d bytes of data are expected", len(n))
	}

	for i, v := range data {
		// little endian
		n[len(n)-1-i] = v
	}

	return nil
}
172963
func (f *FileNameV3) UnmarshalBinary(data []byte) error {
	buf := bytes.NewBuffer(data)

	fields := []interface{}{
		&f.Length, &f.Flags, &f.CaseType, &f.ID,
	}

	for _, p := range fields {
		if err := binary.Read(buf, binary.LittleEndian, p); err != nil {
			return err
		}
	}

	f.Name = string(buf.Next(int(f.Length)))

	return nil
}
580571
func (i *IPs) UnmarshalBinary(p []byte) error {
	b := buffer.New(p)
	if b.Len()%net.IPv6len != 0 || b.Len() == 0 {
		return io.ErrUnexpectedEOF
	}

	*i = make(IPs, 0, b.Len()/net.IPv6len)
	for b.Len() > 0 {
		ip := make(net.IP, net.IPv6len)
		b.ReadBytes(ip)
		*i = append(*i, ip)
	}
	return nil
}
944649
func (n *JoinNonce) UnmarshalBinary(data []byte) error {
	if len(data) != 3 {
		return errors.New("lorawan: 3 bytes are expected")
	}

	b := make([]byte, 4)
	copy(b[:3], data)
	*n = JoinNonce(binary.LittleEndian.Uint32(b))

	return nil
}