|
|
@@ -3124,7 +3124,11 @@ func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool {
|
|
|
// -- -- fast path functions
|
|
|
|
|
|
func (f *encFnInfo) fastpathEncSliceIntfR(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceIntfV(rv.Interface().([]interface{}), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceIntfV(rv.Interface().([]interface{}), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceIntfV(rv.Interface().([]interface{}), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceIntfV(v []interface{}, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3145,8 +3149,39 @@ func (_ fastpathT) EncSliceIntfV(v []interface{}, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceIntfV(v []interface{}, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ e.encode(v2)
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceStringR(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceStringV(rv.Interface().([]string), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceStringV(rv.Interface().([]string), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceStringV(rv.Interface().([]string), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceStringV(v []string, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3167,8 +3202,39 @@ func (_ fastpathT) EncSliceStringV(v []string, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceStringV(v []string, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ee.EncodeString(c_UTF8, v2)
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceFloat32R(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceFloat32V(rv.Interface().([]float32), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceFloat32V(rv.Interface().([]float32), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceFloat32V(rv.Interface().([]float32), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceFloat32V(v []float32, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3189,8 +3255,39 @@ func (_ fastpathT) EncSliceFloat32V(v []float32, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceFloat32V(v []float32, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ee.EncodeFloat32(v2)
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceFloat64R(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceFloat64V(rv.Interface().([]float64), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceFloat64V(rv.Interface().([]float64), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceFloat64V(rv.Interface().([]float64), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceFloat64V(v []float64, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3211,8 +3308,39 @@ func (_ fastpathT) EncSliceFloat64V(v []float64, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceFloat64V(v []float64, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ee.EncodeFloat64(v2)
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceUintR(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceUintV(rv.Interface().([]uint), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceUintV(rv.Interface().([]uint), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceUintV(rv.Interface().([]uint), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceUintV(v []uint, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3233,8 +3361,39 @@ func (_ fastpathT) EncSliceUintV(v []uint, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceUintV(v []uint, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ee.EncodeUint(uint64(v2))
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceUint16R(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceUint16V(rv.Interface().([]uint16), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceUint16V(rv.Interface().([]uint16), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceUint16V(rv.Interface().([]uint16), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceUint16V(v []uint16, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3255,8 +3414,39 @@ func (_ fastpathT) EncSliceUint16V(v []uint16, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceUint16V(v []uint16, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ee.EncodeUint(uint64(v2))
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceUint32R(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceUint32V(rv.Interface().([]uint32), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceUint32V(rv.Interface().([]uint32), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceUint32V(rv.Interface().([]uint32), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceUint32V(v []uint32, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3277,8 +3467,39 @@ func (_ fastpathT) EncSliceUint32V(v []uint32, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceUint32V(v []uint32, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ee.EncodeUint(uint64(v2))
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceUint64R(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceUint64V(rv.Interface().([]uint64), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceUint64V(rv.Interface().([]uint64), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceUint64V(rv.Interface().([]uint64), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceUint64V(v []uint64, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3299,8 +3520,39 @@ func (_ fastpathT) EncSliceUint64V(v []uint64, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceUint64V(v []uint64, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ee.EncodeUint(uint64(v2))
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceUintptrR(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceUintptrV(rv.Interface().([]uintptr), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceUintptrV(rv.Interface().([]uintptr), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceUintptrV(rv.Interface().([]uintptr), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceUintptrV(v []uintptr, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3321,8 +3573,39 @@ func (_ fastpathT) EncSliceUintptrV(v []uintptr, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceUintptrV(v []uintptr, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ e.encode(v2)
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceIntR(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceIntV(rv.Interface().([]int), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceIntV(rv.Interface().([]int), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceIntV(rv.Interface().([]int), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceIntV(v []int, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3343,8 +3626,39 @@ func (_ fastpathT) EncSliceIntV(v []int, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceIntV(v []int, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ee.EncodeInt(int64(v2))
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceInt8R(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceInt8V(rv.Interface().([]int8), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceInt8V(rv.Interface().([]int8), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceInt8V(rv.Interface().([]int8), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceInt8V(v []int8, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3365,8 +3679,39 @@ func (_ fastpathT) EncSliceInt8V(v []int8, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceInt8V(v []int8, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ee.EncodeInt(int64(v2))
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceInt16R(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceInt16V(rv.Interface().([]int16), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceInt16V(rv.Interface().([]int16), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceInt16V(rv.Interface().([]int16), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceInt16V(v []int16, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3387,8 +3732,39 @@ func (_ fastpathT) EncSliceInt16V(v []int16, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceInt16V(v []int16, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ee.EncodeInt(int64(v2))
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceInt32R(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceInt32V(rv.Interface().([]int32), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceInt32V(rv.Interface().([]int32), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceInt32V(rv.Interface().([]int32), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceInt32V(v []int32, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3409,8 +3785,39 @@ func (_ fastpathT) EncSliceInt32V(v []int32, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceInt32V(v []int32, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ee.EncodeInt(int64(v2))
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceInt64R(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceInt64V(rv.Interface().([]int64), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceInt64V(rv.Interface().([]int64), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceInt64V(rv.Interface().([]int64), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceInt64V(v []int64, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3431,8 +3838,39 @@ func (_ fastpathT) EncSliceInt64V(v []int64, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceInt64V(v []int64, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ee.EncodeInt(int64(v2))
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncSliceBoolR(rv reflect.Value) {
|
|
|
- fastpathTV.EncSliceBoolV(rv.Interface().([]bool), fastpathCheckNilFalse, f.e)
|
|
|
+ if f.ti.mbs {
|
|
|
+ fastpathTV.EncAsMapSliceBoolV(rv.Interface().([]bool), fastpathCheckNilFalse, f.e)
|
|
|
+ } else {
|
|
|
+ fastpathTV.EncSliceBoolV(rv.Interface().([]bool), fastpathCheckNilFalse, f.e)
|
|
|
+ }
|
|
|
}
|
|
|
func (_ fastpathT) EncSliceBoolV(v []bool, checkNil bool, e *Encoder) {
|
|
|
ee := e.e
|
|
|
@@ -3453,6 +3891,33 @@ func (_ fastpathT) EncSliceBoolV(v []bool, checkNil bool, e *Encoder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (_ fastpathT) EncAsMapSliceBoolV(v []bool, checkNil bool, e *Encoder) {
|
|
|
+ ee := e.e
|
|
|
+ cr := e.cr
|
|
|
+ if checkNil && v == nil {
|
|
|
+ ee.EncodeNil()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(v)%2 == 1 {
|
|
|
+ e.errorf("mapBySlice requires even slice length, but got %v", len(v))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ee.EncodeMapStart(len(v) / 2)
|
|
|
+ for j, v2 := range v {
|
|
|
+ if cr != nil {
|
|
|
+ if j%2 == 0 {
|
|
|
+ cr.sendContainerState(containerMapKey)
|
|
|
+ } else {
|
|
|
+ cr.sendContainerState(containerMapValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ee.EncodeBool(v2)
|
|
|
+ }
|
|
|
+ if cr != nil {
|
|
|
+ cr.sendContainerState(containerMapEnd)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (f *encFnInfo) fastpathEncMapIntfIntfR(rv reflect.Value) {
|
|
|
fastpathTV.EncMapIntfIntfV(rv.Interface().(map[interface{}]interface{}), fastpathCheckNilFalse, f.e)
|
|
|
}
|