package msgpack
import (
)
func ( *Decoder) ( int) error {
, := .readN()
return
}
func ( *Decoder) () (uint8, error) {
, := .readCode()
if != nil {
return 0,
}
return , nil
}
func ( *Decoder) () (int8, error) {
, := .uint8()
return int8(),
}
func ( *Decoder) () (uint16, error) {
, := .readN(2)
if != nil {
return 0,
}
return (uint16([0]) << 8) | uint16([1]), nil
}
func ( *Decoder) () (int16, error) {
, := .uint16()
return int16(),
}
func ( *Decoder) () (uint32, error) {
, := .readN(4)
if != nil {
return 0,
}
:= (uint32([0]) << 24) |
(uint32([1]) << 16) |
(uint32([2]) << 8) |
uint32([3])
return , nil
}
func ( *Decoder) () (int32, error) {
, := .uint32()
return int32(),
}
func ( *Decoder) () (uint64, error) {
, := .readN(8)
if != nil {
return 0,
}
:= (uint64([0]) << 56) |
(uint64([1]) << 48) |
(uint64([2]) << 40) |
(uint64([3]) << 32) |
(uint64([4]) << 24) |
(uint64([5]) << 16) |
(uint64([6]) << 8) |
uint64([7])
return , nil
}
func ( *Decoder) () (int64, error) {
, := .uint64()
return int64(),
}
func ( *Decoder) () (uint64, error) {
, := .readCode()
if != nil {
return 0,
}
return .uint()
}
func ( *Decoder) ( byte) (uint64, error) {
if == msgpcode.Nil {
return 0, nil
}
if msgpcode.IsFixedNum() {
return uint64(int8()), nil
}
switch {
case msgpcode.Uint8:
, := .uint8()
return uint64(),
case msgpcode.Int8:
, := .int8()
return uint64(),
case msgpcode.Uint16:
, := .uint16()
return uint64(),
case msgpcode.Int16:
, := .int16()
return uint64(),
case msgpcode.Uint32:
, := .uint32()
return uint64(),
case msgpcode.Int32:
, := .int32()
return uint64(),
case msgpcode.Uint64, msgpcode.Int64:
return .uint64()
}
return 0, fmt.Errorf("msgpack: invalid code=%x decoding uint64", )
}
func ( *Decoder) () (int64, error) {
, := .readCode()
if != nil {
return 0,
}
return .int()
}
func ( *Decoder) ( byte) (int64, error) {
if == msgpcode.Nil {
return 0, nil
}
if msgpcode.IsFixedNum() {
return int64(int8()), nil
}
switch {
case msgpcode.Uint8:
, := .uint8()
return int64(),
case msgpcode.Int8:
, := .uint8()
return int64(int8()),
case msgpcode.Uint16:
, := .uint16()
return int64(),
case msgpcode.Int16:
, := .uint16()
return int64(int16()),
case msgpcode.Uint32:
, := .uint32()
return int64(),
case msgpcode.Int32:
, := .uint32()
return int64(int32()),
case msgpcode.Uint64, msgpcode.Int64:
, := .uint64()
return int64(),
}
return 0, fmt.Errorf("msgpack: invalid code=%x decoding int64", )
}
func ( *Decoder) () (float32, error) {
, := .readCode()
if != nil {
return 0,
}
return .float32()
}
func ( *Decoder) ( byte) (float32, error) {
if == msgpcode.Float {
, := .uint32()
if != nil {
return 0,
}
return math.Float32frombits(), nil
}
, := .int()
if != nil {
return 0, fmt.Errorf("msgpack: invalid code=%x decoding float32", )
}
return float32(), nil
}
func ( *Decoder) () (float64, error) {
, := .readCode()
if != nil {
return 0,
}
return .float64()
}
func ( *Decoder) ( byte) (float64, error) {
switch {
case msgpcode.Float:
, := .float32()
if != nil {
return 0,
}
return float64(), nil
case msgpcode.Double:
, := .uint64()
if != nil {
return 0,
}
return math.Float64frombits(), nil
}
, := .int()
if != nil {
return 0, fmt.Errorf("msgpack: invalid code=%x decoding float32", )
}
return float64(), nil
}
func ( *Decoder) () (uint, error) {
, := .DecodeUint64()
return uint(),
}
func ( *Decoder) () (uint8, error) {
, := .DecodeUint64()
return uint8(),
}
func ( *Decoder) () (uint16, error) {
, := .DecodeUint64()
return uint16(),
}
func ( *Decoder) () (uint32, error) {
, := .DecodeUint64()
return uint32(),
}
func ( *Decoder) () (int, error) {
, := .DecodeInt64()
return int(),
}
func ( *Decoder) () (int8, error) {
, := .DecodeInt64()
return int8(),
}
func ( *Decoder) () (int16, error) {
, := .DecodeInt64()
return int16(),
}
func ( *Decoder) () (int32, error) {
, := .DecodeInt64()
return int32(),
}
func ( *Decoder, reflect.Value) error {
, := .DecodeFloat32()
if != nil {
return
}
.SetFloat(float64())
return nil
}
func ( *Decoder, reflect.Value) error {
, := .DecodeFloat64()
if != nil {
return
}
.SetFloat()
return nil
}
func ( *Decoder, reflect.Value) error {
, := .DecodeInt64()
if != nil {
return
}
.SetInt()
return nil
}
func ( *Decoder, reflect.Value) error {
, := .DecodeUint64()
if != nil {
return
}
.SetUint()
return nil
}