// Code generated by thriftgo (0.3.15) (fastgo). DO NOT EDIT.
package example2

import (
	"encoding/binary"
	"fmt"
	"unsafe"

	"github.com/cloudwego/dynamicgo/testdata/kitex_gen/base"
	"github.com/cloudwego/gopkg/protocol/thrift"
)

var (
	_ = base.KitexUnusedProtection
)

func (p *InnerBase) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Bool ID:1 thrift.BOOL
	off += 3
	off += 1

	// p.Byte ID:2 thrift.I08
	off += 3
	off += 1

	// p.Int16 ID:3 thrift.I16
	off += 3
	off += 2

	// p.Int32 ID:4 thrift.I32
	off += 3
	off += 4

	// p.Int64 ID:5 thrift.I64
	off += 3
	off += 8

	// p.Double ID:6 thrift.DOUBLE
	off += 3
	off += 8

	// p.String_ ID:7 thrift.STRING
	off += 3
	off += 4 + len(p.String_)

	// p.ListInt32 ID:8 thrift.LIST
	off += 3
	off += 5
	off += len(p.ListInt32) * 4

	// p.MapStringString ID:9 thrift.MAP
	off += 3
	off += 6
	for k, v := range p.MapStringString {
		off += 4 + len(k)
		off += 4 + len(v)
	}

	// p.SetInt32 ID:10 thrift.SET
	off += 3
	off += 5
	off += len(p.SetInt32) * 4

	// p.Foo ID:11 thrift.I32
	off += 3
	off += 4

	// p.MapInt32String ID:12 thrift.MAP
	off += 3
	off += 6
	off += len(p.MapInt32String) * 4
	for _, v := range p.MapInt32String {
		off += 4 + len(v)
	}

	// p.Binary ID:13 thrift.STRING
	off += 3
	off += 4 + len(p.Binary)

	// p.MapInt8String ID:14 thrift.MAP
	off += 3
	off += 6
	off += len(p.MapInt8String) * 1
	for _, v := range p.MapInt8String {
		off += 4 + len(v)
	}

	// p.MapInt16String ID:15 thrift.MAP
	off += 3
	off += 6
	off += len(p.MapInt16String) * 2
	for _, v := range p.MapInt16String {
		off += 4 + len(v)
	}

	// p.MapInt64String ID:16 thrift.MAP
	off += 3
	off += 6
	off += len(p.MapInt64String) * 8
	for _, v := range p.MapInt64String {
		off += 4 + len(v)
	}

	// p.MapDoubleString ID:17 thrift.MAP
	off += 3
	off += 6
	off += len(p.MapDoubleString) * 8
	for _, v := range p.MapDoubleString {
		off += 4 + len(v)
	}

	// p.ListInnerBase ID:18 thrift.LIST
	off += 3
	off += 5
	for _, v := range p.ListInnerBase {
		off += v.BLength()
	}

	// p.MapInnerBaseInnerBase ID:19 thrift.MAP
	off += 3
	off += 6
	for k, v := range p.MapInnerBaseInnerBase {
		off += k.BLength()
		off += v.BLength()
	}

	// p.Base ID:255 thrift.STRUCT
	off += 3
	off += p.Base.BLength()
	return off + 1
}

func (p *InnerBase) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *InnerBase) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Bool ID:1 thrift.BOOL
	b[off] = 2
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	b[off] = *((*byte)(unsafe.Pointer(&p.Bool)))
	off++

	// p.Byte ID:2 thrift.I08
	b[off] = 3
	binary.BigEndian.PutUint16(b[off+1:], 2)
	off += 3
	b[off] = byte(p.Byte)
	off++

	// p.Int16 ID:3 thrift.I16
	b[off] = 6
	binary.BigEndian.PutUint16(b[off+1:], 3)
	off += 3
	binary.BigEndian.PutUint16(b[off:], uint16(p.Int16))
	off += 2

	// p.Int32 ID:4 thrift.I32
	b[off] = 8
	binary.BigEndian.PutUint16(b[off+1:], 4)
	off += 3
	binary.BigEndian.PutUint32(b[off:], uint32(p.Int32))
	off += 4

	// p.Int64 ID:5 thrift.I64
	b[off] = 10
	binary.BigEndian.PutUint16(b[off+1:], 5)
	off += 3
	binary.BigEndian.PutUint64(b[off:], uint64(p.Int64))
	off += 8

	// p.Double ID:6 thrift.DOUBLE
	b[off] = 4
	binary.BigEndian.PutUint16(b[off+1:], 6)
	off += 3
	binary.BigEndian.PutUint64(b[off:], *(*uint64)(unsafe.Pointer(&p.Double)))
	off += 8

	// p.String_ ID:7 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 7)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.String_)

	// p.ListInt32 ID:8 thrift.LIST
	b[off] = 15
	binary.BigEndian.PutUint16(b[off+1:], 8)
	off += 3
	b[off] = 8
	binary.BigEndian.PutUint32(b[off+1:], uint32(len(p.ListInt32)))
	off += 5
	for _, v := range p.ListInt32 {
		binary.BigEndian.PutUint32(b[off:], uint32(v))
		off += 4
	}

	// p.MapStringString ID:9 thrift.MAP
	b[off] = 13
	binary.BigEndian.PutUint16(b[off+1:], 9)
	off += 3
	b[off] = 11
	b[off+1] = 11
	binary.BigEndian.PutUint32(b[off+2:], uint32(len(p.MapStringString)))
	off += 6
	for k, v := range p.MapStringString {
		off += thrift.Binary.WriteStringNocopy(b[off:], w, k)
		off += thrift.Binary.WriteStringNocopy(b[off:], w, v)
	}

	// p.SetInt32 ID:10 thrift.SET
	b[off] = 14
	binary.BigEndian.PutUint16(b[off+1:], 10)
	off += 3
	b[off] = 8
	binary.BigEndian.PutUint32(b[off+1:], uint32(len(p.SetInt32)))
	off += 5
	for _, v := range p.SetInt32 {
		binary.BigEndian.PutUint32(b[off:], uint32(v))
		off += 4
	}

	// p.Foo ID:11 thrift.I32
	b[off] = 8
	binary.BigEndian.PutUint16(b[off+1:], 11)
	off += 3
	binary.BigEndian.PutUint32(b[off:], uint32(p.Foo))
	off += 4

	// p.MapInt32String ID:12 thrift.MAP
	b[off] = 13
	binary.BigEndian.PutUint16(b[off+1:], 12)
	off += 3
	b[off] = 8
	b[off+1] = 11
	binary.BigEndian.PutUint32(b[off+2:], uint32(len(p.MapInt32String)))
	off += 6
	for k, v := range p.MapInt32String {
		binary.BigEndian.PutUint32(b[off:], uint32(k))
		off += 4
		off += thrift.Binary.WriteStringNocopy(b[off:], w, v)
	}

	// p.Binary ID:13 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 13)
	off += 3
	off += thrift.Binary.WriteBinaryNocopy(b[off:], w, p.Binary)

	// p.MapInt8String ID:14 thrift.MAP
	b[off] = 13
	binary.BigEndian.PutUint16(b[off+1:], 14)
	off += 3
	b[off] = 3
	b[off+1] = 11
	binary.BigEndian.PutUint32(b[off+2:], uint32(len(p.MapInt8String)))
	off += 6
	for k, v := range p.MapInt8String {
		b[off] = byte(k)
		off++
		off += thrift.Binary.WriteStringNocopy(b[off:], w, v)
	}

	// p.MapInt16String ID:15 thrift.MAP
	b[off] = 13
	binary.BigEndian.PutUint16(b[off+1:], 15)
	off += 3
	b[off] = 6
	b[off+1] = 11
	binary.BigEndian.PutUint32(b[off+2:], uint32(len(p.MapInt16String)))
	off += 6
	for k, v := range p.MapInt16String {
		binary.BigEndian.PutUint16(b[off:], uint16(k))
		off += 2
		off += thrift.Binary.WriteStringNocopy(b[off:], w, v)
	}

	// p.MapInt64String ID:16 thrift.MAP
	b[off] = 13
	binary.BigEndian.PutUint16(b[off+1:], 16)
	off += 3
	b[off] = 10
	b[off+1] = 11
	binary.BigEndian.PutUint32(b[off+2:], uint32(len(p.MapInt64String)))
	off += 6
	for k, v := range p.MapInt64String {
		binary.BigEndian.PutUint64(b[off:], uint64(k))
		off += 8
		off += thrift.Binary.WriteStringNocopy(b[off:], w, v)
	}

	// p.MapDoubleString ID:17 thrift.MAP
	b[off] = 13
	binary.BigEndian.PutUint16(b[off+1:], 17)
	off += 3
	b[off] = 4
	b[off+1] = 11
	binary.BigEndian.PutUint32(b[off+2:], uint32(len(p.MapDoubleString)))
	off += 6
	for k, v := range p.MapDoubleString {
		binary.BigEndian.PutUint64(b[off:], *(*uint64)(unsafe.Pointer(&k)))
		off += 8
		off += thrift.Binary.WriteStringNocopy(b[off:], w, v)
	}

	// p.ListInnerBase ID:18 thrift.LIST
	b[off] = 15
	binary.BigEndian.PutUint16(b[off+1:], 18)
	off += 3
	b[off] = 12
	binary.BigEndian.PutUint32(b[off+1:], uint32(len(p.ListInnerBase)))
	off += 5
	for _, v := range p.ListInnerBase {
		off += v.FastWriteNocopy(b[off:], w)
	}

	// p.MapInnerBaseInnerBase ID:19 thrift.MAP
	b[off] = 13
	binary.BigEndian.PutUint16(b[off+1:], 19)
	off += 3
	b[off] = 12
	b[off+1] = 12
	binary.BigEndian.PutUint32(b[off+2:], uint32(len(p.MapInnerBaseInnerBase)))
	off += 6
	for k, v := range p.MapInnerBaseInnerBase {
		off += k.FastWriteNocopy(b[off:], w)
		off += v.FastWriteNocopy(b[off:], w)
	}

	// p.Base ID:255 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 255)
	off += 3
	off += p.Base.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *InnerBase) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	var enum int32
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x102: // p.Bool ID:1 thrift.BOOL
			p.Bool, l, err = x.ReadBool(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x203: // p.Byte ID:2 thrift.I08
			p.Byte, l, err = x.ReadByte(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x306: // p.Int16 ID:3 thrift.I16
			p.Int16, l, err = x.ReadI16(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x408: // p.Int32 ID:4 thrift.I32
			p.Int32, l, err = x.ReadI32(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x50a: // p.Int64 ID:5 thrift.I64
			p.Int64, l, err = x.ReadI64(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x604: // p.Double ID:6 thrift.DOUBLE
			p.Double, l, err = x.ReadDouble(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x70b: // p.String_ ID:7 thrift.STRING
			p.String_, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x80f: // p.ListInt32 ID:8 thrift.LIST
			var sz int
			_, sz, l, err = x.ReadListBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.ListInt32 = make([]int32, sz)
			for i := 0; i < sz; i++ {
				p.ListInt32[i], l, err = x.ReadI32(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
			}
		case 0x90d: // p.MapStringString ID:9 thrift.MAP
			var sz int
			_, _, sz, l, err = x.ReadMapBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.MapStringString = make(map[string]string, sz)
			for i := 0; i < sz; i++ {
				var k string
				var v string
				k, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				v, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				p.MapStringString[k] = v
			}
		case 0xa0e: // p.SetInt32 ID:10 thrift.SET
			var sz int
			_, sz, l, err = x.ReadListBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.SetInt32 = make([]int32, sz)
			for i := 0; i < sz; i++ {
				p.SetInt32[i], l, err = x.ReadI32(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
			}
		case 0xb08: // p.Foo ID:11 thrift.I32
			enum, l, err = x.ReadI32(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.Foo = FOO(enum)
		case 0xc0d: // p.MapInt32String ID:12 thrift.MAP
			var sz int
			_, _, sz, l, err = x.ReadMapBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.MapInt32String = make(map[int32]string, sz)
			for i := 0; i < sz; i++ {
				var k int32
				var v string
				k, l, err = x.ReadI32(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				v, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				p.MapInt32String[k] = v
			}
		case 0xd0b: // p.Binary ID:13 thrift.STRING
			p.Binary, l, err = x.ReadBinary(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0xe0d: // p.MapInt8String ID:14 thrift.MAP
			var sz int
			_, _, sz, l, err = x.ReadMapBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.MapInt8String = make(map[int8]string, sz)
			for i := 0; i < sz; i++ {
				var k int8
				var v string
				k, l, err = x.ReadByte(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				v, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				p.MapInt8String[k] = v
			}
		case 0xf0d: // p.MapInt16String ID:15 thrift.MAP
			var sz int
			_, _, sz, l, err = x.ReadMapBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.MapInt16String = make(map[int16]string, sz)
			for i := 0; i < sz; i++ {
				var k int16
				var v string
				k, l, err = x.ReadI16(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				v, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				p.MapInt16String[k] = v
			}
		case 0x100d: // p.MapInt64String ID:16 thrift.MAP
			var sz int
			_, _, sz, l, err = x.ReadMapBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.MapInt64String = make(map[int64]string, sz)
			for i := 0; i < sz; i++ {
				var k int64
				var v string
				k, l, err = x.ReadI64(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				v, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				p.MapInt64String[k] = v
			}
		case 0x110d: // p.MapDoubleString ID:17 thrift.MAP
			var sz int
			_, _, sz, l, err = x.ReadMapBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.MapDoubleString = make(map[float64]string, sz)
			for i := 0; i < sz; i++ {
				var k float64
				var v string
				k, l, err = x.ReadDouble(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				v, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				p.MapDoubleString[k] = v
			}
		case 0x120f: // p.ListInnerBase ID:18 thrift.LIST
			var sz int
			_, sz, l, err = x.ReadListBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.ListInnerBase = make([]*InnerBase, sz)
			for i := 0; i < sz; i++ {
				p.ListInnerBase[i] = NewInnerBase()
				l, err = p.ListInnerBase[i].FastRead(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
			}
		case 0x130d: // p.MapInnerBaseInnerBase ID:19 thrift.MAP
			var sz int
			_, _, sz, l, err = x.ReadMapBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.MapInnerBaseInnerBase = make(map[*InnerBase]*InnerBase, sz)
			for i := 0; i < sz; i++ {
				var k *InnerBase
				var v *InnerBase
				k = NewInnerBase()
				l, err = k.FastRead(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				v = NewInnerBase()
				l, err = v.FastRead(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				p.MapInnerBaseInnerBase[k] = v
			}
		case 0xff0c: // p.Base ID:255 thrift.STRUCT
			p.Base = base.NewBase()
			l, err = p.Base.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_InnerBase[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *InnerBasePartial) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Bool ID:1 thrift.BOOL
	off += 3
	off += 1

	// p.ListInt32 ID:8 thrift.LIST
	off += 3
	off += 5
	off += len(p.ListInt32) * 4

	// p.MapStringString ID:9 thrift.MAP
	off += 3
	off += 6
	for k, v := range p.MapStringString {
		off += 4 + len(k)
		off += 4 + len(v)
	}

	// p.MapDoubleString ID:17 thrift.MAP
	off += 3
	off += 6
	off += len(p.MapDoubleString) * 8
	for _, v := range p.MapDoubleString {
		off += 4 + len(v)
	}

	// p.ListInnerBase ID:18 thrift.LIST
	off += 3
	off += 5
	for _, v := range p.ListInnerBase {
		off += v.BLength()
	}

	// p.MapInnerBaseInnerBase ID:19 thrift.MAP
	off += 3
	off += 6
	for k, v := range p.MapInnerBaseInnerBase {
		off += k.BLength()
		off += v.BLength()
	}

	// p.MapStringString2 ID:127 thrift.MAP
	off += 3
	off += 6
	for k, v := range p.MapStringString2 {
		off += 4 + len(k)
		off += 4 + len(v)
	}
	return off + 1
}

func (p *InnerBasePartial) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *InnerBasePartial) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Bool ID:1 thrift.BOOL
	b[off] = 2
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	b[off] = *((*byte)(unsafe.Pointer(&p.Bool)))
	off++

	// p.ListInt32 ID:8 thrift.LIST
	b[off] = 15
	binary.BigEndian.PutUint16(b[off+1:], 8)
	off += 3
	b[off] = 8
	binary.BigEndian.PutUint32(b[off+1:], uint32(len(p.ListInt32)))
	off += 5
	for _, v := range p.ListInt32 {
		binary.BigEndian.PutUint32(b[off:], uint32(v))
		off += 4
	}

	// p.MapStringString ID:9 thrift.MAP
	b[off] = 13
	binary.BigEndian.PutUint16(b[off+1:], 9)
	off += 3
	b[off] = 11
	b[off+1] = 11
	binary.BigEndian.PutUint32(b[off+2:], uint32(len(p.MapStringString)))
	off += 6
	for k, v := range p.MapStringString {
		off += thrift.Binary.WriteStringNocopy(b[off:], w, k)
		off += thrift.Binary.WriteStringNocopy(b[off:], w, v)
	}

	// p.MapDoubleString ID:17 thrift.MAP
	b[off] = 13
	binary.BigEndian.PutUint16(b[off+1:], 17)
	off += 3
	b[off] = 4
	b[off+1] = 11
	binary.BigEndian.PutUint32(b[off+2:], uint32(len(p.MapDoubleString)))
	off += 6
	for k, v := range p.MapDoubleString {
		binary.BigEndian.PutUint64(b[off:], *(*uint64)(unsafe.Pointer(&k)))
		off += 8
		off += thrift.Binary.WriteStringNocopy(b[off:], w, v)
	}

	// p.ListInnerBase ID:18 thrift.LIST
	b[off] = 15
	binary.BigEndian.PutUint16(b[off+1:], 18)
	off += 3
	b[off] = 12
	binary.BigEndian.PutUint32(b[off+1:], uint32(len(p.ListInnerBase)))
	off += 5
	for _, v := range p.ListInnerBase {
		off += v.FastWriteNocopy(b[off:], w)
	}

	// p.MapInnerBaseInnerBase ID:19 thrift.MAP
	b[off] = 13
	binary.BigEndian.PutUint16(b[off+1:], 19)
	off += 3
	b[off] = 12
	b[off+1] = 12
	binary.BigEndian.PutUint32(b[off+2:], uint32(len(p.MapInnerBaseInnerBase)))
	off += 6
	for k, v := range p.MapInnerBaseInnerBase {
		off += k.FastWriteNocopy(b[off:], w)
		off += v.FastWriteNocopy(b[off:], w)
	}

	// p.MapStringString2 ID:127 thrift.MAP
	b[off] = 13
	binary.BigEndian.PutUint16(b[off+1:], 127)
	off += 3
	b[off] = 11
	b[off+1] = 11
	binary.BigEndian.PutUint32(b[off+2:], uint32(len(p.MapStringString2)))
	off += 6
	for k, v := range p.MapStringString2 {
		off += thrift.Binary.WriteStringNocopy(b[off:], w, k)
		off += thrift.Binary.WriteStringNocopy(b[off:], w, v)
	}

	b[off] = 0
	return off + 1
}

func (p *InnerBasePartial) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x102: // p.Bool ID:1 thrift.BOOL
			p.Bool, l, err = x.ReadBool(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x80f: // p.ListInt32 ID:8 thrift.LIST
			var sz int
			_, sz, l, err = x.ReadListBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.ListInt32 = make([]int32, sz)
			for i := 0; i < sz; i++ {
				p.ListInt32[i], l, err = x.ReadI32(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
			}
		case 0x90d: // p.MapStringString ID:9 thrift.MAP
			var sz int
			_, _, sz, l, err = x.ReadMapBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.MapStringString = make(map[string]string, sz)
			for i := 0; i < sz; i++ {
				var k string
				var v string
				k, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				v, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				p.MapStringString[k] = v
			}
		case 0x110d: // p.MapDoubleString ID:17 thrift.MAP
			var sz int
			_, _, sz, l, err = x.ReadMapBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.MapDoubleString = make(map[float64]string, sz)
			for i := 0; i < sz; i++ {
				var k float64
				var v string
				k, l, err = x.ReadDouble(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				v, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				p.MapDoubleString[k] = v
			}
		case 0x120f: // p.ListInnerBase ID:18 thrift.LIST
			var sz int
			_, sz, l, err = x.ReadListBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.ListInnerBase = make([]*InnerBasePartial, sz)
			for i := 0; i < sz; i++ {
				p.ListInnerBase[i] = NewInnerBasePartial()
				l, err = p.ListInnerBase[i].FastRead(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
			}
		case 0x130d: // p.MapInnerBaseInnerBase ID:19 thrift.MAP
			var sz int
			_, _, sz, l, err = x.ReadMapBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.MapInnerBaseInnerBase = make(map[*InnerBasePartial]*InnerBasePartial, sz)
			for i := 0; i < sz; i++ {
				var k *InnerBasePartial
				var v *InnerBasePartial
				k = NewInnerBasePartial()
				l, err = k.FastRead(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				v = NewInnerBasePartial()
				l, err = v.FastRead(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				p.MapInnerBaseInnerBase[k] = v
			}
		case 0x7f0d: // p.MapStringString2 ID:127 thrift.MAP
			var sz int
			_, _, sz, l, err = x.ReadMapBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.MapStringString2 = make(map[string]string, sz)
			for i := 0; i < sz; i++ {
				var k string
				var v string
				k, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				v, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				p.MapStringString2[k] = v
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_InnerBasePartial[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *BasePartial) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.TrafficEnv ID:5 thrift.STRUCT
	if p.TrafficEnv != nil {
		off += 3
		off += p.TrafficEnv.BLength()
	}
	return off + 1
}

func (p *BasePartial) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *BasePartial) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.TrafficEnv ID:5 thrift.STRUCT
	if p.TrafficEnv != nil {
		b[off] = 12
		binary.BigEndian.PutUint16(b[off+1:], 5)
		off += 3
		off += p.TrafficEnv.FastWriteNocopy(b[off:], w)
	}

	b[off] = 0
	return off + 1
}

func (p *BasePartial) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x50c: // p.TrafficEnv ID:5 thrift.STRUCT
			p.TrafficEnv = base.NewTrafficEnv()
			l, err = p.TrafficEnv.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_BasePartial[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleReq) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		off += 3
		off += 4 + len(*p.Msg)
	}

	// p.A ID:2 thrift.I32
	if p.A != nil {
		off += 3
		off += 4
	}

	// p.InnerBase ID:3 thrift.STRUCT
	off += 3
	off += p.InnerBase.BLength()

	// p.Base ID:255 thrift.STRUCT
	off += 3
	off += p.Base.BLength()

	// p.Subfix ID:32767 thrift.DOUBLE
	off += 3
	off += 8
	return off + 1
}

func (p *ExampleReq) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleReq) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		b[off] = 11
		binary.BigEndian.PutUint16(b[off+1:], 1)
		off += 3
		off += thrift.Binary.WriteStringNocopy(b[off:], w, *p.Msg)
	}

	// p.A ID:2 thrift.I32
	if p.A != nil {
		b[off] = 8
		binary.BigEndian.PutUint16(b[off+1:], 2)
		off += 3
		binary.BigEndian.PutUint32(b[off:], uint32(*p.A))
		off += 4
	}

	// p.InnerBase ID:3 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 3)
	off += 3
	off += p.InnerBase.FastWriteNocopy(b[off:], w)

	// p.Base ID:255 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 255)
	off += 3
	off += p.Base.FastWriteNocopy(b[off:], w)

	// p.Subfix ID:32767 thrift.DOUBLE
	b[off] = 4
	binary.BigEndian.PutUint16(b[off+1:], 32767)
	off += 3
	binary.BigEndian.PutUint64(b[off:], *(*uint64)(unsafe.Pointer(&p.Subfix)))
	off += 8

	b[off] = 0
	return off + 1
}

func (p *ExampleReq) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	var isset uint8
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Msg ID:1 thrift.STRING
			if p.Msg == nil {
				p.Msg = new(string)
			}
			*p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x208: // p.A ID:2 thrift.I32
			if p.A == nil {
				p.A = new(int32)
			}
			*p.A, l, err = x.ReadI32(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x30c: // p.InnerBase ID:3 thrift.STRUCT
			p.InnerBase = NewInnerBase()
			l, err = p.InnerBase.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0xff0c: // p.Base ID:255 thrift.STRUCT
			p.Base = base.NewBase()
			l, err = p.Base.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			isset |= 0x1
		case 0x7fff04: // p.Subfix ID:32767 thrift.DOUBLE
			p.Subfix, l, err = x.ReadDouble(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	if isset&0x1 == 0 {
		fid = 255 // Base
		goto RequiredFieldNotSetError
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleReq[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
RequiredFieldNotSetError:
	return off, thrift.NewProtocolException(thrift.INVALID_DATA, fmt.Sprintf("required field %s is not set", fieldIDToName_ExampleReq[fid]))
}

func (p *ExampleSuper) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		off += 3
		off += 4 + len(*p.Msg)
	}

	// p.A ID:2 thrift.I32
	if p.A != nil {
		off += 3
		off += 4
	}

	// p.InnerBase ID:3 thrift.STRUCT
	off += 3
	off += p.InnerBase.BLength()

	// p.Ex1 ID:4 thrift.STRING
	off += 3
	off += 4 + len(p.Ex1)

	// p.Ex2 ID:5 thrift.STRING
	if p.Ex2 != nil {
		off += 3
		off += 4 + len(*p.Ex2)
	}

	// p.Ex3 ID:6 thrift.STRING
	if p.Ex3 != nil {
		off += 3
		off += 4 + len(*p.Ex3)
	}

	// p.Ex4 ID:7 thrift.STRING
	off += 3
	off += 4 + len(p.Ex4)

	// p.SelfRef ID:9 thrift.STRUCT
	off += 3
	off += p.SelfRef.BLength()

	// p.Base ID:255 thrift.STRUCT
	off += 3
	off += p.Base.BLength()

	// p.Subfix ID:32767 thrift.DOUBLE
	off += 3
	off += 8
	return off + 1
}

func (p *ExampleSuper) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleSuper) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		b[off] = 11
		binary.BigEndian.PutUint16(b[off+1:], 1)
		off += 3
		off += thrift.Binary.WriteStringNocopy(b[off:], w, *p.Msg)
	}

	// p.A ID:2 thrift.I32
	if p.A != nil {
		b[off] = 8
		binary.BigEndian.PutUint16(b[off+1:], 2)
		off += 3
		binary.BigEndian.PutUint32(b[off:], uint32(*p.A))
		off += 4
	}

	// p.InnerBase ID:3 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 3)
	off += 3
	off += p.InnerBase.FastWriteNocopy(b[off:], w)

	// p.Ex1 ID:4 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 4)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.Ex1)

	// p.Ex2 ID:5 thrift.STRING
	if p.Ex2 != nil {
		b[off] = 11
		binary.BigEndian.PutUint16(b[off+1:], 5)
		off += 3
		off += thrift.Binary.WriteStringNocopy(b[off:], w, *p.Ex2)
	}

	// p.Ex3 ID:6 thrift.STRING
	if p.Ex3 != nil {
		b[off] = 11
		binary.BigEndian.PutUint16(b[off+1:], 6)
		off += 3
		off += thrift.Binary.WriteStringNocopy(b[off:], w, *p.Ex3)
	}

	// p.Ex4 ID:7 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 7)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.Ex4)

	// p.SelfRef ID:9 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 9)
	off += 3
	off += p.SelfRef.FastWriteNocopy(b[off:], w)

	// p.Base ID:255 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 255)
	off += 3
	off += p.Base.FastWriteNocopy(b[off:], w)

	// p.Subfix ID:32767 thrift.DOUBLE
	b[off] = 4
	binary.BigEndian.PutUint16(b[off+1:], 32767)
	off += 3
	binary.BigEndian.PutUint64(b[off:], *(*uint64)(unsafe.Pointer(&p.Subfix)))
	off += 8

	b[off] = 0
	return off + 1
}

func (p *ExampleSuper) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	var isset uint8
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Msg ID:1 thrift.STRING
			if p.Msg == nil {
				p.Msg = new(string)
			}
			*p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x208: // p.A ID:2 thrift.I32
			if p.A == nil {
				p.A = new(int32)
			}
			*p.A, l, err = x.ReadI32(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x30c: // p.InnerBase ID:3 thrift.STRUCT
			p.InnerBase = NewInnerBase()
			l, err = p.InnerBase.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x40b: // p.Ex1 ID:4 thrift.STRING
			p.Ex1, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x50b: // p.Ex2 ID:5 thrift.STRING
			if p.Ex2 == nil {
				p.Ex2 = new(string)
			}
			*p.Ex2, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x60b: // p.Ex3 ID:6 thrift.STRING
			if p.Ex3 == nil {
				p.Ex3 = new(string)
			}
			*p.Ex3, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x70b: // p.Ex4 ID:7 thrift.STRING
			p.Ex4, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			isset |= 0x1
		case 0x90c: // p.SelfRef ID:9 thrift.STRUCT
			p.SelfRef = NewSelfRef()
			l, err = p.SelfRef.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0xff0c: // p.Base ID:255 thrift.STRUCT
			p.Base = base.NewBase()
			l, err = p.Base.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			isset |= 0x2
		case 0x7fff04: // p.Subfix ID:32767 thrift.DOUBLE
			p.Subfix, l, err = x.ReadDouble(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	if isset&0x1 == 0 {
		fid = 7 // Ex4
		goto RequiredFieldNotSetError
	}
	if isset&0x2 == 0 {
		fid = 255 // Base
		goto RequiredFieldNotSetError
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleSuper[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
RequiredFieldNotSetError:
	return off, thrift.NewProtocolException(thrift.INVALID_DATA, fmt.Sprintf("required field %s is not set", fieldIDToName_ExampleSuper[fid]))
}

func (p *SelfRef) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Self ID:1 thrift.STRUCT
	if p.Self != nil {
		off += 3
		off += p.Self.BLength()
	}
	return off + 1
}

func (p *SelfRef) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *SelfRef) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Self ID:1 thrift.STRUCT
	if p.Self != nil {
		b[off] = 12
		binary.BigEndian.PutUint16(b[off+1:], 1)
		off += 3
		off += p.Self.FastWriteNocopy(b[off:], w)
	}

	b[off] = 0
	return off + 1
}

func (p *SelfRef) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10c: // p.Self ID:1 thrift.STRUCT
			p.Self = NewSelfRef()
			l, err = p.Self.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_SelfRef[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleReqPartial) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		off += 3
		off += 4 + len(*p.Msg)
	}

	// p.InnerBase ID:3 thrift.STRUCT
	off += 3
	off += p.InnerBase.BLength()

	// p.Base ID:255 thrift.STRUCT
	off += 3
	off += p.Base.BLength()
	return off + 1
}

func (p *ExampleReqPartial) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleReqPartial) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		b[off] = 11
		binary.BigEndian.PutUint16(b[off+1:], 1)
		off += 3
		off += thrift.Binary.WriteStringNocopy(b[off:], w, *p.Msg)
	}

	// p.InnerBase ID:3 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 3)
	off += 3
	off += p.InnerBase.FastWriteNocopy(b[off:], w)

	// p.Base ID:255 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 255)
	off += 3
	off += p.Base.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *ExampleReqPartial) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Msg ID:1 thrift.STRING
			if p.Msg == nil {
				p.Msg = new(string)
			}
			*p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x30c: // p.InnerBase ID:3 thrift.STRUCT
			p.InnerBase = NewInnerBasePartial()
			l, err = p.InnerBase.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0xff0c: // p.Base ID:255 thrift.STRUCT
			p.Base = NewBasePartial()
			l, err = p.Base.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleReqPartial[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleResp) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		off += 3
		off += 4 + len(*p.Msg)
	}

	// p.RequiredField ID:2 thrift.STRING
	off += 3
	off += 4 + len(p.RequiredField)

	// p.BaseResp ID:255 thrift.STRUCT
	off += 3
	off += p.BaseResp.BLength()
	return off + 1
}

func (p *ExampleResp) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleResp) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		b[off] = 11
		binary.BigEndian.PutUint16(b[off+1:], 1)
		off += 3
		off += thrift.Binary.WriteStringNocopy(b[off:], w, *p.Msg)
	}

	// p.RequiredField ID:2 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 2)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.RequiredField)

	// p.BaseResp ID:255 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 255)
	off += 3
	off += p.BaseResp.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *ExampleResp) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	var isset uint8
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Msg ID:1 thrift.STRING
			if p.Msg == nil {
				p.Msg = new(string)
			}
			*p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x20b: // p.RequiredField ID:2 thrift.STRING
			p.RequiredField, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			isset |= 0x1
		case 0xff0c: // p.BaseResp ID:255 thrift.STRUCT
			p.BaseResp = base.NewBaseResp()
			l, err = p.BaseResp.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	if isset&0x1 == 0 {
		fid = 2 // RequiredField
		goto RequiredFieldNotSetError
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleResp[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
RequiredFieldNotSetError:
	return off, thrift.NewProtocolException(thrift.INVALID_DATA, fmt.Sprintf("required field %s is not set", fieldIDToName_ExampleResp[fid]))
}

func (p *A) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Self ID:1 thrift.STRUCT
	off += 3
	off += p.Self.BLength()
	return off + 1
}

func (p *A) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *A) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Self ID:1 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += p.Self.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *A) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10c: // p.Self ID:1 thrift.STRUCT
			p.Self = NewA()
			l, err = p.Self.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_A[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *Exception) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Code ID:1 thrift.I32
	off += 3
	off += 4

	// p.Msg ID:255 thrift.STRING
	off += 3
	off += 4 + len(p.Msg)
	return off + 1
}

func (p *Exception) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *Exception) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Code ID:1 thrift.I32
	b[off] = 8
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	binary.BigEndian.PutUint32(b[off:], uint32(p.Code))
	off += 4

	// p.Msg ID:255 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 255)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.Msg)

	b[off] = 0
	return off + 1
}

func (p *Exception) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x108: // p.Code ID:1 thrift.I32
			p.Code, l, err = x.ReadI32(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0xff0b: // p.Msg ID:255 thrift.STRING
			p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_Exception[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExampleMethodArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	off += 3
	off += p.Req.BLength()
	return off + 1
}

func (p *ExampleServiceExampleMethodArgs) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceExampleMethodArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += p.Req.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExampleMethodArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10c: // p.Req ID:1 thrift.STRUCT
			p.Req = NewExampleReq()
			l, err = p.Req.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceExampleMethodArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExampleMethodResult) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		off += 3
		off += p.Success.BLength()
	}

	// p.Err ID:1 thrift.STRUCT
	if p.Err != nil {
		off += 3
		off += p.Err.BLength()
	}
	return off + 1
}

func (p *ExampleServiceExampleMethodResult) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceExampleMethodResult) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		b[off] = 12
		binary.BigEndian.PutUint16(b[off+1:], 0)
		off += 3
		off += p.Success.FastWriteNocopy(b[off:], w)
	}

	// p.Err ID:1 thrift.STRUCT
	if p.Err != nil {
		b[off] = 12
		binary.BigEndian.PutUint16(b[off+1:], 1)
		off += 3
		off += p.Err.FastWriteNocopy(b[off:], w)
	}

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExampleMethodResult) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0xc: // p.Success ID:0 thrift.STRUCT
			p.Success = NewExampleResp()
			l, err = p.Success.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x10c: // p.Err ID:1 thrift.STRUCT
			p.Err = NewException()
			l, err = p.Err.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceExampleMethodResult[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExamplePartialMethodArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	off += 3
	off += p.Req.BLength()
	return off + 1
}

func (p *ExampleServiceExamplePartialMethodArgs) FastWrite(b []byte) int {
	return p.FastWriteNocopy(b, nil)
}

func (p *ExampleServiceExamplePartialMethodArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += p.Req.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExamplePartialMethodArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10c: // p.Req ID:1 thrift.STRUCT
			p.Req = NewExampleReqPartial()
			l, err = p.Req.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceExamplePartialMethodArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExamplePartialMethodResult) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		off += 3
		off += p.Success.BLength()
	}
	return off + 1
}

func (p *ExampleServiceExamplePartialMethodResult) FastWrite(b []byte) int {
	return p.FastWriteNocopy(b, nil)
}

func (p *ExampleServiceExamplePartialMethodResult) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		b[off] = 12
		binary.BigEndian.PutUint16(b[off+1:], 0)
		off += 3
		off += p.Success.FastWriteNocopy(b[off:], w)
	}

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExamplePartialMethodResult) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0xc: // p.Success ID:0 thrift.STRUCT
			p.Success = NewA()
			l, err = p.Success.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceExamplePartialMethodResult[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExampleSuperMethodArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	off += 3
	off += p.Req.BLength()
	return off + 1
}

func (p *ExampleServiceExampleSuperMethodArgs) FastWrite(b []byte) int {
	return p.FastWriteNocopy(b, nil)
}

func (p *ExampleServiceExampleSuperMethodArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += p.Req.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExampleSuperMethodArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10c: // p.Req ID:1 thrift.STRUCT
			p.Req = NewExampleSuper()
			l, err = p.Req.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceExampleSuperMethodArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExampleSuperMethodResult) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		off += 3
		off += p.Success.BLength()
	}
	return off + 1
}

func (p *ExampleServiceExampleSuperMethodResult) FastWrite(b []byte) int {
	return p.FastWriteNocopy(b, nil)
}

func (p *ExampleServiceExampleSuperMethodResult) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		b[off] = 12
		binary.BigEndian.PutUint16(b[off+1:], 0)
		off += 3
		off += p.Success.FastWriteNocopy(b[off:], w)
	}

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExampleSuperMethodResult) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0xc: // p.Success ID:0 thrift.STRUCT
			p.Success = NewA()
			l, err = p.Success.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceExampleSuperMethodResult[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceFooArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	off += 3
	off += p.Req.BLength()
	return off + 1
}

func (p *ExampleServiceFooArgs) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceFooArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += p.Req.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceFooArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10c: // p.Req ID:1 thrift.STRUCT
			p.Req = NewA()
			l, err = p.Req.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceFooArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceFooResult) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		off += 3
		off += p.Success.BLength()
	}
	return off + 1
}

func (p *ExampleServiceFooResult) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceFooResult) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		b[off] = 12
		binary.BigEndian.PutUint16(b[off+1:], 0)
		off += 3
		off += p.Success.FastWriteNocopy(b[off:], w)
	}

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceFooResult) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0xc: // p.Success ID:0 thrift.STRUCT
			p.Success = NewA()
			l, err = p.Success.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceFooResult[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServicePingArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	off += 3
	off += 4 + len(p.Msg)
	return off + 1
}

func (p *ExampleServicePingArgs) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServicePingArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.Msg)

	b[off] = 0
	return off + 1
}

func (p *ExampleServicePingArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Msg ID:1 thrift.STRING
			p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServicePingArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServicePingResult) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRING
	if p.Success != nil {
		off += 3
		off += 4 + len(*p.Success)
	}
	return off + 1
}

func (p *ExampleServicePingResult) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServicePingResult) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRING
	if p.Success != nil {
		b[off] = 11
		binary.BigEndian.PutUint16(b[off+1:], 0)
		off += 3
		off += thrift.Binary.WriteStringNocopy(b[off:], w, *p.Success)
	}

	b[off] = 0
	return off + 1
}

func (p *ExampleServicePingResult) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0xb: // p.Success ID:0 thrift.STRING
			if p.Success == nil {
				p.Success = new(string)
			}
			*p.Success, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServicePingResult[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceOnewayArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	off += 3
	off += 4 + len(p.Msg)
	return off + 1
}

func (p *ExampleServiceOnewayArgs) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceOnewayArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.Msg)

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceOnewayArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Msg ID:1 thrift.STRING
			p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceOnewayArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceVoidArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	off += 3
	off += 4 + len(p.Msg)
	return off + 1
}

func (p *ExampleServiceVoidArgs) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceVoidArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.Msg)

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceVoidArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Msg ID:1 thrift.STRING
			p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceVoidArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceVoidResult) BLength() int {
	if p == nil {
		return 1
	}
	off := 0
	return off + 1
}

func (p *ExampleServiceVoidResult) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceVoidResult) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceVoidResult) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}
