// DecodeToMacIface takes a byte buffer and converts decodes it using the gob
// package to a MacIface entry.
976688
func DecodeToMacIface(buf *bytes.Buffer) (MacIface, error) {
	var entry MacIface
	decoder := gob.NewDecoder(buf)
	err := decoder.Decode(&entry)
	return entry, err
}
648237
func (m *MemoryVect) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.ADDRESS)
	binary.Read(data, binary.LittleEndian, &m.VER)
	binary.Read(data, binary.LittleEndian, &m.TYPE)
	binary.Read(data, binary.LittleEndian, &m.VALUE)
}
463461
func (p *Buffer) DecodeZigzag32() (x uint64, err error) {
	x, err = p.DecodeVarint()
	if err != nil {
		return
	}
	x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31))
	return
}
130497
func Base64Decode(raw []byte) []byte {
	var buf bytes.Buffer
	buf.Write(raw)
	decoder := base64.NewDecoder(base64.StdEncoding, &buf)
	decoded, _ := ioutil.ReadAll(decoder)
	return decoded
}
223672
func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) {
	t := reflect.TypeOf(extension.ExtensionType)
	unmarshal := typeUnmarshaler(t, extension.Tag)

	// t is a pointer to a struct, pointer to basic type or a slice.
	// Allocate space to store the pointer/slice.
	value := reflect.New(t).Elem()

	var err error
	for {
		x, n := decodeVarint(b)
		if n == 0 {
			return nil, io.ErrUnexpectedEOF
		}
		b = b[n:]
		wire := int(x) & 7

		b, err = unmarshal(b, valToPointer(value.Addr()), wire)
		if err != nil {
			return nil, err
		}

		if len(b) == 0 {
			break
		}
	}
	return value.Interface(), nil
}
55967
func (b *GetLabelChunkBody) DecodeFromBytes(data []byte, version uint8) error {
	size := 9
	if version > 4 {
		size = 12
	}
	if len(data) < size {
		return fmt.Errorf("invalid message length for GET_LABEL_CHUNK response: %d<%d",
			len(data), size)
	}
	if version > 4 {
		b.Proto = data[0]
		b.Instance = binary.BigEndian.Uint16(data[1:3])
		data = data[3:]
	}
	b.Keep = data[0]
	b.Start = binary.BigEndian.Uint32(data[1:5])
	b.End = binary.BigEndian.Uint32(data[5:9])
	return nil
}
998461
func (z *Archive) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, err = dc.ReadMapHeader()
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "RowKey":
			z.RowKey, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "RowKey")
				return
			}
		case "SecondsPerPoint":
			z.SecondsPerPoint, err = dc.ReadUint32()
			if err != nil {
				err = msgp.WrapError(err, "SecondsPerPoint")
				return
			}
		case "Points":
			z.Points, err = dc.ReadUint32()
			if err != nil {
				err = msgp.WrapError(err, "Points")
				return
			}
		case "Chunks":
			var zb0002 uint32
			zb0002, err = dc.ReadArrayHeader()
			if err != nil {
				err = msgp.WrapError(err, "Chunks")
				return
			}
			if cap(z.Chunks) >= int(zb0002) {
				z.Chunks = (z.Chunks)[:zb0002]
			} else {
				z.Chunks = make([]chunk.IterGen, zb0002)
			}
			for za0001 := range z.Chunks {
				err = z.Chunks[za0001].DecodeMsg(dc)
				if err != nil {
					err = msgp.WrapError(err, "Chunks", za0001)
					return
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}
1237459
func fromDecodeHookFunc(hook DecodeHookFunc) mapstructure.DecodeHookFuncType {
	return func(from, to reflect.Type, data interface{}) (interface{}, error) {
		var value reflect.Value
		if data != nil {
			value = reflect.ValueOf(data)
		} else {
			// mapstructure is pretty good about giving us non-nil data but
			// let's process it gracefully anyway.
			value = reflect.Zero(from)
		}

		out, err := hook(from, to, value)
		if err != nil {
			return nil, err
		}

		return out.Interface(), nil
	}
}
1288481
func (dec *Decoder) Decode(pb proto.Message) error {
	buf, err := ioutil.ReadAll(dec.r)
	if err != nil {
		return err
	}

	return proto.Unmarshal(buf, pb)
}
1010429
func DecodeIntoRGBA(r io.Reader, options *DecoderOptions) (dest *image.RGBA, err error) {
	dinfo := newDecompress(r)
	if dinfo == nil {
		return nil, errors.New("allocation failed")
	}
	defer destroyDecompress(dinfo)

	// Recover panic
	defer func() {
		if r := recover(); r != nil {
			if _, ok := r.(error); !ok {
				err = fmt.Errorf("JPEG error: %v", r)
			}
		}
	}()

	C.jpeg_read_header(dinfo, C.TRUE)
	setupDecoderOptions(dinfo, options)

	C.jpeg_calc_output_dimensions(dinfo)
	dest = image.NewRGBA(image.Rect(0, 0, int(dinfo.output_width), int(dinfo.output_height)))

	colorSpace := getJCS_EXT_RGBA()
	if colorSpace == C.JCS_UNKNOWN {
		return nil, errors.New("JCS_EXT_RGBA is not supported (probably built without libjpeg-turbo)")
	}

	dinfo.out_color_space = colorSpace
	readScanLines(dinfo, dest.Pix, dest.Stride)
	return
}
264606
func (g GobEncoder) Decode(data []byte, v interface{}) error {
	e := gob.NewDecoder(bytes.NewBuffer(data))
	return e.Decode(v)
}
875085
func (s *StableBloomFilter) GobDecode(data []byte) error {
	buf := bytes.NewBuffer(data)
	_, err := s.ReadFrom(buf)
	return err
}
936755
func DecodeAction(data []byte) Action {
	t := binary.BigEndian.Uint16(data[:2])
	var a Action
	switch t {
	case ActionType_Output:
		a = new(ActionOutput)
	case ActionType_CopyTtlOut:
		a = new(ActionHeader)
	case ActionType_CopyTtlIn:
		a = new(ActionHeader)
	case ActionType_SetMplsTtl:
		a = new(ActionMplsTtl)
	case ActionType_DecMplsTtl:
		a = new(ActionHeader)
	case ActionType_PushVlan:
		a = new(ActionPush)
	case ActionType_PopVlan:
		a = new(ActionHeader)
	case ActionType_PushMpls:
		a = new(ActionPush)
	case ActionType_PopMpls:
		a = new(ActionPopMpls)
	case ActionType_SetQueue:
		a = new(ActionSetqueue)
	case ActionType_Group:
		a = new(ActionGroup)
	case ActionType_SetNwTtl:
		a = new(ActionNwTtl)
	case ActionType_DecNwTtl:
		a = new(ActionHeader)
	case ActionType_SetField:
		a = new(ActionSetField)
	case ActionType_PushPbb:
		a = new(ActionPush)
	case ActionType_PopPbb:
		a = new(ActionHeader)
	}
	a.UnmarshalBinary(data)
	return a
}
1202154
func DecodeBytes(buf []byte) (Store, error) {
	s := Store{}
	err := Decode(s, buf)
	if err != nil {
		return nil, err
	}

	return s, nil
}
1003782
func (z *Archive) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, err = dc.ReadMapHeader()
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "MetricDefinition":
			err = z.MetricDefinition.DecodeMsg(dc)
			if err != nil {
				err = msgp.WrapError(err, "MetricDefinition")
				return
			}
		case "SchemaId":
			z.SchemaId, err = dc.ReadUint16()
			if err != nil {
				err = msgp.WrapError(err, "SchemaId")
				return
			}
		case "AggId":
			z.AggId, err = dc.ReadUint16()
			if err != nil {
				err = msgp.WrapError(err, "AggId")
				return
			}
		case "IrId":
			z.IrId, err = dc.ReadUint16()
			if err != nil {
				err = msgp.WrapError(err, "IrId")
				return
			}
		case "LastSave":
			z.LastSave, err = dc.ReadUint32()
			if err != nil {
				err = msgp.WrapError(err, "LastSave")
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}
64938
func decodeAdministrativeCommunication(data []byte) (string, []byte) {
	if len(data) == 0 {
		return "", data
	}
	communicationLen := int(data[0])
	if communicationLen > bgp.BGP_ERROR_ADMINISTRATIVE_COMMUNICATION_MAX {
		communicationLen = bgp.BGP_ERROR_ADMINISTRATIVE_COMMUNICATION_MAX
	}
	if communicationLen > len(data)+1 {
		communicationLen = len(data) + 1
	}
	return string(data[1 : communicationLen+1]), data[communicationLen+1:]
}
524875
func DecodeUvarint(b []byte) ([]byte, uint64, error) {
	v, n := binary.Uvarint(b)
	if n > 0 {
		return b[n:], v, nil
	}
	if n < 0 {
		return nil, 0, errors.New("value larger than 64 bits")
	}
	return nil, 0, errors.New("insufficient bytes to decode value")
}