package msgpack
import (
)
func ( *Encoder) ( uint8) error {
return .write1(msgpcode.Uint8, )
}
func ( *Encoder) ( uint8) error {
if .flags&useCompactIntsFlag != 0 {
return .EncodeUint(uint64())
}
return .EncodeUint8()
}
func ( *Encoder) ( uint16) error {
return .write2(msgpcode.Uint16, )
}
func ( *Encoder) ( uint16) error {
if .flags&useCompactIntsFlag != 0 {
return .EncodeUint(uint64())
}
return .EncodeUint16()
}
func ( *Encoder) ( uint32) error {
return .write4(msgpcode.Uint32, )
}
func ( *Encoder) ( uint32) error {
if .flags&useCompactIntsFlag != 0 {
return .EncodeUint(uint64())
}
return .EncodeUint32()
}
func ( *Encoder) ( uint64) error {
return .write8(msgpcode.Uint64, )
}
func ( *Encoder) ( uint64) error {
if .flags&useCompactIntsFlag != 0 {
return .EncodeUint()
}
return .EncodeUint64()
}
func ( *Encoder) ( int8) error {
return .write1(msgpcode.Int8, uint8())
}
func ( *Encoder) ( int8) error {
if .flags&useCompactIntsFlag != 0 {
return .EncodeInt(int64())
}
return .EncodeInt8()
}
func ( *Encoder) ( int16) error {
return .write2(msgpcode.Int16, uint16())
}
func ( *Encoder) ( int16) error {
if .flags&useCompactIntsFlag != 0 {
return .EncodeInt(int64())
}
return .EncodeInt16()
}
func ( *Encoder) ( int32) error {
return .write4(msgpcode.Int32, uint32())
}
func ( *Encoder) ( int32) error {
if .flags&useCompactIntsFlag != 0 {
return .EncodeInt(int64())
}
return .EncodeInt32()
}
func ( *Encoder) ( int64) error {
return .write8(msgpcode.Int64, uint64())
}
func ( *Encoder) ( int64) error {
if .flags&useCompactIntsFlag != 0 {
return .EncodeInt()
}
return .EncodeInt64()
}
func ( *Encoder) ( uint64) error {
if <= math.MaxInt8 {
return .w.WriteByte(byte())
}
if <= math.MaxUint8 {
return .EncodeUint8(uint8())
}
if <= math.MaxUint16 {
return .EncodeUint16(uint16())
}
if <= math.MaxUint32 {
return .EncodeUint32(uint32())
}
return .EncodeUint64()
}
func ( *Encoder) ( int64) error {
if >= 0 {
return .EncodeUint(uint64())
}
if >= int64(int8(msgpcode.NegFixedNumLow)) {
return .w.WriteByte(byte())
}
if >= math.MinInt8 {
return .EncodeInt8(int8())
}
if >= math.MinInt16 {
return .EncodeInt16(int16())
}
if >= math.MinInt32 {
return .EncodeInt32(int32())
}
return .EncodeInt64()
}
func ( *Encoder) ( float32) error {
if .flags&useCompactFloatsFlag != 0 {
if float32(int64()) == {
return .EncodeInt(int64())
}
}
return .write4(msgpcode.Float, math.Float32bits())
}
func ( *Encoder) ( float64) error {
if .flags&useCompactFloatsFlag != 0 {
if float64(int64()) == {
return .EncodeInt(int64())
}
}
return .write8(msgpcode.Double, math.Float64bits())
}
func ( *Encoder) ( byte, uint8) error {
.buf = .buf[:2]
.buf[0] =
.buf[1] =
return .write(.buf)
}
func ( *Encoder) ( byte, uint16) error {
.buf = .buf[:3]
.buf[0] =
.buf[1] = byte( >> 8)
.buf[2] = byte()
return .write(.buf)
}
func ( *Encoder) ( byte, uint32) error {
.buf = .buf[:5]
.buf[0] =
.buf[1] = byte( >> 24)
.buf[2] = byte( >> 16)
.buf[3] = byte( >> 8)
.buf[4] = byte()
return .write(.buf)
}
func ( *Encoder) ( byte, uint64) error {
.buf = .buf[:9]
.buf[0] =
.buf[1] = byte( >> 56)
.buf[2] = byte( >> 48)
.buf[3] = byte( >> 40)
.buf[4] = byte( >> 32)
.buf[5] = byte( >> 24)
.buf[6] = byte( >> 16)
.buf[7] = byte( >> 8)
.buf[8] = byte()
return .write(.buf)
}
func ( *Encoder, reflect.Value) error {
return .EncodeUint(.Uint())
}
func ( *Encoder, reflect.Value) error {
return .EncodeInt(.Int())
}
func ( *Encoder, reflect.Value) error {
return .encodeUint8Cond(uint8(.Uint()))
}
func ( *Encoder, reflect.Value) error {
return .encodeUint16Cond(uint16(.Uint()))
}
func ( *Encoder, reflect.Value) error {
return .encodeUint32Cond(uint32(.Uint()))
}
func ( *Encoder, reflect.Value) error {
return .encodeUint64Cond(.Uint())
}
func ( *Encoder, reflect.Value) error {
return .encodeInt8Cond(int8(.Int()))
}
func ( *Encoder, reflect.Value) error {
return .encodeInt16Cond(int16(.Int()))
}
func ( *Encoder, reflect.Value) error {
return .encodeInt32Cond(int32(.Int()))
}
func ( *Encoder, reflect.Value) error {
return .encodeInt64Cond(.Int())
}
func ( *Encoder, reflect.Value) error {
return .EncodeFloat32(float32(.Float()))
}
func ( *Encoder, reflect.Value) error {
return .EncodeFloat64(.Float())
}