github.com/ugorji/go/codec@v1.2.13-0.20240307214044-07c54c229a5a/fast-path.generated.go (about) 1 //go:build !notfastpath && !codec.notfastpath 2 // +build !notfastpath,!codec.notfastpath 3 4 // Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. 5 // Use of this source code is governed by a MIT license found in the LICENSE file. 6 7 // Code generated from fast-path.go.tmpl - DO NOT EDIT. 8 9 package codec 10 11 // Fast path functions try to create a fast path encode or decode implementation 12 // for common maps and slices. 13 // 14 // We define the functions and register them in this single file 15 // so as not to pollute the encode.go and decode.go, and create a dependency in there. 16 // This file can be omitted without causing a build failure. 17 // 18 // The advantage of fast paths is: 19 // - Many calls bypass reflection altogether 20 // 21 // Currently support 22 // - slice of all builtin types (numeric, bool, string, []byte) 23 // - maps of builtin types to builtin or interface{} type, EXCEPT FOR 24 // keys of type uintptr, int8/16/32, uint16/32, float32/64, bool, interface{} 25 // AND values of type type int8/16/32, uint16/32 26 // This should provide adequate "typical" implementations. 27 // 28 // Note that fast track decode functions must handle values for which an address cannot be obtained. 29 // For example: 30 // m2 := map[string]int{} 31 // p2 := []interface{}{m2} 32 // // decoding into p2 will bomb if fast track functions do not treat like unaddressable. 33 // 34 35 import ( 36 "reflect" 37 "sort" 38 ) 39 40 const fastpathEnabled = true 41 42 type fastpathT struct{} 43 44 var fastpathTV fastpathT 45 46 type fastpathE struct { 47 rt reflect.Type 48 encfn func(*Encoder, *codecFnInfo, reflect.Value) 49 decfn func(*Decoder, *codecFnInfo, reflect.Value) 50 } 51 52 type fastpathA [56]fastpathE 53 type fastpathARtid [56]uintptr 54 55 var fastpathAv fastpathA 56 var fastpathAvRtid fastpathARtid 57 58 type fastpathAslice struct{} 59 60 func (fastpathAslice) Len() int { return 56 } 61 func (fastpathAslice) Less(i, j int) bool { 62 return fastpathAvRtid[uint(i)] < fastpathAvRtid[uint(j)] 63 } 64 func (fastpathAslice) Swap(i, j int) { 65 fastpathAvRtid[uint(i)], fastpathAvRtid[uint(j)] = fastpathAvRtid[uint(j)], fastpathAvRtid[uint(i)] 66 fastpathAv[uint(i)], fastpathAv[uint(j)] = fastpathAv[uint(j)], fastpathAv[uint(i)] 67 } 68 69 func fastpathAvIndex(rtid uintptr) int { 70 // use binary search to grab the index (adapted from sort/search.go) 71 // Note: we use goto (instead of for loop) so this can be inlined. 72 // h, i, j := 0, 0, 56 73 var h, i uint 74 var j uint = 56 75 LOOP: 76 if i < j { 77 h = (i + j) >> 1 // avoid overflow when computing h // h = i + (j-i)/2 78 if fastpathAvRtid[h] < rtid { 79 i = h + 1 80 } else { 81 j = h 82 } 83 goto LOOP 84 } 85 if i < 56 && fastpathAvRtid[i] == rtid { 86 return int(i) 87 } 88 return -1 89 } 90 91 // due to possible initialization loop error, make fastpath in an init() 92 func init() { 93 var i uint = 0 94 fn := func(v interface{}, 95 fe func(*Encoder, *codecFnInfo, reflect.Value), 96 fd func(*Decoder, *codecFnInfo, reflect.Value)) { 97 xrt := reflect.TypeOf(v) 98 xptr := rt2id(xrt) 99 fastpathAvRtid[i] = xptr 100 fastpathAv[i] = fastpathE{xrt, fe, fd} 101 i++ 102 } 103 104 fn([]interface{}(nil), (*Encoder).fastpathEncSliceIntfR, (*Decoder).fastpathDecSliceIntfR) 105 fn([]string(nil), (*Encoder).fastpathEncSliceStringR, (*Decoder).fastpathDecSliceStringR) 106 fn([][]byte(nil), (*Encoder).fastpathEncSliceBytesR, (*Decoder).fastpathDecSliceBytesR) 107 fn([]float32(nil), (*Encoder).fastpathEncSliceFloat32R, (*Decoder).fastpathDecSliceFloat32R) 108 fn([]float64(nil), (*Encoder).fastpathEncSliceFloat64R, (*Decoder).fastpathDecSliceFloat64R) 109 fn([]uint8(nil), (*Encoder).fastpathEncSliceUint8R, (*Decoder).fastpathDecSliceUint8R) 110 fn([]uint64(nil), (*Encoder).fastpathEncSliceUint64R, (*Decoder).fastpathDecSliceUint64R) 111 fn([]int(nil), (*Encoder).fastpathEncSliceIntR, (*Decoder).fastpathDecSliceIntR) 112 fn([]int32(nil), (*Encoder).fastpathEncSliceInt32R, (*Decoder).fastpathDecSliceInt32R) 113 fn([]int64(nil), (*Encoder).fastpathEncSliceInt64R, (*Decoder).fastpathDecSliceInt64R) 114 fn([]bool(nil), (*Encoder).fastpathEncSliceBoolR, (*Decoder).fastpathDecSliceBoolR) 115 116 fn(map[string]interface{}(nil), (*Encoder).fastpathEncMapStringIntfR, (*Decoder).fastpathDecMapStringIntfR) 117 fn(map[string]string(nil), (*Encoder).fastpathEncMapStringStringR, (*Decoder).fastpathDecMapStringStringR) 118 fn(map[string][]byte(nil), (*Encoder).fastpathEncMapStringBytesR, (*Decoder).fastpathDecMapStringBytesR) 119 fn(map[string]uint8(nil), (*Encoder).fastpathEncMapStringUint8R, (*Decoder).fastpathDecMapStringUint8R) 120 fn(map[string]uint64(nil), (*Encoder).fastpathEncMapStringUint64R, (*Decoder).fastpathDecMapStringUint64R) 121 fn(map[string]int(nil), (*Encoder).fastpathEncMapStringIntR, (*Decoder).fastpathDecMapStringIntR) 122 fn(map[string]int32(nil), (*Encoder).fastpathEncMapStringInt32R, (*Decoder).fastpathDecMapStringInt32R) 123 fn(map[string]float64(nil), (*Encoder).fastpathEncMapStringFloat64R, (*Decoder).fastpathDecMapStringFloat64R) 124 fn(map[string]bool(nil), (*Encoder).fastpathEncMapStringBoolR, (*Decoder).fastpathDecMapStringBoolR) 125 fn(map[uint8]interface{}(nil), (*Encoder).fastpathEncMapUint8IntfR, (*Decoder).fastpathDecMapUint8IntfR) 126 fn(map[uint8]string(nil), (*Encoder).fastpathEncMapUint8StringR, (*Decoder).fastpathDecMapUint8StringR) 127 fn(map[uint8][]byte(nil), (*Encoder).fastpathEncMapUint8BytesR, (*Decoder).fastpathDecMapUint8BytesR) 128 fn(map[uint8]uint8(nil), (*Encoder).fastpathEncMapUint8Uint8R, (*Decoder).fastpathDecMapUint8Uint8R) 129 fn(map[uint8]uint64(nil), (*Encoder).fastpathEncMapUint8Uint64R, (*Decoder).fastpathDecMapUint8Uint64R) 130 fn(map[uint8]int(nil), (*Encoder).fastpathEncMapUint8IntR, (*Decoder).fastpathDecMapUint8IntR) 131 fn(map[uint8]int32(nil), (*Encoder).fastpathEncMapUint8Int32R, (*Decoder).fastpathDecMapUint8Int32R) 132 fn(map[uint8]float64(nil), (*Encoder).fastpathEncMapUint8Float64R, (*Decoder).fastpathDecMapUint8Float64R) 133 fn(map[uint8]bool(nil), (*Encoder).fastpathEncMapUint8BoolR, (*Decoder).fastpathDecMapUint8BoolR) 134 fn(map[uint64]interface{}(nil), (*Encoder).fastpathEncMapUint64IntfR, (*Decoder).fastpathDecMapUint64IntfR) 135 fn(map[uint64]string(nil), (*Encoder).fastpathEncMapUint64StringR, (*Decoder).fastpathDecMapUint64StringR) 136 fn(map[uint64][]byte(nil), (*Encoder).fastpathEncMapUint64BytesR, (*Decoder).fastpathDecMapUint64BytesR) 137 fn(map[uint64]uint8(nil), (*Encoder).fastpathEncMapUint64Uint8R, (*Decoder).fastpathDecMapUint64Uint8R) 138 fn(map[uint64]uint64(nil), (*Encoder).fastpathEncMapUint64Uint64R, (*Decoder).fastpathDecMapUint64Uint64R) 139 fn(map[uint64]int(nil), (*Encoder).fastpathEncMapUint64IntR, (*Decoder).fastpathDecMapUint64IntR) 140 fn(map[uint64]int32(nil), (*Encoder).fastpathEncMapUint64Int32R, (*Decoder).fastpathDecMapUint64Int32R) 141 fn(map[uint64]float64(nil), (*Encoder).fastpathEncMapUint64Float64R, (*Decoder).fastpathDecMapUint64Float64R) 142 fn(map[uint64]bool(nil), (*Encoder).fastpathEncMapUint64BoolR, (*Decoder).fastpathDecMapUint64BoolR) 143 fn(map[int]interface{}(nil), (*Encoder).fastpathEncMapIntIntfR, (*Decoder).fastpathDecMapIntIntfR) 144 fn(map[int]string(nil), (*Encoder).fastpathEncMapIntStringR, (*Decoder).fastpathDecMapIntStringR) 145 fn(map[int][]byte(nil), (*Encoder).fastpathEncMapIntBytesR, (*Decoder).fastpathDecMapIntBytesR) 146 fn(map[int]uint8(nil), (*Encoder).fastpathEncMapIntUint8R, (*Decoder).fastpathDecMapIntUint8R) 147 fn(map[int]uint64(nil), (*Encoder).fastpathEncMapIntUint64R, (*Decoder).fastpathDecMapIntUint64R) 148 fn(map[int]int(nil), (*Encoder).fastpathEncMapIntIntR, (*Decoder).fastpathDecMapIntIntR) 149 fn(map[int]int32(nil), (*Encoder).fastpathEncMapIntInt32R, (*Decoder).fastpathDecMapIntInt32R) 150 fn(map[int]float64(nil), (*Encoder).fastpathEncMapIntFloat64R, (*Decoder).fastpathDecMapIntFloat64R) 151 fn(map[int]bool(nil), (*Encoder).fastpathEncMapIntBoolR, (*Decoder).fastpathDecMapIntBoolR) 152 fn(map[int32]interface{}(nil), (*Encoder).fastpathEncMapInt32IntfR, (*Decoder).fastpathDecMapInt32IntfR) 153 fn(map[int32]string(nil), (*Encoder).fastpathEncMapInt32StringR, (*Decoder).fastpathDecMapInt32StringR) 154 fn(map[int32][]byte(nil), (*Encoder).fastpathEncMapInt32BytesR, (*Decoder).fastpathDecMapInt32BytesR) 155 fn(map[int32]uint8(nil), (*Encoder).fastpathEncMapInt32Uint8R, (*Decoder).fastpathDecMapInt32Uint8R) 156 fn(map[int32]uint64(nil), (*Encoder).fastpathEncMapInt32Uint64R, (*Decoder).fastpathDecMapInt32Uint64R) 157 fn(map[int32]int(nil), (*Encoder).fastpathEncMapInt32IntR, (*Decoder).fastpathDecMapInt32IntR) 158 fn(map[int32]int32(nil), (*Encoder).fastpathEncMapInt32Int32R, (*Decoder).fastpathDecMapInt32Int32R) 159 fn(map[int32]float64(nil), (*Encoder).fastpathEncMapInt32Float64R, (*Decoder).fastpathDecMapInt32Float64R) 160 fn(map[int32]bool(nil), (*Encoder).fastpathEncMapInt32BoolR, (*Decoder).fastpathDecMapInt32BoolR) 161 162 sort.Sort(fastpathAslice{}) 163 } 164 165 // -- encode 166 167 // -- -- fast path type switch 168 func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { 169 switch v := iv.(type) { 170 case []interface{}: 171 fastpathTV.EncSliceIntfV(v, e) 172 case *[]interface{}: 173 if *v == nil { 174 e.e.EncodeNil() 175 } else { 176 fastpathTV.EncSliceIntfV(*v, e) 177 } 178 case []string: 179 fastpathTV.EncSliceStringV(v, e) 180 case *[]string: 181 if *v == nil { 182 e.e.EncodeNil() 183 } else { 184 fastpathTV.EncSliceStringV(*v, e) 185 } 186 case [][]byte: 187 fastpathTV.EncSliceBytesV(v, e) 188 case *[][]byte: 189 if *v == nil { 190 e.e.EncodeNil() 191 } else { 192 fastpathTV.EncSliceBytesV(*v, e) 193 } 194 case []float32: 195 fastpathTV.EncSliceFloat32V(v, e) 196 case *[]float32: 197 if *v == nil { 198 e.e.EncodeNil() 199 } else { 200 fastpathTV.EncSliceFloat32V(*v, e) 201 } 202 case []float64: 203 fastpathTV.EncSliceFloat64V(v, e) 204 case *[]float64: 205 if *v == nil { 206 e.e.EncodeNil() 207 } else { 208 fastpathTV.EncSliceFloat64V(*v, e) 209 } 210 case []uint8: 211 fastpathTV.EncSliceUint8V(v, e) 212 case *[]uint8: 213 if *v == nil { 214 e.e.EncodeNil() 215 } else { 216 fastpathTV.EncSliceUint8V(*v, e) 217 } 218 case []uint64: 219 fastpathTV.EncSliceUint64V(v, e) 220 case *[]uint64: 221 if *v == nil { 222 e.e.EncodeNil() 223 } else { 224 fastpathTV.EncSliceUint64V(*v, e) 225 } 226 case []int: 227 fastpathTV.EncSliceIntV(v, e) 228 case *[]int: 229 if *v == nil { 230 e.e.EncodeNil() 231 } else { 232 fastpathTV.EncSliceIntV(*v, e) 233 } 234 case []int32: 235 fastpathTV.EncSliceInt32V(v, e) 236 case *[]int32: 237 if *v == nil { 238 e.e.EncodeNil() 239 } else { 240 fastpathTV.EncSliceInt32V(*v, e) 241 } 242 case []int64: 243 fastpathTV.EncSliceInt64V(v, e) 244 case *[]int64: 245 if *v == nil { 246 e.e.EncodeNil() 247 } else { 248 fastpathTV.EncSliceInt64V(*v, e) 249 } 250 case []bool: 251 fastpathTV.EncSliceBoolV(v, e) 252 case *[]bool: 253 if *v == nil { 254 e.e.EncodeNil() 255 } else { 256 fastpathTV.EncSliceBoolV(*v, e) 257 } 258 case map[string]interface{}: 259 fastpathTV.EncMapStringIntfV(v, e) 260 case *map[string]interface{}: 261 if *v == nil { 262 e.e.EncodeNil() 263 } else { 264 fastpathTV.EncMapStringIntfV(*v, e) 265 } 266 case map[string]string: 267 fastpathTV.EncMapStringStringV(v, e) 268 case *map[string]string: 269 if *v == nil { 270 e.e.EncodeNil() 271 } else { 272 fastpathTV.EncMapStringStringV(*v, e) 273 } 274 case map[string][]byte: 275 fastpathTV.EncMapStringBytesV(v, e) 276 case *map[string][]byte: 277 if *v == nil { 278 e.e.EncodeNil() 279 } else { 280 fastpathTV.EncMapStringBytesV(*v, e) 281 } 282 case map[string]uint8: 283 fastpathTV.EncMapStringUint8V(v, e) 284 case *map[string]uint8: 285 if *v == nil { 286 e.e.EncodeNil() 287 } else { 288 fastpathTV.EncMapStringUint8V(*v, e) 289 } 290 case map[string]uint64: 291 fastpathTV.EncMapStringUint64V(v, e) 292 case *map[string]uint64: 293 if *v == nil { 294 e.e.EncodeNil() 295 } else { 296 fastpathTV.EncMapStringUint64V(*v, e) 297 } 298 case map[string]int: 299 fastpathTV.EncMapStringIntV(v, e) 300 case *map[string]int: 301 if *v == nil { 302 e.e.EncodeNil() 303 } else { 304 fastpathTV.EncMapStringIntV(*v, e) 305 } 306 case map[string]int32: 307 fastpathTV.EncMapStringInt32V(v, e) 308 case *map[string]int32: 309 if *v == nil { 310 e.e.EncodeNil() 311 } else { 312 fastpathTV.EncMapStringInt32V(*v, e) 313 } 314 case map[string]float64: 315 fastpathTV.EncMapStringFloat64V(v, e) 316 case *map[string]float64: 317 if *v == nil { 318 e.e.EncodeNil() 319 } else { 320 fastpathTV.EncMapStringFloat64V(*v, e) 321 } 322 case map[string]bool: 323 fastpathTV.EncMapStringBoolV(v, e) 324 case *map[string]bool: 325 if *v == nil { 326 e.e.EncodeNil() 327 } else { 328 fastpathTV.EncMapStringBoolV(*v, e) 329 } 330 case map[uint8]interface{}: 331 fastpathTV.EncMapUint8IntfV(v, e) 332 case *map[uint8]interface{}: 333 if *v == nil { 334 e.e.EncodeNil() 335 } else { 336 fastpathTV.EncMapUint8IntfV(*v, e) 337 } 338 case map[uint8]string: 339 fastpathTV.EncMapUint8StringV(v, e) 340 case *map[uint8]string: 341 if *v == nil { 342 e.e.EncodeNil() 343 } else { 344 fastpathTV.EncMapUint8StringV(*v, e) 345 } 346 case map[uint8][]byte: 347 fastpathTV.EncMapUint8BytesV(v, e) 348 case *map[uint8][]byte: 349 if *v == nil { 350 e.e.EncodeNil() 351 } else { 352 fastpathTV.EncMapUint8BytesV(*v, e) 353 } 354 case map[uint8]uint8: 355 fastpathTV.EncMapUint8Uint8V(v, e) 356 case *map[uint8]uint8: 357 if *v == nil { 358 e.e.EncodeNil() 359 } else { 360 fastpathTV.EncMapUint8Uint8V(*v, e) 361 } 362 case map[uint8]uint64: 363 fastpathTV.EncMapUint8Uint64V(v, e) 364 case *map[uint8]uint64: 365 if *v == nil { 366 e.e.EncodeNil() 367 } else { 368 fastpathTV.EncMapUint8Uint64V(*v, e) 369 } 370 case map[uint8]int: 371 fastpathTV.EncMapUint8IntV(v, e) 372 case *map[uint8]int: 373 if *v == nil { 374 e.e.EncodeNil() 375 } else { 376 fastpathTV.EncMapUint8IntV(*v, e) 377 } 378 case map[uint8]int32: 379 fastpathTV.EncMapUint8Int32V(v, e) 380 case *map[uint8]int32: 381 if *v == nil { 382 e.e.EncodeNil() 383 } else { 384 fastpathTV.EncMapUint8Int32V(*v, e) 385 } 386 case map[uint8]float64: 387 fastpathTV.EncMapUint8Float64V(v, e) 388 case *map[uint8]float64: 389 if *v == nil { 390 e.e.EncodeNil() 391 } else { 392 fastpathTV.EncMapUint8Float64V(*v, e) 393 } 394 case map[uint8]bool: 395 fastpathTV.EncMapUint8BoolV(v, e) 396 case *map[uint8]bool: 397 if *v == nil { 398 e.e.EncodeNil() 399 } else { 400 fastpathTV.EncMapUint8BoolV(*v, e) 401 } 402 case map[uint64]interface{}: 403 fastpathTV.EncMapUint64IntfV(v, e) 404 case *map[uint64]interface{}: 405 if *v == nil { 406 e.e.EncodeNil() 407 } else { 408 fastpathTV.EncMapUint64IntfV(*v, e) 409 } 410 case map[uint64]string: 411 fastpathTV.EncMapUint64StringV(v, e) 412 case *map[uint64]string: 413 if *v == nil { 414 e.e.EncodeNil() 415 } else { 416 fastpathTV.EncMapUint64StringV(*v, e) 417 } 418 case map[uint64][]byte: 419 fastpathTV.EncMapUint64BytesV(v, e) 420 case *map[uint64][]byte: 421 if *v == nil { 422 e.e.EncodeNil() 423 } else { 424 fastpathTV.EncMapUint64BytesV(*v, e) 425 } 426 case map[uint64]uint8: 427 fastpathTV.EncMapUint64Uint8V(v, e) 428 case *map[uint64]uint8: 429 if *v == nil { 430 e.e.EncodeNil() 431 } else { 432 fastpathTV.EncMapUint64Uint8V(*v, e) 433 } 434 case map[uint64]uint64: 435 fastpathTV.EncMapUint64Uint64V(v, e) 436 case *map[uint64]uint64: 437 if *v == nil { 438 e.e.EncodeNil() 439 } else { 440 fastpathTV.EncMapUint64Uint64V(*v, e) 441 } 442 case map[uint64]int: 443 fastpathTV.EncMapUint64IntV(v, e) 444 case *map[uint64]int: 445 if *v == nil { 446 e.e.EncodeNil() 447 } else { 448 fastpathTV.EncMapUint64IntV(*v, e) 449 } 450 case map[uint64]int32: 451 fastpathTV.EncMapUint64Int32V(v, e) 452 case *map[uint64]int32: 453 if *v == nil { 454 e.e.EncodeNil() 455 } else { 456 fastpathTV.EncMapUint64Int32V(*v, e) 457 } 458 case map[uint64]float64: 459 fastpathTV.EncMapUint64Float64V(v, e) 460 case *map[uint64]float64: 461 if *v == nil { 462 e.e.EncodeNil() 463 } else { 464 fastpathTV.EncMapUint64Float64V(*v, e) 465 } 466 case map[uint64]bool: 467 fastpathTV.EncMapUint64BoolV(v, e) 468 case *map[uint64]bool: 469 if *v == nil { 470 e.e.EncodeNil() 471 } else { 472 fastpathTV.EncMapUint64BoolV(*v, e) 473 } 474 case map[int]interface{}: 475 fastpathTV.EncMapIntIntfV(v, e) 476 case *map[int]interface{}: 477 if *v == nil { 478 e.e.EncodeNil() 479 } else { 480 fastpathTV.EncMapIntIntfV(*v, e) 481 } 482 case map[int]string: 483 fastpathTV.EncMapIntStringV(v, e) 484 case *map[int]string: 485 if *v == nil { 486 e.e.EncodeNil() 487 } else { 488 fastpathTV.EncMapIntStringV(*v, e) 489 } 490 case map[int][]byte: 491 fastpathTV.EncMapIntBytesV(v, e) 492 case *map[int][]byte: 493 if *v == nil { 494 e.e.EncodeNil() 495 } else { 496 fastpathTV.EncMapIntBytesV(*v, e) 497 } 498 case map[int]uint8: 499 fastpathTV.EncMapIntUint8V(v, e) 500 case *map[int]uint8: 501 if *v == nil { 502 e.e.EncodeNil() 503 } else { 504 fastpathTV.EncMapIntUint8V(*v, e) 505 } 506 case map[int]uint64: 507 fastpathTV.EncMapIntUint64V(v, e) 508 case *map[int]uint64: 509 if *v == nil { 510 e.e.EncodeNil() 511 } else { 512 fastpathTV.EncMapIntUint64V(*v, e) 513 } 514 case map[int]int: 515 fastpathTV.EncMapIntIntV(v, e) 516 case *map[int]int: 517 if *v == nil { 518 e.e.EncodeNil() 519 } else { 520 fastpathTV.EncMapIntIntV(*v, e) 521 } 522 case map[int]int32: 523 fastpathTV.EncMapIntInt32V(v, e) 524 case *map[int]int32: 525 if *v == nil { 526 e.e.EncodeNil() 527 } else { 528 fastpathTV.EncMapIntInt32V(*v, e) 529 } 530 case map[int]float64: 531 fastpathTV.EncMapIntFloat64V(v, e) 532 case *map[int]float64: 533 if *v == nil { 534 e.e.EncodeNil() 535 } else { 536 fastpathTV.EncMapIntFloat64V(*v, e) 537 } 538 case map[int]bool: 539 fastpathTV.EncMapIntBoolV(v, e) 540 case *map[int]bool: 541 if *v == nil { 542 e.e.EncodeNil() 543 } else { 544 fastpathTV.EncMapIntBoolV(*v, e) 545 } 546 case map[int32]interface{}: 547 fastpathTV.EncMapInt32IntfV(v, e) 548 case *map[int32]interface{}: 549 if *v == nil { 550 e.e.EncodeNil() 551 } else { 552 fastpathTV.EncMapInt32IntfV(*v, e) 553 } 554 case map[int32]string: 555 fastpathTV.EncMapInt32StringV(v, e) 556 case *map[int32]string: 557 if *v == nil { 558 e.e.EncodeNil() 559 } else { 560 fastpathTV.EncMapInt32StringV(*v, e) 561 } 562 case map[int32][]byte: 563 fastpathTV.EncMapInt32BytesV(v, e) 564 case *map[int32][]byte: 565 if *v == nil { 566 e.e.EncodeNil() 567 } else { 568 fastpathTV.EncMapInt32BytesV(*v, e) 569 } 570 case map[int32]uint8: 571 fastpathTV.EncMapInt32Uint8V(v, e) 572 case *map[int32]uint8: 573 if *v == nil { 574 e.e.EncodeNil() 575 } else { 576 fastpathTV.EncMapInt32Uint8V(*v, e) 577 } 578 case map[int32]uint64: 579 fastpathTV.EncMapInt32Uint64V(v, e) 580 case *map[int32]uint64: 581 if *v == nil { 582 e.e.EncodeNil() 583 } else { 584 fastpathTV.EncMapInt32Uint64V(*v, e) 585 } 586 case map[int32]int: 587 fastpathTV.EncMapInt32IntV(v, e) 588 case *map[int32]int: 589 if *v == nil { 590 e.e.EncodeNil() 591 } else { 592 fastpathTV.EncMapInt32IntV(*v, e) 593 } 594 case map[int32]int32: 595 fastpathTV.EncMapInt32Int32V(v, e) 596 case *map[int32]int32: 597 if *v == nil { 598 e.e.EncodeNil() 599 } else { 600 fastpathTV.EncMapInt32Int32V(*v, e) 601 } 602 case map[int32]float64: 603 fastpathTV.EncMapInt32Float64V(v, e) 604 case *map[int32]float64: 605 if *v == nil { 606 e.e.EncodeNil() 607 } else { 608 fastpathTV.EncMapInt32Float64V(*v, e) 609 } 610 case map[int32]bool: 611 fastpathTV.EncMapInt32BoolV(v, e) 612 case *map[int32]bool: 613 if *v == nil { 614 e.e.EncodeNil() 615 } else { 616 fastpathTV.EncMapInt32BoolV(*v, e) 617 } 618 default: 619 _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 620 return false 621 } 622 return true 623 } 624 625 // -- -- fast path functions 626 func (e *Encoder) fastpathEncSliceIntfR(f *codecFnInfo, rv reflect.Value) { 627 var v []interface{} 628 if rv.Kind() == reflect.Array { 629 rvGetSlice4Array(rv, &v) 630 } else { 631 v = rv2i(rv).([]interface{}) 632 } 633 if f.ti.mbs { 634 fastpathTV.EncAsMapSliceIntfV(v, e) 635 } else { 636 fastpathTV.EncSliceIntfV(v, e) 637 } 638 } 639 func (fastpathT) EncSliceIntfV(v []interface{}, e *Encoder) { 640 e.arrayStart(len(v)) 641 for j := range v { 642 e.arrayElem() 643 e.encode(v[j]) 644 } 645 e.arrayEnd() 646 } 647 func (fastpathT) EncAsMapSliceIntfV(v []interface{}, e *Encoder) { 648 e.haltOnMbsOddLen(len(v)) 649 e.mapStart(len(v) >> 1) // e.mapStart(len(v) / 2) 650 for j := range v { 651 if j&1 == 0 { // if j%2 == 0 { 652 e.mapElemKey() 653 } else { 654 e.mapElemValue() 655 } 656 e.encode(v[j]) 657 } 658 e.mapEnd() 659 } 660 func (e *Encoder) fastpathEncSliceStringR(f *codecFnInfo, rv reflect.Value) { 661 var v []string 662 if rv.Kind() == reflect.Array { 663 rvGetSlice4Array(rv, &v) 664 } else { 665 v = rv2i(rv).([]string) 666 } 667 if f.ti.mbs { 668 fastpathTV.EncAsMapSliceStringV(v, e) 669 } else { 670 fastpathTV.EncSliceStringV(v, e) 671 } 672 } 673 func (fastpathT) EncSliceStringV(v []string, e *Encoder) { 674 e.arrayStart(len(v)) 675 for j := range v { 676 e.arrayElem() 677 e.e.EncodeString(v[j]) 678 } 679 e.arrayEnd() 680 } 681 func (fastpathT) EncAsMapSliceStringV(v []string, e *Encoder) { 682 e.haltOnMbsOddLen(len(v)) 683 e.mapStart(len(v) >> 1) // e.mapStart(len(v) / 2) 684 for j := range v { 685 if j&1 == 0 { // if j%2 == 0 { 686 e.mapElemKey() 687 } else { 688 e.mapElemValue() 689 } 690 e.e.EncodeString(v[j]) 691 } 692 e.mapEnd() 693 } 694 func (e *Encoder) fastpathEncSliceBytesR(f *codecFnInfo, rv reflect.Value) { 695 var v [][]byte 696 if rv.Kind() == reflect.Array { 697 rvGetSlice4Array(rv, &v) 698 } else { 699 v = rv2i(rv).([][]byte) 700 } 701 if f.ti.mbs { 702 fastpathTV.EncAsMapSliceBytesV(v, e) 703 } else { 704 fastpathTV.EncSliceBytesV(v, e) 705 } 706 } 707 func (fastpathT) EncSliceBytesV(v [][]byte, e *Encoder) { 708 e.arrayStart(len(v)) 709 for j := range v { 710 e.arrayElem() 711 e.e.EncodeStringBytesRaw(v[j]) 712 } 713 e.arrayEnd() 714 } 715 func (fastpathT) EncAsMapSliceBytesV(v [][]byte, e *Encoder) { 716 e.haltOnMbsOddLen(len(v)) 717 e.mapStart(len(v) >> 1) // e.mapStart(len(v) / 2) 718 for j := range v { 719 if j&1 == 0 { // if j%2 == 0 { 720 e.mapElemKey() 721 } else { 722 e.mapElemValue() 723 } 724 e.e.EncodeStringBytesRaw(v[j]) 725 } 726 e.mapEnd() 727 } 728 func (e *Encoder) fastpathEncSliceFloat32R(f *codecFnInfo, rv reflect.Value) { 729 var v []float32 730 if rv.Kind() == reflect.Array { 731 rvGetSlice4Array(rv, &v) 732 } else { 733 v = rv2i(rv).([]float32) 734 } 735 if f.ti.mbs { 736 fastpathTV.EncAsMapSliceFloat32V(v, e) 737 } else { 738 fastpathTV.EncSliceFloat32V(v, e) 739 } 740 } 741 func (fastpathT) EncSliceFloat32V(v []float32, e *Encoder) { 742 e.arrayStart(len(v)) 743 for j := range v { 744 e.arrayElem() 745 e.e.EncodeFloat32(v[j]) 746 } 747 e.arrayEnd() 748 } 749 func (fastpathT) EncAsMapSliceFloat32V(v []float32, e *Encoder) { 750 e.haltOnMbsOddLen(len(v)) 751 e.mapStart(len(v) >> 1) // e.mapStart(len(v) / 2) 752 for j := range v { 753 if j&1 == 0 { // if j%2 == 0 { 754 e.mapElemKey() 755 } else { 756 e.mapElemValue() 757 } 758 e.e.EncodeFloat32(v[j]) 759 } 760 e.mapEnd() 761 } 762 func (e *Encoder) fastpathEncSliceFloat64R(f *codecFnInfo, rv reflect.Value) { 763 var v []float64 764 if rv.Kind() == reflect.Array { 765 rvGetSlice4Array(rv, &v) 766 } else { 767 v = rv2i(rv).([]float64) 768 } 769 if f.ti.mbs { 770 fastpathTV.EncAsMapSliceFloat64V(v, e) 771 } else { 772 fastpathTV.EncSliceFloat64V(v, e) 773 } 774 } 775 func (fastpathT) EncSliceFloat64V(v []float64, e *Encoder) { 776 e.arrayStart(len(v)) 777 for j := range v { 778 e.arrayElem() 779 e.e.EncodeFloat64(v[j]) 780 } 781 e.arrayEnd() 782 } 783 func (fastpathT) EncAsMapSliceFloat64V(v []float64, e *Encoder) { 784 e.haltOnMbsOddLen(len(v)) 785 e.mapStart(len(v) >> 1) // e.mapStart(len(v) / 2) 786 for j := range v { 787 if j&1 == 0 { // if j%2 == 0 { 788 e.mapElemKey() 789 } else { 790 e.mapElemValue() 791 } 792 e.e.EncodeFloat64(v[j]) 793 } 794 e.mapEnd() 795 } 796 func (e *Encoder) fastpathEncSliceUint8R(f *codecFnInfo, rv reflect.Value) { 797 var v []uint8 798 if rv.Kind() == reflect.Array { 799 rvGetSlice4Array(rv, &v) 800 } else { 801 v = rv2i(rv).([]uint8) 802 } 803 if f.ti.mbs { 804 fastpathTV.EncAsMapSliceUint8V(v, e) 805 } else { 806 fastpathTV.EncSliceUint8V(v, e) 807 } 808 } 809 func (fastpathT) EncSliceUint8V(v []uint8, e *Encoder) { 810 e.e.EncodeStringBytesRaw(v) 811 } 812 func (fastpathT) EncAsMapSliceUint8V(v []uint8, e *Encoder) { 813 e.haltOnMbsOddLen(len(v)) 814 e.mapStart(len(v) >> 1) // e.mapStart(len(v) / 2) 815 for j := range v { 816 if j&1 == 0 { // if j%2 == 0 { 817 e.mapElemKey() 818 } else { 819 e.mapElemValue() 820 } 821 e.e.EncodeUint(uint64(v[j])) 822 } 823 e.mapEnd() 824 } 825 func (e *Encoder) fastpathEncSliceUint64R(f *codecFnInfo, rv reflect.Value) { 826 var v []uint64 827 if rv.Kind() == reflect.Array { 828 rvGetSlice4Array(rv, &v) 829 } else { 830 v = rv2i(rv).([]uint64) 831 } 832 if f.ti.mbs { 833 fastpathTV.EncAsMapSliceUint64V(v, e) 834 } else { 835 fastpathTV.EncSliceUint64V(v, e) 836 } 837 } 838 func (fastpathT) EncSliceUint64V(v []uint64, e *Encoder) { 839 e.arrayStart(len(v)) 840 for j := range v { 841 e.arrayElem() 842 e.e.EncodeUint(v[j]) 843 } 844 e.arrayEnd() 845 } 846 func (fastpathT) EncAsMapSliceUint64V(v []uint64, e *Encoder) { 847 e.haltOnMbsOddLen(len(v)) 848 e.mapStart(len(v) >> 1) // e.mapStart(len(v) / 2) 849 for j := range v { 850 if j&1 == 0 { // if j%2 == 0 { 851 e.mapElemKey() 852 } else { 853 e.mapElemValue() 854 } 855 e.e.EncodeUint(v[j]) 856 } 857 e.mapEnd() 858 } 859 func (e *Encoder) fastpathEncSliceIntR(f *codecFnInfo, rv reflect.Value) { 860 var v []int 861 if rv.Kind() == reflect.Array { 862 rvGetSlice4Array(rv, &v) 863 } else { 864 v = rv2i(rv).([]int) 865 } 866 if f.ti.mbs { 867 fastpathTV.EncAsMapSliceIntV(v, e) 868 } else { 869 fastpathTV.EncSliceIntV(v, e) 870 } 871 } 872 func (fastpathT) EncSliceIntV(v []int, e *Encoder) { 873 e.arrayStart(len(v)) 874 for j := range v { 875 e.arrayElem() 876 e.e.EncodeInt(int64(v[j])) 877 } 878 e.arrayEnd() 879 } 880 func (fastpathT) EncAsMapSliceIntV(v []int, e *Encoder) { 881 e.haltOnMbsOddLen(len(v)) 882 e.mapStart(len(v) >> 1) // e.mapStart(len(v) / 2) 883 for j := range v { 884 if j&1 == 0 { // if j%2 == 0 { 885 e.mapElemKey() 886 } else { 887 e.mapElemValue() 888 } 889 e.e.EncodeInt(int64(v[j])) 890 } 891 e.mapEnd() 892 } 893 func (e *Encoder) fastpathEncSliceInt32R(f *codecFnInfo, rv reflect.Value) { 894 var v []int32 895 if rv.Kind() == reflect.Array { 896 rvGetSlice4Array(rv, &v) 897 } else { 898 v = rv2i(rv).([]int32) 899 } 900 if f.ti.mbs { 901 fastpathTV.EncAsMapSliceInt32V(v, e) 902 } else { 903 fastpathTV.EncSliceInt32V(v, e) 904 } 905 } 906 func (fastpathT) EncSliceInt32V(v []int32, e *Encoder) { 907 e.arrayStart(len(v)) 908 for j := range v { 909 e.arrayElem() 910 e.e.EncodeInt(int64(v[j])) 911 } 912 e.arrayEnd() 913 } 914 func (fastpathT) EncAsMapSliceInt32V(v []int32, e *Encoder) { 915 e.haltOnMbsOddLen(len(v)) 916 e.mapStart(len(v) >> 1) // e.mapStart(len(v) / 2) 917 for j := range v { 918 if j&1 == 0 { // if j%2 == 0 { 919 e.mapElemKey() 920 } else { 921 e.mapElemValue() 922 } 923 e.e.EncodeInt(int64(v[j])) 924 } 925 e.mapEnd() 926 } 927 func (e *Encoder) fastpathEncSliceInt64R(f *codecFnInfo, rv reflect.Value) { 928 var v []int64 929 if rv.Kind() == reflect.Array { 930 rvGetSlice4Array(rv, &v) 931 } else { 932 v = rv2i(rv).([]int64) 933 } 934 if f.ti.mbs { 935 fastpathTV.EncAsMapSliceInt64V(v, e) 936 } else { 937 fastpathTV.EncSliceInt64V(v, e) 938 } 939 } 940 func (fastpathT) EncSliceInt64V(v []int64, e *Encoder) { 941 e.arrayStart(len(v)) 942 for j := range v { 943 e.arrayElem() 944 e.e.EncodeInt(v[j]) 945 } 946 e.arrayEnd() 947 } 948 func (fastpathT) EncAsMapSliceInt64V(v []int64, e *Encoder) { 949 e.haltOnMbsOddLen(len(v)) 950 e.mapStart(len(v) >> 1) // e.mapStart(len(v) / 2) 951 for j := range v { 952 if j&1 == 0 { // if j%2 == 0 { 953 e.mapElemKey() 954 } else { 955 e.mapElemValue() 956 } 957 e.e.EncodeInt(v[j]) 958 } 959 e.mapEnd() 960 } 961 func (e *Encoder) fastpathEncSliceBoolR(f *codecFnInfo, rv reflect.Value) { 962 var v []bool 963 if rv.Kind() == reflect.Array { 964 rvGetSlice4Array(rv, &v) 965 } else { 966 v = rv2i(rv).([]bool) 967 } 968 if f.ti.mbs { 969 fastpathTV.EncAsMapSliceBoolV(v, e) 970 } else { 971 fastpathTV.EncSliceBoolV(v, e) 972 } 973 } 974 func (fastpathT) EncSliceBoolV(v []bool, e *Encoder) { 975 e.arrayStart(len(v)) 976 for j := range v { 977 e.arrayElem() 978 e.e.EncodeBool(v[j]) 979 } 980 e.arrayEnd() 981 } 982 func (fastpathT) EncAsMapSliceBoolV(v []bool, e *Encoder) { 983 e.haltOnMbsOddLen(len(v)) 984 e.mapStart(len(v) >> 1) // e.mapStart(len(v) / 2) 985 for j := range v { 986 if j&1 == 0 { // if j%2 == 0 { 987 e.mapElemKey() 988 } else { 989 e.mapElemValue() 990 } 991 e.e.EncodeBool(v[j]) 992 } 993 e.mapEnd() 994 } 995 func (e *Encoder) fastpathEncMapStringIntfR(f *codecFnInfo, rv reflect.Value) { 996 fastpathTV.EncMapStringIntfV(rv2i(rv).(map[string]interface{}), e) 997 } 998 func (fastpathT) EncMapStringIntfV(v map[string]interface{}, e *Encoder) { 999 e.mapStart(len(v)) 1000 if e.h.Canonical { 1001 v2 := make([]string, len(v)) 1002 var i uint 1003 for k := range v { 1004 v2[i] = k 1005 i++ 1006 } 1007 sort.Sort(stringSlice(v2)) 1008 for _, k2 := range v2 { 1009 e.mapElemKey() 1010 e.e.EncodeString(k2) 1011 e.mapElemValue() 1012 e.encode(v[k2]) 1013 } 1014 } else { 1015 for k2, v2 := range v { 1016 e.mapElemKey() 1017 e.e.EncodeString(k2) 1018 e.mapElemValue() 1019 e.encode(v2) 1020 } 1021 } 1022 e.mapEnd() 1023 } 1024 func (e *Encoder) fastpathEncMapStringStringR(f *codecFnInfo, rv reflect.Value) { 1025 fastpathTV.EncMapStringStringV(rv2i(rv).(map[string]string), e) 1026 } 1027 func (fastpathT) EncMapStringStringV(v map[string]string, e *Encoder) { 1028 e.mapStart(len(v)) 1029 if e.h.Canonical { 1030 v2 := make([]string, len(v)) 1031 var i uint 1032 for k := range v { 1033 v2[i] = k 1034 i++ 1035 } 1036 sort.Sort(stringSlice(v2)) 1037 for _, k2 := range v2 { 1038 e.mapElemKey() 1039 e.e.EncodeString(k2) 1040 e.mapElemValue() 1041 e.e.EncodeString(v[k2]) 1042 } 1043 } else { 1044 for k2, v2 := range v { 1045 e.mapElemKey() 1046 e.e.EncodeString(k2) 1047 e.mapElemValue() 1048 e.e.EncodeString(v2) 1049 } 1050 } 1051 e.mapEnd() 1052 } 1053 func (e *Encoder) fastpathEncMapStringBytesR(f *codecFnInfo, rv reflect.Value) { 1054 fastpathTV.EncMapStringBytesV(rv2i(rv).(map[string][]byte), e) 1055 } 1056 func (fastpathT) EncMapStringBytesV(v map[string][]byte, e *Encoder) { 1057 e.mapStart(len(v)) 1058 if e.h.Canonical { 1059 v2 := make([]string, len(v)) 1060 var i uint 1061 for k := range v { 1062 v2[i] = k 1063 i++ 1064 } 1065 sort.Sort(stringSlice(v2)) 1066 for _, k2 := range v2 { 1067 e.mapElemKey() 1068 e.e.EncodeString(k2) 1069 e.mapElemValue() 1070 e.e.EncodeStringBytesRaw(v[k2]) 1071 } 1072 } else { 1073 for k2, v2 := range v { 1074 e.mapElemKey() 1075 e.e.EncodeString(k2) 1076 e.mapElemValue() 1077 e.e.EncodeStringBytesRaw(v2) 1078 } 1079 } 1080 e.mapEnd() 1081 } 1082 func (e *Encoder) fastpathEncMapStringUint8R(f *codecFnInfo, rv reflect.Value) { 1083 fastpathTV.EncMapStringUint8V(rv2i(rv).(map[string]uint8), e) 1084 } 1085 func (fastpathT) EncMapStringUint8V(v map[string]uint8, e *Encoder) { 1086 e.mapStart(len(v)) 1087 if e.h.Canonical { 1088 v2 := make([]string, len(v)) 1089 var i uint 1090 for k := range v { 1091 v2[i] = k 1092 i++ 1093 } 1094 sort.Sort(stringSlice(v2)) 1095 for _, k2 := range v2 { 1096 e.mapElemKey() 1097 e.e.EncodeString(k2) 1098 e.mapElemValue() 1099 e.e.EncodeUint(uint64(v[k2])) 1100 } 1101 } else { 1102 for k2, v2 := range v { 1103 e.mapElemKey() 1104 e.e.EncodeString(k2) 1105 e.mapElemValue() 1106 e.e.EncodeUint(uint64(v2)) 1107 } 1108 } 1109 e.mapEnd() 1110 } 1111 func (e *Encoder) fastpathEncMapStringUint64R(f *codecFnInfo, rv reflect.Value) { 1112 fastpathTV.EncMapStringUint64V(rv2i(rv).(map[string]uint64), e) 1113 } 1114 func (fastpathT) EncMapStringUint64V(v map[string]uint64, e *Encoder) { 1115 e.mapStart(len(v)) 1116 if e.h.Canonical { 1117 v2 := make([]string, len(v)) 1118 var i uint 1119 for k := range v { 1120 v2[i] = k 1121 i++ 1122 } 1123 sort.Sort(stringSlice(v2)) 1124 for _, k2 := range v2 { 1125 e.mapElemKey() 1126 e.e.EncodeString(k2) 1127 e.mapElemValue() 1128 e.e.EncodeUint(v[k2]) 1129 } 1130 } else { 1131 for k2, v2 := range v { 1132 e.mapElemKey() 1133 e.e.EncodeString(k2) 1134 e.mapElemValue() 1135 e.e.EncodeUint(v2) 1136 } 1137 } 1138 e.mapEnd() 1139 } 1140 func (e *Encoder) fastpathEncMapStringIntR(f *codecFnInfo, rv reflect.Value) { 1141 fastpathTV.EncMapStringIntV(rv2i(rv).(map[string]int), e) 1142 } 1143 func (fastpathT) EncMapStringIntV(v map[string]int, e *Encoder) { 1144 e.mapStart(len(v)) 1145 if e.h.Canonical { 1146 v2 := make([]string, len(v)) 1147 var i uint 1148 for k := range v { 1149 v2[i] = k 1150 i++ 1151 } 1152 sort.Sort(stringSlice(v2)) 1153 for _, k2 := range v2 { 1154 e.mapElemKey() 1155 e.e.EncodeString(k2) 1156 e.mapElemValue() 1157 e.e.EncodeInt(int64(v[k2])) 1158 } 1159 } else { 1160 for k2, v2 := range v { 1161 e.mapElemKey() 1162 e.e.EncodeString(k2) 1163 e.mapElemValue() 1164 e.e.EncodeInt(int64(v2)) 1165 } 1166 } 1167 e.mapEnd() 1168 } 1169 func (e *Encoder) fastpathEncMapStringInt32R(f *codecFnInfo, rv reflect.Value) { 1170 fastpathTV.EncMapStringInt32V(rv2i(rv).(map[string]int32), e) 1171 } 1172 func (fastpathT) EncMapStringInt32V(v map[string]int32, e *Encoder) { 1173 e.mapStart(len(v)) 1174 if e.h.Canonical { 1175 v2 := make([]string, len(v)) 1176 var i uint 1177 for k := range v { 1178 v2[i] = k 1179 i++ 1180 } 1181 sort.Sort(stringSlice(v2)) 1182 for _, k2 := range v2 { 1183 e.mapElemKey() 1184 e.e.EncodeString(k2) 1185 e.mapElemValue() 1186 e.e.EncodeInt(int64(v[k2])) 1187 } 1188 } else { 1189 for k2, v2 := range v { 1190 e.mapElemKey() 1191 e.e.EncodeString(k2) 1192 e.mapElemValue() 1193 e.e.EncodeInt(int64(v2)) 1194 } 1195 } 1196 e.mapEnd() 1197 } 1198 func (e *Encoder) fastpathEncMapStringFloat64R(f *codecFnInfo, rv reflect.Value) { 1199 fastpathTV.EncMapStringFloat64V(rv2i(rv).(map[string]float64), e) 1200 } 1201 func (fastpathT) EncMapStringFloat64V(v map[string]float64, e *Encoder) { 1202 e.mapStart(len(v)) 1203 if e.h.Canonical { 1204 v2 := make([]string, len(v)) 1205 var i uint 1206 for k := range v { 1207 v2[i] = k 1208 i++ 1209 } 1210 sort.Sort(stringSlice(v2)) 1211 for _, k2 := range v2 { 1212 e.mapElemKey() 1213 e.e.EncodeString(k2) 1214 e.mapElemValue() 1215 e.e.EncodeFloat64(v[k2]) 1216 } 1217 } else { 1218 for k2, v2 := range v { 1219 e.mapElemKey() 1220 e.e.EncodeString(k2) 1221 e.mapElemValue() 1222 e.e.EncodeFloat64(v2) 1223 } 1224 } 1225 e.mapEnd() 1226 } 1227 func (e *Encoder) fastpathEncMapStringBoolR(f *codecFnInfo, rv reflect.Value) { 1228 fastpathTV.EncMapStringBoolV(rv2i(rv).(map[string]bool), e) 1229 } 1230 func (fastpathT) EncMapStringBoolV(v map[string]bool, e *Encoder) { 1231 e.mapStart(len(v)) 1232 if e.h.Canonical { 1233 v2 := make([]string, len(v)) 1234 var i uint 1235 for k := range v { 1236 v2[i] = k 1237 i++ 1238 } 1239 sort.Sort(stringSlice(v2)) 1240 for _, k2 := range v2 { 1241 e.mapElemKey() 1242 e.e.EncodeString(k2) 1243 e.mapElemValue() 1244 e.e.EncodeBool(v[k2]) 1245 } 1246 } else { 1247 for k2, v2 := range v { 1248 e.mapElemKey() 1249 e.e.EncodeString(k2) 1250 e.mapElemValue() 1251 e.e.EncodeBool(v2) 1252 } 1253 } 1254 e.mapEnd() 1255 } 1256 func (e *Encoder) fastpathEncMapUint8IntfR(f *codecFnInfo, rv reflect.Value) { 1257 fastpathTV.EncMapUint8IntfV(rv2i(rv).(map[uint8]interface{}), e) 1258 } 1259 func (fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, e *Encoder) { 1260 e.mapStart(len(v)) 1261 if e.h.Canonical { 1262 v2 := make([]uint8, len(v)) 1263 var i uint 1264 for k := range v { 1265 v2[i] = k 1266 i++ 1267 } 1268 sort.Sort(uint8Slice(v2)) 1269 for _, k2 := range v2 { 1270 e.mapElemKey() 1271 e.e.EncodeUint(uint64(k2)) 1272 e.mapElemValue() 1273 e.encode(v[k2]) 1274 } 1275 } else { 1276 for k2, v2 := range v { 1277 e.mapElemKey() 1278 e.e.EncodeUint(uint64(k2)) 1279 e.mapElemValue() 1280 e.encode(v2) 1281 } 1282 } 1283 e.mapEnd() 1284 } 1285 func (e *Encoder) fastpathEncMapUint8StringR(f *codecFnInfo, rv reflect.Value) { 1286 fastpathTV.EncMapUint8StringV(rv2i(rv).(map[uint8]string), e) 1287 } 1288 func (fastpathT) EncMapUint8StringV(v map[uint8]string, e *Encoder) { 1289 e.mapStart(len(v)) 1290 if e.h.Canonical { 1291 v2 := make([]uint8, len(v)) 1292 var i uint 1293 for k := range v { 1294 v2[i] = k 1295 i++ 1296 } 1297 sort.Sort(uint8Slice(v2)) 1298 for _, k2 := range v2 { 1299 e.mapElemKey() 1300 e.e.EncodeUint(uint64(k2)) 1301 e.mapElemValue() 1302 e.e.EncodeString(v[k2]) 1303 } 1304 } else { 1305 for k2, v2 := range v { 1306 e.mapElemKey() 1307 e.e.EncodeUint(uint64(k2)) 1308 e.mapElemValue() 1309 e.e.EncodeString(v2) 1310 } 1311 } 1312 e.mapEnd() 1313 } 1314 func (e *Encoder) fastpathEncMapUint8BytesR(f *codecFnInfo, rv reflect.Value) { 1315 fastpathTV.EncMapUint8BytesV(rv2i(rv).(map[uint8][]byte), e) 1316 } 1317 func (fastpathT) EncMapUint8BytesV(v map[uint8][]byte, e *Encoder) { 1318 e.mapStart(len(v)) 1319 if e.h.Canonical { 1320 v2 := make([]uint8, len(v)) 1321 var i uint 1322 for k := range v { 1323 v2[i] = k 1324 i++ 1325 } 1326 sort.Sort(uint8Slice(v2)) 1327 for _, k2 := range v2 { 1328 e.mapElemKey() 1329 e.e.EncodeUint(uint64(k2)) 1330 e.mapElemValue() 1331 e.e.EncodeStringBytesRaw(v[k2]) 1332 } 1333 } else { 1334 for k2, v2 := range v { 1335 e.mapElemKey() 1336 e.e.EncodeUint(uint64(k2)) 1337 e.mapElemValue() 1338 e.e.EncodeStringBytesRaw(v2) 1339 } 1340 } 1341 e.mapEnd() 1342 } 1343 func (e *Encoder) fastpathEncMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) { 1344 fastpathTV.EncMapUint8Uint8V(rv2i(rv).(map[uint8]uint8), e) 1345 } 1346 func (fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, e *Encoder) { 1347 e.mapStart(len(v)) 1348 if e.h.Canonical { 1349 v2 := make([]uint8, len(v)) 1350 var i uint 1351 for k := range v { 1352 v2[i] = k 1353 i++ 1354 } 1355 sort.Sort(uint8Slice(v2)) 1356 for _, k2 := range v2 { 1357 e.mapElemKey() 1358 e.e.EncodeUint(uint64(k2)) 1359 e.mapElemValue() 1360 e.e.EncodeUint(uint64(v[k2])) 1361 } 1362 } else { 1363 for k2, v2 := range v { 1364 e.mapElemKey() 1365 e.e.EncodeUint(uint64(k2)) 1366 e.mapElemValue() 1367 e.e.EncodeUint(uint64(v2)) 1368 } 1369 } 1370 e.mapEnd() 1371 } 1372 func (e *Encoder) fastpathEncMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) { 1373 fastpathTV.EncMapUint8Uint64V(rv2i(rv).(map[uint8]uint64), e) 1374 } 1375 func (fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, e *Encoder) { 1376 e.mapStart(len(v)) 1377 if e.h.Canonical { 1378 v2 := make([]uint8, len(v)) 1379 var i uint 1380 for k := range v { 1381 v2[i] = k 1382 i++ 1383 } 1384 sort.Sort(uint8Slice(v2)) 1385 for _, k2 := range v2 { 1386 e.mapElemKey() 1387 e.e.EncodeUint(uint64(k2)) 1388 e.mapElemValue() 1389 e.e.EncodeUint(v[k2]) 1390 } 1391 } else { 1392 for k2, v2 := range v { 1393 e.mapElemKey() 1394 e.e.EncodeUint(uint64(k2)) 1395 e.mapElemValue() 1396 e.e.EncodeUint(v2) 1397 } 1398 } 1399 e.mapEnd() 1400 } 1401 func (e *Encoder) fastpathEncMapUint8IntR(f *codecFnInfo, rv reflect.Value) { 1402 fastpathTV.EncMapUint8IntV(rv2i(rv).(map[uint8]int), e) 1403 } 1404 func (fastpathT) EncMapUint8IntV(v map[uint8]int, e *Encoder) { 1405 e.mapStart(len(v)) 1406 if e.h.Canonical { 1407 v2 := make([]uint8, len(v)) 1408 var i uint 1409 for k := range v { 1410 v2[i] = k 1411 i++ 1412 } 1413 sort.Sort(uint8Slice(v2)) 1414 for _, k2 := range v2 { 1415 e.mapElemKey() 1416 e.e.EncodeUint(uint64(k2)) 1417 e.mapElemValue() 1418 e.e.EncodeInt(int64(v[k2])) 1419 } 1420 } else { 1421 for k2, v2 := range v { 1422 e.mapElemKey() 1423 e.e.EncodeUint(uint64(k2)) 1424 e.mapElemValue() 1425 e.e.EncodeInt(int64(v2)) 1426 } 1427 } 1428 e.mapEnd() 1429 } 1430 func (e *Encoder) fastpathEncMapUint8Int32R(f *codecFnInfo, rv reflect.Value) { 1431 fastpathTV.EncMapUint8Int32V(rv2i(rv).(map[uint8]int32), e) 1432 } 1433 func (fastpathT) EncMapUint8Int32V(v map[uint8]int32, e *Encoder) { 1434 e.mapStart(len(v)) 1435 if e.h.Canonical { 1436 v2 := make([]uint8, len(v)) 1437 var i uint 1438 for k := range v { 1439 v2[i] = k 1440 i++ 1441 } 1442 sort.Sort(uint8Slice(v2)) 1443 for _, k2 := range v2 { 1444 e.mapElemKey() 1445 e.e.EncodeUint(uint64(k2)) 1446 e.mapElemValue() 1447 e.e.EncodeInt(int64(v[k2])) 1448 } 1449 } else { 1450 for k2, v2 := range v { 1451 e.mapElemKey() 1452 e.e.EncodeUint(uint64(k2)) 1453 e.mapElemValue() 1454 e.e.EncodeInt(int64(v2)) 1455 } 1456 } 1457 e.mapEnd() 1458 } 1459 func (e *Encoder) fastpathEncMapUint8Float64R(f *codecFnInfo, rv reflect.Value) { 1460 fastpathTV.EncMapUint8Float64V(rv2i(rv).(map[uint8]float64), e) 1461 } 1462 func (fastpathT) EncMapUint8Float64V(v map[uint8]float64, e *Encoder) { 1463 e.mapStart(len(v)) 1464 if e.h.Canonical { 1465 v2 := make([]uint8, len(v)) 1466 var i uint 1467 for k := range v { 1468 v2[i] = k 1469 i++ 1470 } 1471 sort.Sort(uint8Slice(v2)) 1472 for _, k2 := range v2 { 1473 e.mapElemKey() 1474 e.e.EncodeUint(uint64(k2)) 1475 e.mapElemValue() 1476 e.e.EncodeFloat64(v[k2]) 1477 } 1478 } else { 1479 for k2, v2 := range v { 1480 e.mapElemKey() 1481 e.e.EncodeUint(uint64(k2)) 1482 e.mapElemValue() 1483 e.e.EncodeFloat64(v2) 1484 } 1485 } 1486 e.mapEnd() 1487 } 1488 func (e *Encoder) fastpathEncMapUint8BoolR(f *codecFnInfo, rv reflect.Value) { 1489 fastpathTV.EncMapUint8BoolV(rv2i(rv).(map[uint8]bool), e) 1490 } 1491 func (fastpathT) EncMapUint8BoolV(v map[uint8]bool, e *Encoder) { 1492 e.mapStart(len(v)) 1493 if e.h.Canonical { 1494 v2 := make([]uint8, len(v)) 1495 var i uint 1496 for k := range v { 1497 v2[i] = k 1498 i++ 1499 } 1500 sort.Sort(uint8Slice(v2)) 1501 for _, k2 := range v2 { 1502 e.mapElemKey() 1503 e.e.EncodeUint(uint64(k2)) 1504 e.mapElemValue() 1505 e.e.EncodeBool(v[k2]) 1506 } 1507 } else { 1508 for k2, v2 := range v { 1509 e.mapElemKey() 1510 e.e.EncodeUint(uint64(k2)) 1511 e.mapElemValue() 1512 e.e.EncodeBool(v2) 1513 } 1514 } 1515 e.mapEnd() 1516 } 1517 func (e *Encoder) fastpathEncMapUint64IntfR(f *codecFnInfo, rv reflect.Value) { 1518 fastpathTV.EncMapUint64IntfV(rv2i(rv).(map[uint64]interface{}), e) 1519 } 1520 func (fastpathT) EncMapUint64IntfV(v map[uint64]interface{}, e *Encoder) { 1521 e.mapStart(len(v)) 1522 if e.h.Canonical { 1523 v2 := make([]uint64, len(v)) 1524 var i uint 1525 for k := range v { 1526 v2[i] = k 1527 i++ 1528 } 1529 sort.Sort(uint64Slice(v2)) 1530 for _, k2 := range v2 { 1531 e.mapElemKey() 1532 e.e.EncodeUint(k2) 1533 e.mapElemValue() 1534 e.encode(v[k2]) 1535 } 1536 } else { 1537 for k2, v2 := range v { 1538 e.mapElemKey() 1539 e.e.EncodeUint(k2) 1540 e.mapElemValue() 1541 e.encode(v2) 1542 } 1543 } 1544 e.mapEnd() 1545 } 1546 func (e *Encoder) fastpathEncMapUint64StringR(f *codecFnInfo, rv reflect.Value) { 1547 fastpathTV.EncMapUint64StringV(rv2i(rv).(map[uint64]string), e) 1548 } 1549 func (fastpathT) EncMapUint64StringV(v map[uint64]string, e *Encoder) { 1550 e.mapStart(len(v)) 1551 if e.h.Canonical { 1552 v2 := make([]uint64, len(v)) 1553 var i uint 1554 for k := range v { 1555 v2[i] = k 1556 i++ 1557 } 1558 sort.Sort(uint64Slice(v2)) 1559 for _, k2 := range v2 { 1560 e.mapElemKey() 1561 e.e.EncodeUint(k2) 1562 e.mapElemValue() 1563 e.e.EncodeString(v[k2]) 1564 } 1565 } else { 1566 for k2, v2 := range v { 1567 e.mapElemKey() 1568 e.e.EncodeUint(k2) 1569 e.mapElemValue() 1570 e.e.EncodeString(v2) 1571 } 1572 } 1573 e.mapEnd() 1574 } 1575 func (e *Encoder) fastpathEncMapUint64BytesR(f *codecFnInfo, rv reflect.Value) { 1576 fastpathTV.EncMapUint64BytesV(rv2i(rv).(map[uint64][]byte), e) 1577 } 1578 func (fastpathT) EncMapUint64BytesV(v map[uint64][]byte, e *Encoder) { 1579 e.mapStart(len(v)) 1580 if e.h.Canonical { 1581 v2 := make([]uint64, len(v)) 1582 var i uint 1583 for k := range v { 1584 v2[i] = k 1585 i++ 1586 } 1587 sort.Sort(uint64Slice(v2)) 1588 for _, k2 := range v2 { 1589 e.mapElemKey() 1590 e.e.EncodeUint(k2) 1591 e.mapElemValue() 1592 e.e.EncodeStringBytesRaw(v[k2]) 1593 } 1594 } else { 1595 for k2, v2 := range v { 1596 e.mapElemKey() 1597 e.e.EncodeUint(k2) 1598 e.mapElemValue() 1599 e.e.EncodeStringBytesRaw(v2) 1600 } 1601 } 1602 e.mapEnd() 1603 } 1604 func (e *Encoder) fastpathEncMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) { 1605 fastpathTV.EncMapUint64Uint8V(rv2i(rv).(map[uint64]uint8), e) 1606 } 1607 func (fastpathT) EncMapUint64Uint8V(v map[uint64]uint8, e *Encoder) { 1608 e.mapStart(len(v)) 1609 if e.h.Canonical { 1610 v2 := make([]uint64, len(v)) 1611 var i uint 1612 for k := range v { 1613 v2[i] = k 1614 i++ 1615 } 1616 sort.Sort(uint64Slice(v2)) 1617 for _, k2 := range v2 { 1618 e.mapElemKey() 1619 e.e.EncodeUint(k2) 1620 e.mapElemValue() 1621 e.e.EncodeUint(uint64(v[k2])) 1622 } 1623 } else { 1624 for k2, v2 := range v { 1625 e.mapElemKey() 1626 e.e.EncodeUint(k2) 1627 e.mapElemValue() 1628 e.e.EncodeUint(uint64(v2)) 1629 } 1630 } 1631 e.mapEnd() 1632 } 1633 func (e *Encoder) fastpathEncMapUint64Uint64R(f *codecFnInfo, rv reflect.Value) { 1634 fastpathTV.EncMapUint64Uint64V(rv2i(rv).(map[uint64]uint64), e) 1635 } 1636 func (fastpathT) EncMapUint64Uint64V(v map[uint64]uint64, e *Encoder) { 1637 e.mapStart(len(v)) 1638 if e.h.Canonical { 1639 v2 := make([]uint64, len(v)) 1640 var i uint 1641 for k := range v { 1642 v2[i] = k 1643 i++ 1644 } 1645 sort.Sort(uint64Slice(v2)) 1646 for _, k2 := range v2 { 1647 e.mapElemKey() 1648 e.e.EncodeUint(k2) 1649 e.mapElemValue() 1650 e.e.EncodeUint(v[k2]) 1651 } 1652 } else { 1653 for k2, v2 := range v { 1654 e.mapElemKey() 1655 e.e.EncodeUint(k2) 1656 e.mapElemValue() 1657 e.e.EncodeUint(v2) 1658 } 1659 } 1660 e.mapEnd() 1661 } 1662 func (e *Encoder) fastpathEncMapUint64IntR(f *codecFnInfo, rv reflect.Value) { 1663 fastpathTV.EncMapUint64IntV(rv2i(rv).(map[uint64]int), e) 1664 } 1665 func (fastpathT) EncMapUint64IntV(v map[uint64]int, e *Encoder) { 1666 e.mapStart(len(v)) 1667 if e.h.Canonical { 1668 v2 := make([]uint64, len(v)) 1669 var i uint 1670 for k := range v { 1671 v2[i] = k 1672 i++ 1673 } 1674 sort.Sort(uint64Slice(v2)) 1675 for _, k2 := range v2 { 1676 e.mapElemKey() 1677 e.e.EncodeUint(k2) 1678 e.mapElemValue() 1679 e.e.EncodeInt(int64(v[k2])) 1680 } 1681 } else { 1682 for k2, v2 := range v { 1683 e.mapElemKey() 1684 e.e.EncodeUint(k2) 1685 e.mapElemValue() 1686 e.e.EncodeInt(int64(v2)) 1687 } 1688 } 1689 e.mapEnd() 1690 } 1691 func (e *Encoder) fastpathEncMapUint64Int32R(f *codecFnInfo, rv reflect.Value) { 1692 fastpathTV.EncMapUint64Int32V(rv2i(rv).(map[uint64]int32), e) 1693 } 1694 func (fastpathT) EncMapUint64Int32V(v map[uint64]int32, e *Encoder) { 1695 e.mapStart(len(v)) 1696 if e.h.Canonical { 1697 v2 := make([]uint64, len(v)) 1698 var i uint 1699 for k := range v { 1700 v2[i] = k 1701 i++ 1702 } 1703 sort.Sort(uint64Slice(v2)) 1704 for _, k2 := range v2 { 1705 e.mapElemKey() 1706 e.e.EncodeUint(k2) 1707 e.mapElemValue() 1708 e.e.EncodeInt(int64(v[k2])) 1709 } 1710 } else { 1711 for k2, v2 := range v { 1712 e.mapElemKey() 1713 e.e.EncodeUint(k2) 1714 e.mapElemValue() 1715 e.e.EncodeInt(int64(v2)) 1716 } 1717 } 1718 e.mapEnd() 1719 } 1720 func (e *Encoder) fastpathEncMapUint64Float64R(f *codecFnInfo, rv reflect.Value) { 1721 fastpathTV.EncMapUint64Float64V(rv2i(rv).(map[uint64]float64), e) 1722 } 1723 func (fastpathT) EncMapUint64Float64V(v map[uint64]float64, e *Encoder) { 1724 e.mapStart(len(v)) 1725 if e.h.Canonical { 1726 v2 := make([]uint64, len(v)) 1727 var i uint 1728 for k := range v { 1729 v2[i] = k 1730 i++ 1731 } 1732 sort.Sort(uint64Slice(v2)) 1733 for _, k2 := range v2 { 1734 e.mapElemKey() 1735 e.e.EncodeUint(k2) 1736 e.mapElemValue() 1737 e.e.EncodeFloat64(v[k2]) 1738 } 1739 } else { 1740 for k2, v2 := range v { 1741 e.mapElemKey() 1742 e.e.EncodeUint(k2) 1743 e.mapElemValue() 1744 e.e.EncodeFloat64(v2) 1745 } 1746 } 1747 e.mapEnd() 1748 } 1749 func (e *Encoder) fastpathEncMapUint64BoolR(f *codecFnInfo, rv reflect.Value) { 1750 fastpathTV.EncMapUint64BoolV(rv2i(rv).(map[uint64]bool), e) 1751 } 1752 func (fastpathT) EncMapUint64BoolV(v map[uint64]bool, e *Encoder) { 1753 e.mapStart(len(v)) 1754 if e.h.Canonical { 1755 v2 := make([]uint64, len(v)) 1756 var i uint 1757 for k := range v { 1758 v2[i] = k 1759 i++ 1760 } 1761 sort.Sort(uint64Slice(v2)) 1762 for _, k2 := range v2 { 1763 e.mapElemKey() 1764 e.e.EncodeUint(k2) 1765 e.mapElemValue() 1766 e.e.EncodeBool(v[k2]) 1767 } 1768 } else { 1769 for k2, v2 := range v { 1770 e.mapElemKey() 1771 e.e.EncodeUint(k2) 1772 e.mapElemValue() 1773 e.e.EncodeBool(v2) 1774 } 1775 } 1776 e.mapEnd() 1777 } 1778 func (e *Encoder) fastpathEncMapIntIntfR(f *codecFnInfo, rv reflect.Value) { 1779 fastpathTV.EncMapIntIntfV(rv2i(rv).(map[int]interface{}), e) 1780 } 1781 func (fastpathT) EncMapIntIntfV(v map[int]interface{}, e *Encoder) { 1782 e.mapStart(len(v)) 1783 if e.h.Canonical { 1784 v2 := make([]int, len(v)) 1785 var i uint 1786 for k := range v { 1787 v2[i] = k 1788 i++ 1789 } 1790 sort.Sort(intSlice(v2)) 1791 for _, k2 := range v2 { 1792 e.mapElemKey() 1793 e.e.EncodeInt(int64(k2)) 1794 e.mapElemValue() 1795 e.encode(v[k2]) 1796 } 1797 } else { 1798 for k2, v2 := range v { 1799 e.mapElemKey() 1800 e.e.EncodeInt(int64(k2)) 1801 e.mapElemValue() 1802 e.encode(v2) 1803 } 1804 } 1805 e.mapEnd() 1806 } 1807 func (e *Encoder) fastpathEncMapIntStringR(f *codecFnInfo, rv reflect.Value) { 1808 fastpathTV.EncMapIntStringV(rv2i(rv).(map[int]string), e) 1809 } 1810 func (fastpathT) EncMapIntStringV(v map[int]string, e *Encoder) { 1811 e.mapStart(len(v)) 1812 if e.h.Canonical { 1813 v2 := make([]int, len(v)) 1814 var i uint 1815 for k := range v { 1816 v2[i] = k 1817 i++ 1818 } 1819 sort.Sort(intSlice(v2)) 1820 for _, k2 := range v2 { 1821 e.mapElemKey() 1822 e.e.EncodeInt(int64(k2)) 1823 e.mapElemValue() 1824 e.e.EncodeString(v[k2]) 1825 } 1826 } else { 1827 for k2, v2 := range v { 1828 e.mapElemKey() 1829 e.e.EncodeInt(int64(k2)) 1830 e.mapElemValue() 1831 e.e.EncodeString(v2) 1832 } 1833 } 1834 e.mapEnd() 1835 } 1836 func (e *Encoder) fastpathEncMapIntBytesR(f *codecFnInfo, rv reflect.Value) { 1837 fastpathTV.EncMapIntBytesV(rv2i(rv).(map[int][]byte), e) 1838 } 1839 func (fastpathT) EncMapIntBytesV(v map[int][]byte, e *Encoder) { 1840 e.mapStart(len(v)) 1841 if e.h.Canonical { 1842 v2 := make([]int, len(v)) 1843 var i uint 1844 for k := range v { 1845 v2[i] = k 1846 i++ 1847 } 1848 sort.Sort(intSlice(v2)) 1849 for _, k2 := range v2 { 1850 e.mapElemKey() 1851 e.e.EncodeInt(int64(k2)) 1852 e.mapElemValue() 1853 e.e.EncodeStringBytesRaw(v[k2]) 1854 } 1855 } else { 1856 for k2, v2 := range v { 1857 e.mapElemKey() 1858 e.e.EncodeInt(int64(k2)) 1859 e.mapElemValue() 1860 e.e.EncodeStringBytesRaw(v2) 1861 } 1862 } 1863 e.mapEnd() 1864 } 1865 func (e *Encoder) fastpathEncMapIntUint8R(f *codecFnInfo, rv reflect.Value) { 1866 fastpathTV.EncMapIntUint8V(rv2i(rv).(map[int]uint8), e) 1867 } 1868 func (fastpathT) EncMapIntUint8V(v map[int]uint8, e *Encoder) { 1869 e.mapStart(len(v)) 1870 if e.h.Canonical { 1871 v2 := make([]int, len(v)) 1872 var i uint 1873 for k := range v { 1874 v2[i] = k 1875 i++ 1876 } 1877 sort.Sort(intSlice(v2)) 1878 for _, k2 := range v2 { 1879 e.mapElemKey() 1880 e.e.EncodeInt(int64(k2)) 1881 e.mapElemValue() 1882 e.e.EncodeUint(uint64(v[k2])) 1883 } 1884 } else { 1885 for k2, v2 := range v { 1886 e.mapElemKey() 1887 e.e.EncodeInt(int64(k2)) 1888 e.mapElemValue() 1889 e.e.EncodeUint(uint64(v2)) 1890 } 1891 } 1892 e.mapEnd() 1893 } 1894 func (e *Encoder) fastpathEncMapIntUint64R(f *codecFnInfo, rv reflect.Value) { 1895 fastpathTV.EncMapIntUint64V(rv2i(rv).(map[int]uint64), e) 1896 } 1897 func (fastpathT) EncMapIntUint64V(v map[int]uint64, e *Encoder) { 1898 e.mapStart(len(v)) 1899 if e.h.Canonical { 1900 v2 := make([]int, len(v)) 1901 var i uint 1902 for k := range v { 1903 v2[i] = k 1904 i++ 1905 } 1906 sort.Sort(intSlice(v2)) 1907 for _, k2 := range v2 { 1908 e.mapElemKey() 1909 e.e.EncodeInt(int64(k2)) 1910 e.mapElemValue() 1911 e.e.EncodeUint(v[k2]) 1912 } 1913 } else { 1914 for k2, v2 := range v { 1915 e.mapElemKey() 1916 e.e.EncodeInt(int64(k2)) 1917 e.mapElemValue() 1918 e.e.EncodeUint(v2) 1919 } 1920 } 1921 e.mapEnd() 1922 } 1923 func (e *Encoder) fastpathEncMapIntIntR(f *codecFnInfo, rv reflect.Value) { 1924 fastpathTV.EncMapIntIntV(rv2i(rv).(map[int]int), e) 1925 } 1926 func (fastpathT) EncMapIntIntV(v map[int]int, e *Encoder) { 1927 e.mapStart(len(v)) 1928 if e.h.Canonical { 1929 v2 := make([]int, len(v)) 1930 var i uint 1931 for k := range v { 1932 v2[i] = k 1933 i++ 1934 } 1935 sort.Sort(intSlice(v2)) 1936 for _, k2 := range v2 { 1937 e.mapElemKey() 1938 e.e.EncodeInt(int64(k2)) 1939 e.mapElemValue() 1940 e.e.EncodeInt(int64(v[k2])) 1941 } 1942 } else { 1943 for k2, v2 := range v { 1944 e.mapElemKey() 1945 e.e.EncodeInt(int64(k2)) 1946 e.mapElemValue() 1947 e.e.EncodeInt(int64(v2)) 1948 } 1949 } 1950 e.mapEnd() 1951 } 1952 func (e *Encoder) fastpathEncMapIntInt32R(f *codecFnInfo, rv reflect.Value) { 1953 fastpathTV.EncMapIntInt32V(rv2i(rv).(map[int]int32), e) 1954 } 1955 func (fastpathT) EncMapIntInt32V(v map[int]int32, e *Encoder) { 1956 e.mapStart(len(v)) 1957 if e.h.Canonical { 1958 v2 := make([]int, len(v)) 1959 var i uint 1960 for k := range v { 1961 v2[i] = k 1962 i++ 1963 } 1964 sort.Sort(intSlice(v2)) 1965 for _, k2 := range v2 { 1966 e.mapElemKey() 1967 e.e.EncodeInt(int64(k2)) 1968 e.mapElemValue() 1969 e.e.EncodeInt(int64(v[k2])) 1970 } 1971 } else { 1972 for k2, v2 := range v { 1973 e.mapElemKey() 1974 e.e.EncodeInt(int64(k2)) 1975 e.mapElemValue() 1976 e.e.EncodeInt(int64(v2)) 1977 } 1978 } 1979 e.mapEnd() 1980 } 1981 func (e *Encoder) fastpathEncMapIntFloat64R(f *codecFnInfo, rv reflect.Value) { 1982 fastpathTV.EncMapIntFloat64V(rv2i(rv).(map[int]float64), e) 1983 } 1984 func (fastpathT) EncMapIntFloat64V(v map[int]float64, e *Encoder) { 1985 e.mapStart(len(v)) 1986 if e.h.Canonical { 1987 v2 := make([]int, len(v)) 1988 var i uint 1989 for k := range v { 1990 v2[i] = k 1991 i++ 1992 } 1993 sort.Sort(intSlice(v2)) 1994 for _, k2 := range v2 { 1995 e.mapElemKey() 1996 e.e.EncodeInt(int64(k2)) 1997 e.mapElemValue() 1998 e.e.EncodeFloat64(v[k2]) 1999 } 2000 } else { 2001 for k2, v2 := range v { 2002 e.mapElemKey() 2003 e.e.EncodeInt(int64(k2)) 2004 e.mapElemValue() 2005 e.e.EncodeFloat64(v2) 2006 } 2007 } 2008 e.mapEnd() 2009 } 2010 func (e *Encoder) fastpathEncMapIntBoolR(f *codecFnInfo, rv reflect.Value) { 2011 fastpathTV.EncMapIntBoolV(rv2i(rv).(map[int]bool), e) 2012 } 2013 func (fastpathT) EncMapIntBoolV(v map[int]bool, e *Encoder) { 2014 e.mapStart(len(v)) 2015 if e.h.Canonical { 2016 v2 := make([]int, len(v)) 2017 var i uint 2018 for k := range v { 2019 v2[i] = k 2020 i++ 2021 } 2022 sort.Sort(intSlice(v2)) 2023 for _, k2 := range v2 { 2024 e.mapElemKey() 2025 e.e.EncodeInt(int64(k2)) 2026 e.mapElemValue() 2027 e.e.EncodeBool(v[k2]) 2028 } 2029 } else { 2030 for k2, v2 := range v { 2031 e.mapElemKey() 2032 e.e.EncodeInt(int64(k2)) 2033 e.mapElemValue() 2034 e.e.EncodeBool(v2) 2035 } 2036 } 2037 e.mapEnd() 2038 } 2039 func (e *Encoder) fastpathEncMapInt32IntfR(f *codecFnInfo, rv reflect.Value) { 2040 fastpathTV.EncMapInt32IntfV(rv2i(rv).(map[int32]interface{}), e) 2041 } 2042 func (fastpathT) EncMapInt32IntfV(v map[int32]interface{}, e *Encoder) { 2043 e.mapStart(len(v)) 2044 if e.h.Canonical { 2045 v2 := make([]int32, len(v)) 2046 var i uint 2047 for k := range v { 2048 v2[i] = k 2049 i++ 2050 } 2051 sort.Sort(int32Slice(v2)) 2052 for _, k2 := range v2 { 2053 e.mapElemKey() 2054 e.e.EncodeInt(int64(k2)) 2055 e.mapElemValue() 2056 e.encode(v[k2]) 2057 } 2058 } else { 2059 for k2, v2 := range v { 2060 e.mapElemKey() 2061 e.e.EncodeInt(int64(k2)) 2062 e.mapElemValue() 2063 e.encode(v2) 2064 } 2065 } 2066 e.mapEnd() 2067 } 2068 func (e *Encoder) fastpathEncMapInt32StringR(f *codecFnInfo, rv reflect.Value) { 2069 fastpathTV.EncMapInt32StringV(rv2i(rv).(map[int32]string), e) 2070 } 2071 func (fastpathT) EncMapInt32StringV(v map[int32]string, e *Encoder) { 2072 e.mapStart(len(v)) 2073 if e.h.Canonical { 2074 v2 := make([]int32, len(v)) 2075 var i uint 2076 for k := range v { 2077 v2[i] = k 2078 i++ 2079 } 2080 sort.Sort(int32Slice(v2)) 2081 for _, k2 := range v2 { 2082 e.mapElemKey() 2083 e.e.EncodeInt(int64(k2)) 2084 e.mapElemValue() 2085 e.e.EncodeString(v[k2]) 2086 } 2087 } else { 2088 for k2, v2 := range v { 2089 e.mapElemKey() 2090 e.e.EncodeInt(int64(k2)) 2091 e.mapElemValue() 2092 e.e.EncodeString(v2) 2093 } 2094 } 2095 e.mapEnd() 2096 } 2097 func (e *Encoder) fastpathEncMapInt32BytesR(f *codecFnInfo, rv reflect.Value) { 2098 fastpathTV.EncMapInt32BytesV(rv2i(rv).(map[int32][]byte), e) 2099 } 2100 func (fastpathT) EncMapInt32BytesV(v map[int32][]byte, e *Encoder) { 2101 e.mapStart(len(v)) 2102 if e.h.Canonical { 2103 v2 := make([]int32, len(v)) 2104 var i uint 2105 for k := range v { 2106 v2[i] = k 2107 i++ 2108 } 2109 sort.Sort(int32Slice(v2)) 2110 for _, k2 := range v2 { 2111 e.mapElemKey() 2112 e.e.EncodeInt(int64(k2)) 2113 e.mapElemValue() 2114 e.e.EncodeStringBytesRaw(v[k2]) 2115 } 2116 } else { 2117 for k2, v2 := range v { 2118 e.mapElemKey() 2119 e.e.EncodeInt(int64(k2)) 2120 e.mapElemValue() 2121 e.e.EncodeStringBytesRaw(v2) 2122 } 2123 } 2124 e.mapEnd() 2125 } 2126 func (e *Encoder) fastpathEncMapInt32Uint8R(f *codecFnInfo, rv reflect.Value) { 2127 fastpathTV.EncMapInt32Uint8V(rv2i(rv).(map[int32]uint8), e) 2128 } 2129 func (fastpathT) EncMapInt32Uint8V(v map[int32]uint8, e *Encoder) { 2130 e.mapStart(len(v)) 2131 if e.h.Canonical { 2132 v2 := make([]int32, len(v)) 2133 var i uint 2134 for k := range v { 2135 v2[i] = k 2136 i++ 2137 } 2138 sort.Sort(int32Slice(v2)) 2139 for _, k2 := range v2 { 2140 e.mapElemKey() 2141 e.e.EncodeInt(int64(k2)) 2142 e.mapElemValue() 2143 e.e.EncodeUint(uint64(v[k2])) 2144 } 2145 } else { 2146 for k2, v2 := range v { 2147 e.mapElemKey() 2148 e.e.EncodeInt(int64(k2)) 2149 e.mapElemValue() 2150 e.e.EncodeUint(uint64(v2)) 2151 } 2152 } 2153 e.mapEnd() 2154 } 2155 func (e *Encoder) fastpathEncMapInt32Uint64R(f *codecFnInfo, rv reflect.Value) { 2156 fastpathTV.EncMapInt32Uint64V(rv2i(rv).(map[int32]uint64), e) 2157 } 2158 func (fastpathT) EncMapInt32Uint64V(v map[int32]uint64, e *Encoder) { 2159 e.mapStart(len(v)) 2160 if e.h.Canonical { 2161 v2 := make([]int32, len(v)) 2162 var i uint 2163 for k := range v { 2164 v2[i] = k 2165 i++ 2166 } 2167 sort.Sort(int32Slice(v2)) 2168 for _, k2 := range v2 { 2169 e.mapElemKey() 2170 e.e.EncodeInt(int64(k2)) 2171 e.mapElemValue() 2172 e.e.EncodeUint(v[k2]) 2173 } 2174 } else { 2175 for k2, v2 := range v { 2176 e.mapElemKey() 2177 e.e.EncodeInt(int64(k2)) 2178 e.mapElemValue() 2179 e.e.EncodeUint(v2) 2180 } 2181 } 2182 e.mapEnd() 2183 } 2184 func (e *Encoder) fastpathEncMapInt32IntR(f *codecFnInfo, rv reflect.Value) { 2185 fastpathTV.EncMapInt32IntV(rv2i(rv).(map[int32]int), e) 2186 } 2187 func (fastpathT) EncMapInt32IntV(v map[int32]int, e *Encoder) { 2188 e.mapStart(len(v)) 2189 if e.h.Canonical { 2190 v2 := make([]int32, len(v)) 2191 var i uint 2192 for k := range v { 2193 v2[i] = k 2194 i++ 2195 } 2196 sort.Sort(int32Slice(v2)) 2197 for _, k2 := range v2 { 2198 e.mapElemKey() 2199 e.e.EncodeInt(int64(k2)) 2200 e.mapElemValue() 2201 e.e.EncodeInt(int64(v[k2])) 2202 } 2203 } else { 2204 for k2, v2 := range v { 2205 e.mapElemKey() 2206 e.e.EncodeInt(int64(k2)) 2207 e.mapElemValue() 2208 e.e.EncodeInt(int64(v2)) 2209 } 2210 } 2211 e.mapEnd() 2212 } 2213 func (e *Encoder) fastpathEncMapInt32Int32R(f *codecFnInfo, rv reflect.Value) { 2214 fastpathTV.EncMapInt32Int32V(rv2i(rv).(map[int32]int32), e) 2215 } 2216 func (fastpathT) EncMapInt32Int32V(v map[int32]int32, e *Encoder) { 2217 e.mapStart(len(v)) 2218 if e.h.Canonical { 2219 v2 := make([]int32, len(v)) 2220 var i uint 2221 for k := range v { 2222 v2[i] = k 2223 i++ 2224 } 2225 sort.Sort(int32Slice(v2)) 2226 for _, k2 := range v2 { 2227 e.mapElemKey() 2228 e.e.EncodeInt(int64(k2)) 2229 e.mapElemValue() 2230 e.e.EncodeInt(int64(v[k2])) 2231 } 2232 } else { 2233 for k2, v2 := range v { 2234 e.mapElemKey() 2235 e.e.EncodeInt(int64(k2)) 2236 e.mapElemValue() 2237 e.e.EncodeInt(int64(v2)) 2238 } 2239 } 2240 e.mapEnd() 2241 } 2242 func (e *Encoder) fastpathEncMapInt32Float64R(f *codecFnInfo, rv reflect.Value) { 2243 fastpathTV.EncMapInt32Float64V(rv2i(rv).(map[int32]float64), e) 2244 } 2245 func (fastpathT) EncMapInt32Float64V(v map[int32]float64, e *Encoder) { 2246 e.mapStart(len(v)) 2247 if e.h.Canonical { 2248 v2 := make([]int32, len(v)) 2249 var i uint 2250 for k := range v { 2251 v2[i] = k 2252 i++ 2253 } 2254 sort.Sort(int32Slice(v2)) 2255 for _, k2 := range v2 { 2256 e.mapElemKey() 2257 e.e.EncodeInt(int64(k2)) 2258 e.mapElemValue() 2259 e.e.EncodeFloat64(v[k2]) 2260 } 2261 } else { 2262 for k2, v2 := range v { 2263 e.mapElemKey() 2264 e.e.EncodeInt(int64(k2)) 2265 e.mapElemValue() 2266 e.e.EncodeFloat64(v2) 2267 } 2268 } 2269 e.mapEnd() 2270 } 2271 func (e *Encoder) fastpathEncMapInt32BoolR(f *codecFnInfo, rv reflect.Value) { 2272 fastpathTV.EncMapInt32BoolV(rv2i(rv).(map[int32]bool), e) 2273 } 2274 func (fastpathT) EncMapInt32BoolV(v map[int32]bool, e *Encoder) { 2275 e.mapStart(len(v)) 2276 if e.h.Canonical { 2277 v2 := make([]int32, len(v)) 2278 var i uint 2279 for k := range v { 2280 v2[i] = k 2281 i++ 2282 } 2283 sort.Sort(int32Slice(v2)) 2284 for _, k2 := range v2 { 2285 e.mapElemKey() 2286 e.e.EncodeInt(int64(k2)) 2287 e.mapElemValue() 2288 e.e.EncodeBool(v[k2]) 2289 } 2290 } else { 2291 for k2, v2 := range v { 2292 e.mapElemKey() 2293 e.e.EncodeInt(int64(k2)) 2294 e.mapElemValue() 2295 e.e.EncodeBool(v2) 2296 } 2297 } 2298 e.mapEnd() 2299 } 2300 2301 // -- decode 2302 2303 // -- -- fast path type switch 2304 func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { 2305 var changed bool 2306 var containerLen int 2307 switch v := iv.(type) { 2308 case []interface{}: 2309 fastpathTV.DecSliceIntfN(v, d) 2310 case *[]interface{}: 2311 var v2 []interface{} 2312 if v2, changed = fastpathTV.DecSliceIntfY(*v, d); changed { 2313 *v = v2 2314 } 2315 case []string: 2316 fastpathTV.DecSliceStringN(v, d) 2317 case *[]string: 2318 var v2 []string 2319 if v2, changed = fastpathTV.DecSliceStringY(*v, d); changed { 2320 *v = v2 2321 } 2322 case [][]byte: 2323 fastpathTV.DecSliceBytesN(v, d) 2324 case *[][]byte: 2325 var v2 [][]byte 2326 if v2, changed = fastpathTV.DecSliceBytesY(*v, d); changed { 2327 *v = v2 2328 } 2329 case []float32: 2330 fastpathTV.DecSliceFloat32N(v, d) 2331 case *[]float32: 2332 var v2 []float32 2333 if v2, changed = fastpathTV.DecSliceFloat32Y(*v, d); changed { 2334 *v = v2 2335 } 2336 case []float64: 2337 fastpathTV.DecSliceFloat64N(v, d) 2338 case *[]float64: 2339 var v2 []float64 2340 if v2, changed = fastpathTV.DecSliceFloat64Y(*v, d); changed { 2341 *v = v2 2342 } 2343 case []uint8: 2344 fastpathTV.DecSliceUint8N(v, d) 2345 case *[]uint8: 2346 var v2 []uint8 2347 if v2, changed = fastpathTV.DecSliceUint8Y(*v, d); changed { 2348 *v = v2 2349 } 2350 case []uint64: 2351 fastpathTV.DecSliceUint64N(v, d) 2352 case *[]uint64: 2353 var v2 []uint64 2354 if v2, changed = fastpathTV.DecSliceUint64Y(*v, d); changed { 2355 *v = v2 2356 } 2357 case []int: 2358 fastpathTV.DecSliceIntN(v, d) 2359 case *[]int: 2360 var v2 []int 2361 if v2, changed = fastpathTV.DecSliceIntY(*v, d); changed { 2362 *v = v2 2363 } 2364 case []int32: 2365 fastpathTV.DecSliceInt32N(v, d) 2366 case *[]int32: 2367 var v2 []int32 2368 if v2, changed = fastpathTV.DecSliceInt32Y(*v, d); changed { 2369 *v = v2 2370 } 2371 case []int64: 2372 fastpathTV.DecSliceInt64N(v, d) 2373 case *[]int64: 2374 var v2 []int64 2375 if v2, changed = fastpathTV.DecSliceInt64Y(*v, d); changed { 2376 *v = v2 2377 } 2378 case []bool: 2379 fastpathTV.DecSliceBoolN(v, d) 2380 case *[]bool: 2381 var v2 []bool 2382 if v2, changed = fastpathTV.DecSliceBoolY(*v, d); changed { 2383 *v = v2 2384 } 2385 case map[string]interface{}: 2386 containerLen = d.mapStart(d.d.ReadMapStart()) 2387 if containerLen != containerLenNil { 2388 if containerLen != 0 { 2389 fastpathTV.DecMapStringIntfL(v, containerLen, d) 2390 } 2391 d.mapEnd() 2392 } 2393 case *map[string]interface{}: 2394 fastpathTV.DecMapStringIntfX(v, d) 2395 case map[string]string: 2396 containerLen = d.mapStart(d.d.ReadMapStart()) 2397 if containerLen != containerLenNil { 2398 if containerLen != 0 { 2399 fastpathTV.DecMapStringStringL(v, containerLen, d) 2400 } 2401 d.mapEnd() 2402 } 2403 case *map[string]string: 2404 fastpathTV.DecMapStringStringX(v, d) 2405 case map[string][]byte: 2406 containerLen = d.mapStart(d.d.ReadMapStart()) 2407 if containerLen != containerLenNil { 2408 if containerLen != 0 { 2409 fastpathTV.DecMapStringBytesL(v, containerLen, d) 2410 } 2411 d.mapEnd() 2412 } 2413 case *map[string][]byte: 2414 fastpathTV.DecMapStringBytesX(v, d) 2415 case map[string]uint8: 2416 containerLen = d.mapStart(d.d.ReadMapStart()) 2417 if containerLen != containerLenNil { 2418 if containerLen != 0 { 2419 fastpathTV.DecMapStringUint8L(v, containerLen, d) 2420 } 2421 d.mapEnd() 2422 } 2423 case *map[string]uint8: 2424 fastpathTV.DecMapStringUint8X(v, d) 2425 case map[string]uint64: 2426 containerLen = d.mapStart(d.d.ReadMapStart()) 2427 if containerLen != containerLenNil { 2428 if containerLen != 0 { 2429 fastpathTV.DecMapStringUint64L(v, containerLen, d) 2430 } 2431 d.mapEnd() 2432 } 2433 case *map[string]uint64: 2434 fastpathTV.DecMapStringUint64X(v, d) 2435 case map[string]int: 2436 containerLen = d.mapStart(d.d.ReadMapStart()) 2437 if containerLen != containerLenNil { 2438 if containerLen != 0 { 2439 fastpathTV.DecMapStringIntL(v, containerLen, d) 2440 } 2441 d.mapEnd() 2442 } 2443 case *map[string]int: 2444 fastpathTV.DecMapStringIntX(v, d) 2445 case map[string]int32: 2446 containerLen = d.mapStart(d.d.ReadMapStart()) 2447 if containerLen != containerLenNil { 2448 if containerLen != 0 { 2449 fastpathTV.DecMapStringInt32L(v, containerLen, d) 2450 } 2451 d.mapEnd() 2452 } 2453 case *map[string]int32: 2454 fastpathTV.DecMapStringInt32X(v, d) 2455 case map[string]float64: 2456 containerLen = d.mapStart(d.d.ReadMapStart()) 2457 if containerLen != containerLenNil { 2458 if containerLen != 0 { 2459 fastpathTV.DecMapStringFloat64L(v, containerLen, d) 2460 } 2461 d.mapEnd() 2462 } 2463 case *map[string]float64: 2464 fastpathTV.DecMapStringFloat64X(v, d) 2465 case map[string]bool: 2466 containerLen = d.mapStart(d.d.ReadMapStart()) 2467 if containerLen != containerLenNil { 2468 if containerLen != 0 { 2469 fastpathTV.DecMapStringBoolL(v, containerLen, d) 2470 } 2471 d.mapEnd() 2472 } 2473 case *map[string]bool: 2474 fastpathTV.DecMapStringBoolX(v, d) 2475 case map[uint8]interface{}: 2476 containerLen = d.mapStart(d.d.ReadMapStart()) 2477 if containerLen != containerLenNil { 2478 if containerLen != 0 { 2479 fastpathTV.DecMapUint8IntfL(v, containerLen, d) 2480 } 2481 d.mapEnd() 2482 } 2483 case *map[uint8]interface{}: 2484 fastpathTV.DecMapUint8IntfX(v, d) 2485 case map[uint8]string: 2486 containerLen = d.mapStart(d.d.ReadMapStart()) 2487 if containerLen != containerLenNil { 2488 if containerLen != 0 { 2489 fastpathTV.DecMapUint8StringL(v, containerLen, d) 2490 } 2491 d.mapEnd() 2492 } 2493 case *map[uint8]string: 2494 fastpathTV.DecMapUint8StringX(v, d) 2495 case map[uint8][]byte: 2496 containerLen = d.mapStart(d.d.ReadMapStart()) 2497 if containerLen != containerLenNil { 2498 if containerLen != 0 { 2499 fastpathTV.DecMapUint8BytesL(v, containerLen, d) 2500 } 2501 d.mapEnd() 2502 } 2503 case *map[uint8][]byte: 2504 fastpathTV.DecMapUint8BytesX(v, d) 2505 case map[uint8]uint8: 2506 containerLen = d.mapStart(d.d.ReadMapStart()) 2507 if containerLen != containerLenNil { 2508 if containerLen != 0 { 2509 fastpathTV.DecMapUint8Uint8L(v, containerLen, d) 2510 } 2511 d.mapEnd() 2512 } 2513 case *map[uint8]uint8: 2514 fastpathTV.DecMapUint8Uint8X(v, d) 2515 case map[uint8]uint64: 2516 containerLen = d.mapStart(d.d.ReadMapStart()) 2517 if containerLen != containerLenNil { 2518 if containerLen != 0 { 2519 fastpathTV.DecMapUint8Uint64L(v, containerLen, d) 2520 } 2521 d.mapEnd() 2522 } 2523 case *map[uint8]uint64: 2524 fastpathTV.DecMapUint8Uint64X(v, d) 2525 case map[uint8]int: 2526 containerLen = d.mapStart(d.d.ReadMapStart()) 2527 if containerLen != containerLenNil { 2528 if containerLen != 0 { 2529 fastpathTV.DecMapUint8IntL(v, containerLen, d) 2530 } 2531 d.mapEnd() 2532 } 2533 case *map[uint8]int: 2534 fastpathTV.DecMapUint8IntX(v, d) 2535 case map[uint8]int32: 2536 containerLen = d.mapStart(d.d.ReadMapStart()) 2537 if containerLen != containerLenNil { 2538 if containerLen != 0 { 2539 fastpathTV.DecMapUint8Int32L(v, containerLen, d) 2540 } 2541 d.mapEnd() 2542 } 2543 case *map[uint8]int32: 2544 fastpathTV.DecMapUint8Int32X(v, d) 2545 case map[uint8]float64: 2546 containerLen = d.mapStart(d.d.ReadMapStart()) 2547 if containerLen != containerLenNil { 2548 if containerLen != 0 { 2549 fastpathTV.DecMapUint8Float64L(v, containerLen, d) 2550 } 2551 d.mapEnd() 2552 } 2553 case *map[uint8]float64: 2554 fastpathTV.DecMapUint8Float64X(v, d) 2555 case map[uint8]bool: 2556 containerLen = d.mapStart(d.d.ReadMapStart()) 2557 if containerLen != containerLenNil { 2558 if containerLen != 0 { 2559 fastpathTV.DecMapUint8BoolL(v, containerLen, d) 2560 } 2561 d.mapEnd() 2562 } 2563 case *map[uint8]bool: 2564 fastpathTV.DecMapUint8BoolX(v, d) 2565 case map[uint64]interface{}: 2566 containerLen = d.mapStart(d.d.ReadMapStart()) 2567 if containerLen != containerLenNil { 2568 if containerLen != 0 { 2569 fastpathTV.DecMapUint64IntfL(v, containerLen, d) 2570 } 2571 d.mapEnd() 2572 } 2573 case *map[uint64]interface{}: 2574 fastpathTV.DecMapUint64IntfX(v, d) 2575 case map[uint64]string: 2576 containerLen = d.mapStart(d.d.ReadMapStart()) 2577 if containerLen != containerLenNil { 2578 if containerLen != 0 { 2579 fastpathTV.DecMapUint64StringL(v, containerLen, d) 2580 } 2581 d.mapEnd() 2582 } 2583 case *map[uint64]string: 2584 fastpathTV.DecMapUint64StringX(v, d) 2585 case map[uint64][]byte: 2586 containerLen = d.mapStart(d.d.ReadMapStart()) 2587 if containerLen != containerLenNil { 2588 if containerLen != 0 { 2589 fastpathTV.DecMapUint64BytesL(v, containerLen, d) 2590 } 2591 d.mapEnd() 2592 } 2593 case *map[uint64][]byte: 2594 fastpathTV.DecMapUint64BytesX(v, d) 2595 case map[uint64]uint8: 2596 containerLen = d.mapStart(d.d.ReadMapStart()) 2597 if containerLen != containerLenNil { 2598 if containerLen != 0 { 2599 fastpathTV.DecMapUint64Uint8L(v, containerLen, d) 2600 } 2601 d.mapEnd() 2602 } 2603 case *map[uint64]uint8: 2604 fastpathTV.DecMapUint64Uint8X(v, d) 2605 case map[uint64]uint64: 2606 containerLen = d.mapStart(d.d.ReadMapStart()) 2607 if containerLen != containerLenNil { 2608 if containerLen != 0 { 2609 fastpathTV.DecMapUint64Uint64L(v, containerLen, d) 2610 } 2611 d.mapEnd() 2612 } 2613 case *map[uint64]uint64: 2614 fastpathTV.DecMapUint64Uint64X(v, d) 2615 case map[uint64]int: 2616 containerLen = d.mapStart(d.d.ReadMapStart()) 2617 if containerLen != containerLenNil { 2618 if containerLen != 0 { 2619 fastpathTV.DecMapUint64IntL(v, containerLen, d) 2620 } 2621 d.mapEnd() 2622 } 2623 case *map[uint64]int: 2624 fastpathTV.DecMapUint64IntX(v, d) 2625 case map[uint64]int32: 2626 containerLen = d.mapStart(d.d.ReadMapStart()) 2627 if containerLen != containerLenNil { 2628 if containerLen != 0 { 2629 fastpathTV.DecMapUint64Int32L(v, containerLen, d) 2630 } 2631 d.mapEnd() 2632 } 2633 case *map[uint64]int32: 2634 fastpathTV.DecMapUint64Int32X(v, d) 2635 case map[uint64]float64: 2636 containerLen = d.mapStart(d.d.ReadMapStart()) 2637 if containerLen != containerLenNil { 2638 if containerLen != 0 { 2639 fastpathTV.DecMapUint64Float64L(v, containerLen, d) 2640 } 2641 d.mapEnd() 2642 } 2643 case *map[uint64]float64: 2644 fastpathTV.DecMapUint64Float64X(v, d) 2645 case map[uint64]bool: 2646 containerLen = d.mapStart(d.d.ReadMapStart()) 2647 if containerLen != containerLenNil { 2648 if containerLen != 0 { 2649 fastpathTV.DecMapUint64BoolL(v, containerLen, d) 2650 } 2651 d.mapEnd() 2652 } 2653 case *map[uint64]bool: 2654 fastpathTV.DecMapUint64BoolX(v, d) 2655 case map[int]interface{}: 2656 containerLen = d.mapStart(d.d.ReadMapStart()) 2657 if containerLen != containerLenNil { 2658 if containerLen != 0 { 2659 fastpathTV.DecMapIntIntfL(v, containerLen, d) 2660 } 2661 d.mapEnd() 2662 } 2663 case *map[int]interface{}: 2664 fastpathTV.DecMapIntIntfX(v, d) 2665 case map[int]string: 2666 containerLen = d.mapStart(d.d.ReadMapStart()) 2667 if containerLen != containerLenNil { 2668 if containerLen != 0 { 2669 fastpathTV.DecMapIntStringL(v, containerLen, d) 2670 } 2671 d.mapEnd() 2672 } 2673 case *map[int]string: 2674 fastpathTV.DecMapIntStringX(v, d) 2675 case map[int][]byte: 2676 containerLen = d.mapStart(d.d.ReadMapStart()) 2677 if containerLen != containerLenNil { 2678 if containerLen != 0 { 2679 fastpathTV.DecMapIntBytesL(v, containerLen, d) 2680 } 2681 d.mapEnd() 2682 } 2683 case *map[int][]byte: 2684 fastpathTV.DecMapIntBytesX(v, d) 2685 case map[int]uint8: 2686 containerLen = d.mapStart(d.d.ReadMapStart()) 2687 if containerLen != containerLenNil { 2688 if containerLen != 0 { 2689 fastpathTV.DecMapIntUint8L(v, containerLen, d) 2690 } 2691 d.mapEnd() 2692 } 2693 case *map[int]uint8: 2694 fastpathTV.DecMapIntUint8X(v, d) 2695 case map[int]uint64: 2696 containerLen = d.mapStart(d.d.ReadMapStart()) 2697 if containerLen != containerLenNil { 2698 if containerLen != 0 { 2699 fastpathTV.DecMapIntUint64L(v, containerLen, d) 2700 } 2701 d.mapEnd() 2702 } 2703 case *map[int]uint64: 2704 fastpathTV.DecMapIntUint64X(v, d) 2705 case map[int]int: 2706 containerLen = d.mapStart(d.d.ReadMapStart()) 2707 if containerLen != containerLenNil { 2708 if containerLen != 0 { 2709 fastpathTV.DecMapIntIntL(v, containerLen, d) 2710 } 2711 d.mapEnd() 2712 } 2713 case *map[int]int: 2714 fastpathTV.DecMapIntIntX(v, d) 2715 case map[int]int32: 2716 containerLen = d.mapStart(d.d.ReadMapStart()) 2717 if containerLen != containerLenNil { 2718 if containerLen != 0 { 2719 fastpathTV.DecMapIntInt32L(v, containerLen, d) 2720 } 2721 d.mapEnd() 2722 } 2723 case *map[int]int32: 2724 fastpathTV.DecMapIntInt32X(v, d) 2725 case map[int]float64: 2726 containerLen = d.mapStart(d.d.ReadMapStart()) 2727 if containerLen != containerLenNil { 2728 if containerLen != 0 { 2729 fastpathTV.DecMapIntFloat64L(v, containerLen, d) 2730 } 2731 d.mapEnd() 2732 } 2733 case *map[int]float64: 2734 fastpathTV.DecMapIntFloat64X(v, d) 2735 case map[int]bool: 2736 containerLen = d.mapStart(d.d.ReadMapStart()) 2737 if containerLen != containerLenNil { 2738 if containerLen != 0 { 2739 fastpathTV.DecMapIntBoolL(v, containerLen, d) 2740 } 2741 d.mapEnd() 2742 } 2743 case *map[int]bool: 2744 fastpathTV.DecMapIntBoolX(v, d) 2745 case map[int32]interface{}: 2746 containerLen = d.mapStart(d.d.ReadMapStart()) 2747 if containerLen != containerLenNil { 2748 if containerLen != 0 { 2749 fastpathTV.DecMapInt32IntfL(v, containerLen, d) 2750 } 2751 d.mapEnd() 2752 } 2753 case *map[int32]interface{}: 2754 fastpathTV.DecMapInt32IntfX(v, d) 2755 case map[int32]string: 2756 containerLen = d.mapStart(d.d.ReadMapStart()) 2757 if containerLen != containerLenNil { 2758 if containerLen != 0 { 2759 fastpathTV.DecMapInt32StringL(v, containerLen, d) 2760 } 2761 d.mapEnd() 2762 } 2763 case *map[int32]string: 2764 fastpathTV.DecMapInt32StringX(v, d) 2765 case map[int32][]byte: 2766 containerLen = d.mapStart(d.d.ReadMapStart()) 2767 if containerLen != containerLenNil { 2768 if containerLen != 0 { 2769 fastpathTV.DecMapInt32BytesL(v, containerLen, d) 2770 } 2771 d.mapEnd() 2772 } 2773 case *map[int32][]byte: 2774 fastpathTV.DecMapInt32BytesX(v, d) 2775 case map[int32]uint8: 2776 containerLen = d.mapStart(d.d.ReadMapStart()) 2777 if containerLen != containerLenNil { 2778 if containerLen != 0 { 2779 fastpathTV.DecMapInt32Uint8L(v, containerLen, d) 2780 } 2781 d.mapEnd() 2782 } 2783 case *map[int32]uint8: 2784 fastpathTV.DecMapInt32Uint8X(v, d) 2785 case map[int32]uint64: 2786 containerLen = d.mapStart(d.d.ReadMapStart()) 2787 if containerLen != containerLenNil { 2788 if containerLen != 0 { 2789 fastpathTV.DecMapInt32Uint64L(v, containerLen, d) 2790 } 2791 d.mapEnd() 2792 } 2793 case *map[int32]uint64: 2794 fastpathTV.DecMapInt32Uint64X(v, d) 2795 case map[int32]int: 2796 containerLen = d.mapStart(d.d.ReadMapStart()) 2797 if containerLen != containerLenNil { 2798 if containerLen != 0 { 2799 fastpathTV.DecMapInt32IntL(v, containerLen, d) 2800 } 2801 d.mapEnd() 2802 } 2803 case *map[int32]int: 2804 fastpathTV.DecMapInt32IntX(v, d) 2805 case map[int32]int32: 2806 containerLen = d.mapStart(d.d.ReadMapStart()) 2807 if containerLen != containerLenNil { 2808 if containerLen != 0 { 2809 fastpathTV.DecMapInt32Int32L(v, containerLen, d) 2810 } 2811 d.mapEnd() 2812 } 2813 case *map[int32]int32: 2814 fastpathTV.DecMapInt32Int32X(v, d) 2815 case map[int32]float64: 2816 containerLen = d.mapStart(d.d.ReadMapStart()) 2817 if containerLen != containerLenNil { 2818 if containerLen != 0 { 2819 fastpathTV.DecMapInt32Float64L(v, containerLen, d) 2820 } 2821 d.mapEnd() 2822 } 2823 case *map[int32]float64: 2824 fastpathTV.DecMapInt32Float64X(v, d) 2825 case map[int32]bool: 2826 containerLen = d.mapStart(d.d.ReadMapStart()) 2827 if containerLen != containerLenNil { 2828 if containerLen != 0 { 2829 fastpathTV.DecMapInt32BoolL(v, containerLen, d) 2830 } 2831 d.mapEnd() 2832 } 2833 case *map[int32]bool: 2834 fastpathTV.DecMapInt32BoolX(v, d) 2835 default: 2836 _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 2837 return false 2838 } 2839 return true 2840 } 2841 2842 func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { 2843 switch v := iv.(type) { 2844 case *[]interface{}: 2845 *v = nil 2846 case *[]string: 2847 *v = nil 2848 case *[][]byte: 2849 *v = nil 2850 case *[]float32: 2851 *v = nil 2852 case *[]float64: 2853 *v = nil 2854 case *[]uint8: 2855 *v = nil 2856 case *[]uint64: 2857 *v = nil 2858 case *[]int: 2859 *v = nil 2860 case *[]int32: 2861 *v = nil 2862 case *[]int64: 2863 *v = nil 2864 case *[]bool: 2865 *v = nil 2866 2867 case *map[string]interface{}: 2868 *v = nil 2869 case *map[string]string: 2870 *v = nil 2871 case *map[string][]byte: 2872 *v = nil 2873 case *map[string]uint8: 2874 *v = nil 2875 case *map[string]uint64: 2876 *v = nil 2877 case *map[string]int: 2878 *v = nil 2879 case *map[string]int32: 2880 *v = nil 2881 case *map[string]float64: 2882 *v = nil 2883 case *map[string]bool: 2884 *v = nil 2885 case *map[uint8]interface{}: 2886 *v = nil 2887 case *map[uint8]string: 2888 *v = nil 2889 case *map[uint8][]byte: 2890 *v = nil 2891 case *map[uint8]uint8: 2892 *v = nil 2893 case *map[uint8]uint64: 2894 *v = nil 2895 case *map[uint8]int: 2896 *v = nil 2897 case *map[uint8]int32: 2898 *v = nil 2899 case *map[uint8]float64: 2900 *v = nil 2901 case *map[uint8]bool: 2902 *v = nil 2903 case *map[uint64]interface{}: 2904 *v = nil 2905 case *map[uint64]string: 2906 *v = nil 2907 case *map[uint64][]byte: 2908 *v = nil 2909 case *map[uint64]uint8: 2910 *v = nil 2911 case *map[uint64]uint64: 2912 *v = nil 2913 case *map[uint64]int: 2914 *v = nil 2915 case *map[uint64]int32: 2916 *v = nil 2917 case *map[uint64]float64: 2918 *v = nil 2919 case *map[uint64]bool: 2920 *v = nil 2921 case *map[int]interface{}: 2922 *v = nil 2923 case *map[int]string: 2924 *v = nil 2925 case *map[int][]byte: 2926 *v = nil 2927 case *map[int]uint8: 2928 *v = nil 2929 case *map[int]uint64: 2930 *v = nil 2931 case *map[int]int: 2932 *v = nil 2933 case *map[int]int32: 2934 *v = nil 2935 case *map[int]float64: 2936 *v = nil 2937 case *map[int]bool: 2938 *v = nil 2939 case *map[int32]interface{}: 2940 *v = nil 2941 case *map[int32]string: 2942 *v = nil 2943 case *map[int32][]byte: 2944 *v = nil 2945 case *map[int32]uint8: 2946 *v = nil 2947 case *map[int32]uint64: 2948 *v = nil 2949 case *map[int32]int: 2950 *v = nil 2951 case *map[int32]int32: 2952 *v = nil 2953 case *map[int32]float64: 2954 *v = nil 2955 case *map[int32]bool: 2956 *v = nil 2957 2958 default: 2959 _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 2960 return false 2961 } 2962 return true 2963 } 2964 2965 // -- -- fast path functions 2966 2967 func (d *Decoder) fastpathDecSliceIntfR(f *codecFnInfo, rv reflect.Value) { 2968 var v []interface{} 2969 switch rv.Kind() { 2970 case reflect.Ptr: 2971 vp := rv2i(rv).(*[]interface{}) 2972 var changed bool 2973 if v, changed = fastpathTV.DecSliceIntfY(*vp, d); changed { 2974 *vp = v 2975 } 2976 case reflect.Array: 2977 rvGetSlice4Array(rv, &v) 2978 fastpathTV.DecSliceIntfN(v, d) 2979 default: 2980 fastpathTV.DecSliceIntfN(rv2i(rv).([]interface{}), d) 2981 } 2982 } 2983 func (f fastpathT) DecSliceIntfX(vp *[]interface{}, d *Decoder) { 2984 if v, changed := f.DecSliceIntfY(*vp, d); changed { 2985 *vp = v 2986 } 2987 } 2988 func (fastpathT) DecSliceIntfY(v []interface{}, d *Decoder) (v2 []interface{}, changed bool) { 2989 slh, containerLenS := d.decSliceHelperStart() 2990 if slh.IsNil { 2991 if v == nil { 2992 return 2993 } 2994 return nil, true 2995 } 2996 if containerLenS == 0 { 2997 if v == nil { 2998 v = []interface{}{} 2999 } else if len(v) != 0 { 3000 v = v[:0] 3001 } 3002 slh.End() 3003 return v, true 3004 } 3005 hasLen := containerLenS > 0 3006 var xlen int 3007 if hasLen { 3008 if containerLenS > cap(v) { 3009 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) 3010 if xlen <= cap(v) { 3011 v = v[:uint(xlen)] 3012 } else { 3013 v = make([]interface{}, uint(xlen)) 3014 } 3015 changed = true 3016 } else if containerLenS != len(v) { 3017 v = v[:containerLenS] 3018 changed = true 3019 } 3020 } 3021 var j int 3022 for j = 0; d.containerNext(j, containerLenS, hasLen); j++ { 3023 if j == 0 && len(v) == 0 { // means hasLen == false 3024 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) 3025 v = make([]interface{}, uint(xlen)) 3026 changed = true 3027 } 3028 if j >= len(v) { 3029 v = append(v, nil) 3030 changed = true 3031 } 3032 slh.ElemContainerState(j) 3033 d.decode(&v[uint(j)]) 3034 } 3035 if j < len(v) { 3036 v = v[:uint(j)] 3037 changed = true 3038 } else if j == 0 && v == nil { 3039 v = []interface{}{} 3040 changed = true 3041 } 3042 slh.End() 3043 return v, changed 3044 } 3045 func (fastpathT) DecSliceIntfN(v []interface{}, d *Decoder) { 3046 slh, containerLenS := d.decSliceHelperStart() 3047 if slh.IsNil { 3048 return 3049 } 3050 if containerLenS == 0 { 3051 slh.End() 3052 return 3053 } 3054 hasLen := containerLenS > 0 3055 for j := 0; d.containerNext(j, containerLenS, hasLen); j++ { 3056 if j >= len(v) { 3057 slh.arrayCannotExpand(hasLen, len(v), j, containerLenS) 3058 return 3059 } 3060 slh.ElemContainerState(j) 3061 d.decode(&v[uint(j)]) 3062 } 3063 slh.End() 3064 } 3065 3066 func (d *Decoder) fastpathDecSliceStringR(f *codecFnInfo, rv reflect.Value) { 3067 var v []string 3068 switch rv.Kind() { 3069 case reflect.Ptr: 3070 vp := rv2i(rv).(*[]string) 3071 var changed bool 3072 if v, changed = fastpathTV.DecSliceStringY(*vp, d); changed { 3073 *vp = v 3074 } 3075 case reflect.Array: 3076 rvGetSlice4Array(rv, &v) 3077 fastpathTV.DecSliceStringN(v, d) 3078 default: 3079 fastpathTV.DecSliceStringN(rv2i(rv).([]string), d) 3080 } 3081 } 3082 func (f fastpathT) DecSliceStringX(vp *[]string, d *Decoder) { 3083 if v, changed := f.DecSliceStringY(*vp, d); changed { 3084 *vp = v 3085 } 3086 } 3087 func (fastpathT) DecSliceStringY(v []string, d *Decoder) (v2 []string, changed bool) { 3088 slh, containerLenS := d.decSliceHelperStart() 3089 if slh.IsNil { 3090 if v == nil { 3091 return 3092 } 3093 return nil, true 3094 } 3095 if containerLenS == 0 { 3096 if v == nil { 3097 v = []string{} 3098 } else if len(v) != 0 { 3099 v = v[:0] 3100 } 3101 slh.End() 3102 return v, true 3103 } 3104 hasLen := containerLenS > 0 3105 var xlen int 3106 if hasLen { 3107 if containerLenS > cap(v) { 3108 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) 3109 if xlen <= cap(v) { 3110 v = v[:uint(xlen)] 3111 } else { 3112 v = make([]string, uint(xlen)) 3113 } 3114 changed = true 3115 } else if containerLenS != len(v) { 3116 v = v[:containerLenS] 3117 changed = true 3118 } 3119 } 3120 var j int 3121 for j = 0; d.containerNext(j, containerLenS, hasLen); j++ { 3122 if j == 0 && len(v) == 0 { // means hasLen == false 3123 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) 3124 v = make([]string, uint(xlen)) 3125 changed = true 3126 } 3127 if j >= len(v) { 3128 v = append(v, "") 3129 changed = true 3130 } 3131 slh.ElemContainerState(j) 3132 v[uint(j)] = d.stringZC(d.d.DecodeStringAsBytes()) 3133 } 3134 if j < len(v) { 3135 v = v[:uint(j)] 3136 changed = true 3137 } else if j == 0 && v == nil { 3138 v = []string{} 3139 changed = true 3140 } 3141 slh.End() 3142 return v, changed 3143 } 3144 func (fastpathT) DecSliceStringN(v []string, d *Decoder) { 3145 slh, containerLenS := d.decSliceHelperStart() 3146 if slh.IsNil { 3147 return 3148 } 3149 if containerLenS == 0 { 3150 slh.End() 3151 return 3152 } 3153 hasLen := containerLenS > 0 3154 for j := 0; d.containerNext(j, containerLenS, hasLen); j++ { 3155 if j >= len(v) { 3156 slh.arrayCannotExpand(hasLen, len(v), j, containerLenS) 3157 return 3158 } 3159 slh.ElemContainerState(j) 3160 v[uint(j)] = d.stringZC(d.d.DecodeStringAsBytes()) 3161 } 3162 slh.End() 3163 } 3164 3165 func (d *Decoder) fastpathDecSliceBytesR(f *codecFnInfo, rv reflect.Value) { 3166 var v [][]byte 3167 switch rv.Kind() { 3168 case reflect.Ptr: 3169 vp := rv2i(rv).(*[][]byte) 3170 var changed bool 3171 if v, changed = fastpathTV.DecSliceBytesY(*vp, d); changed { 3172 *vp = v 3173 } 3174 case reflect.Array: 3175 rvGetSlice4Array(rv, &v) 3176 fastpathTV.DecSliceBytesN(v, d) 3177 default: 3178 fastpathTV.DecSliceBytesN(rv2i(rv).([][]byte), d) 3179 } 3180 } 3181 func (f fastpathT) DecSliceBytesX(vp *[][]byte, d *Decoder) { 3182 if v, changed := f.DecSliceBytesY(*vp, d); changed { 3183 *vp = v 3184 } 3185 } 3186 func (fastpathT) DecSliceBytesY(v [][]byte, d *Decoder) (v2 [][]byte, changed bool) { 3187 slh, containerLenS := d.decSliceHelperStart() 3188 if slh.IsNil { 3189 if v == nil { 3190 return 3191 } 3192 return nil, true 3193 } 3194 if containerLenS == 0 { 3195 if v == nil { 3196 v = [][]byte{} 3197 } else if len(v) != 0 { 3198 v = v[:0] 3199 } 3200 slh.End() 3201 return v, true 3202 } 3203 hasLen := containerLenS > 0 3204 var xlen int 3205 if hasLen { 3206 if containerLenS > cap(v) { 3207 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 24) 3208 if xlen <= cap(v) { 3209 v = v[:uint(xlen)] 3210 } else { 3211 v = make([][]byte, uint(xlen)) 3212 } 3213 changed = true 3214 } else if containerLenS != len(v) { 3215 v = v[:containerLenS] 3216 changed = true 3217 } 3218 } 3219 var j int 3220 for j = 0; d.containerNext(j, containerLenS, hasLen); j++ { 3221 if j == 0 && len(v) == 0 { // means hasLen == false 3222 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 24) 3223 v = make([][]byte, uint(xlen)) 3224 changed = true 3225 } 3226 if j >= len(v) { 3227 v = append(v, nil) 3228 changed = true 3229 } 3230 slh.ElemContainerState(j) 3231 v[uint(j)] = d.d.DecodeBytes([]byte{}) 3232 } 3233 if j < len(v) { 3234 v = v[:uint(j)] 3235 changed = true 3236 } else if j == 0 && v == nil { 3237 v = [][]byte{} 3238 changed = true 3239 } 3240 slh.End() 3241 return v, changed 3242 } 3243 func (fastpathT) DecSliceBytesN(v [][]byte, d *Decoder) { 3244 slh, containerLenS := d.decSliceHelperStart() 3245 if slh.IsNil { 3246 return 3247 } 3248 if containerLenS == 0 { 3249 slh.End() 3250 return 3251 } 3252 hasLen := containerLenS > 0 3253 for j := 0; d.containerNext(j, containerLenS, hasLen); j++ { 3254 if j >= len(v) { 3255 slh.arrayCannotExpand(hasLen, len(v), j, containerLenS) 3256 return 3257 } 3258 slh.ElemContainerState(j) 3259 v[uint(j)] = d.d.DecodeBytes([]byte{}) 3260 } 3261 slh.End() 3262 } 3263 3264 func (d *Decoder) fastpathDecSliceFloat32R(f *codecFnInfo, rv reflect.Value) { 3265 var v []float32 3266 switch rv.Kind() { 3267 case reflect.Ptr: 3268 vp := rv2i(rv).(*[]float32) 3269 var changed bool 3270 if v, changed = fastpathTV.DecSliceFloat32Y(*vp, d); changed { 3271 *vp = v 3272 } 3273 case reflect.Array: 3274 rvGetSlice4Array(rv, &v) 3275 fastpathTV.DecSliceFloat32N(v, d) 3276 default: 3277 fastpathTV.DecSliceFloat32N(rv2i(rv).([]float32), d) 3278 } 3279 } 3280 func (f fastpathT) DecSliceFloat32X(vp *[]float32, d *Decoder) { 3281 if v, changed := f.DecSliceFloat32Y(*vp, d); changed { 3282 *vp = v 3283 } 3284 } 3285 func (fastpathT) DecSliceFloat32Y(v []float32, d *Decoder) (v2 []float32, changed bool) { 3286 slh, containerLenS := d.decSliceHelperStart() 3287 if slh.IsNil { 3288 if v == nil { 3289 return 3290 } 3291 return nil, true 3292 } 3293 if containerLenS == 0 { 3294 if v == nil { 3295 v = []float32{} 3296 } else if len(v) != 0 { 3297 v = v[:0] 3298 } 3299 slh.End() 3300 return v, true 3301 } 3302 hasLen := containerLenS > 0 3303 var xlen int 3304 if hasLen { 3305 if containerLenS > cap(v) { 3306 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) 3307 if xlen <= cap(v) { 3308 v = v[:uint(xlen)] 3309 } else { 3310 v = make([]float32, uint(xlen)) 3311 } 3312 changed = true 3313 } else if containerLenS != len(v) { 3314 v = v[:containerLenS] 3315 changed = true 3316 } 3317 } 3318 var j int 3319 for j = 0; d.containerNext(j, containerLenS, hasLen); j++ { 3320 if j == 0 && len(v) == 0 { // means hasLen == false 3321 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) 3322 v = make([]float32, uint(xlen)) 3323 changed = true 3324 } 3325 if j >= len(v) { 3326 v = append(v, 0) 3327 changed = true 3328 } 3329 slh.ElemContainerState(j) 3330 v[uint(j)] = float32(d.decodeFloat32()) 3331 } 3332 if j < len(v) { 3333 v = v[:uint(j)] 3334 changed = true 3335 } else if j == 0 && v == nil { 3336 v = []float32{} 3337 changed = true 3338 } 3339 slh.End() 3340 return v, changed 3341 } 3342 func (fastpathT) DecSliceFloat32N(v []float32, d *Decoder) { 3343 slh, containerLenS := d.decSliceHelperStart() 3344 if slh.IsNil { 3345 return 3346 } 3347 if containerLenS == 0 { 3348 slh.End() 3349 return 3350 } 3351 hasLen := containerLenS > 0 3352 for j := 0; d.containerNext(j, containerLenS, hasLen); j++ { 3353 if j >= len(v) { 3354 slh.arrayCannotExpand(hasLen, len(v), j, containerLenS) 3355 return 3356 } 3357 slh.ElemContainerState(j) 3358 v[uint(j)] = float32(d.decodeFloat32()) 3359 } 3360 slh.End() 3361 } 3362 3363 func (d *Decoder) fastpathDecSliceFloat64R(f *codecFnInfo, rv reflect.Value) { 3364 var v []float64 3365 switch rv.Kind() { 3366 case reflect.Ptr: 3367 vp := rv2i(rv).(*[]float64) 3368 var changed bool 3369 if v, changed = fastpathTV.DecSliceFloat64Y(*vp, d); changed { 3370 *vp = v 3371 } 3372 case reflect.Array: 3373 rvGetSlice4Array(rv, &v) 3374 fastpathTV.DecSliceFloat64N(v, d) 3375 default: 3376 fastpathTV.DecSliceFloat64N(rv2i(rv).([]float64), d) 3377 } 3378 } 3379 func (f fastpathT) DecSliceFloat64X(vp *[]float64, d *Decoder) { 3380 if v, changed := f.DecSliceFloat64Y(*vp, d); changed { 3381 *vp = v 3382 } 3383 } 3384 func (fastpathT) DecSliceFloat64Y(v []float64, d *Decoder) (v2 []float64, changed bool) { 3385 slh, containerLenS := d.decSliceHelperStart() 3386 if slh.IsNil { 3387 if v == nil { 3388 return 3389 } 3390 return nil, true 3391 } 3392 if containerLenS == 0 { 3393 if v == nil { 3394 v = []float64{} 3395 } else if len(v) != 0 { 3396 v = v[:0] 3397 } 3398 slh.End() 3399 return v, true 3400 } 3401 hasLen := containerLenS > 0 3402 var xlen int 3403 if hasLen { 3404 if containerLenS > cap(v) { 3405 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) 3406 if xlen <= cap(v) { 3407 v = v[:uint(xlen)] 3408 } else { 3409 v = make([]float64, uint(xlen)) 3410 } 3411 changed = true 3412 } else if containerLenS != len(v) { 3413 v = v[:containerLenS] 3414 changed = true 3415 } 3416 } 3417 var j int 3418 for j = 0; d.containerNext(j, containerLenS, hasLen); j++ { 3419 if j == 0 && len(v) == 0 { // means hasLen == false 3420 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) 3421 v = make([]float64, uint(xlen)) 3422 changed = true 3423 } 3424 if j >= len(v) { 3425 v = append(v, 0) 3426 changed = true 3427 } 3428 slh.ElemContainerState(j) 3429 v[uint(j)] = d.d.DecodeFloat64() 3430 } 3431 if j < len(v) { 3432 v = v[:uint(j)] 3433 changed = true 3434 } else if j == 0 && v == nil { 3435 v = []float64{} 3436 changed = true 3437 } 3438 slh.End() 3439 return v, changed 3440 } 3441 func (fastpathT) DecSliceFloat64N(v []float64, d *Decoder) { 3442 slh, containerLenS := d.decSliceHelperStart() 3443 if slh.IsNil { 3444 return 3445 } 3446 if containerLenS == 0 { 3447 slh.End() 3448 return 3449 } 3450 hasLen := containerLenS > 0 3451 for j := 0; d.containerNext(j, containerLenS, hasLen); j++ { 3452 if j >= len(v) { 3453 slh.arrayCannotExpand(hasLen, len(v), j, containerLenS) 3454 return 3455 } 3456 slh.ElemContainerState(j) 3457 v[uint(j)] = d.d.DecodeFloat64() 3458 } 3459 slh.End() 3460 } 3461 3462 func (d *Decoder) fastpathDecSliceUint8R(f *codecFnInfo, rv reflect.Value) { 3463 var v []uint8 3464 switch rv.Kind() { 3465 case reflect.Ptr: 3466 vp := rv2i(rv).(*[]uint8) 3467 var changed bool 3468 if v, changed = fastpathTV.DecSliceUint8Y(*vp, d); changed { 3469 *vp = v 3470 } 3471 case reflect.Array: 3472 rvGetSlice4Array(rv, &v) 3473 fastpathTV.DecSliceUint8N(v, d) 3474 default: 3475 fastpathTV.DecSliceUint8N(rv2i(rv).([]uint8), d) 3476 } 3477 } 3478 func (f fastpathT) DecSliceUint8X(vp *[]uint8, d *Decoder) { 3479 if v, changed := f.DecSliceUint8Y(*vp, d); changed { 3480 *vp = v 3481 } 3482 } 3483 func (fastpathT) DecSliceUint8Y(v []uint8, d *Decoder) (v2 []uint8, changed bool) { 3484 switch d.d.ContainerType() { 3485 case valueTypeNil, valueTypeMap: 3486 break 3487 default: 3488 v2 = d.decodeBytesInto(v[:len(v):len(v)]) 3489 changed = !(len(v2) > 0 && len(v2) == len(v) && &v2[0] == &v[0]) // not same slice 3490 return 3491 } 3492 slh, containerLenS := d.decSliceHelperStart() 3493 if slh.IsNil { 3494 if v == nil { 3495 return 3496 } 3497 return nil, true 3498 } 3499 if containerLenS == 0 { 3500 if v == nil { 3501 v = []uint8{} 3502 } else if len(v) != 0 { 3503 v = v[:0] 3504 } 3505 slh.End() 3506 return v, true 3507 } 3508 hasLen := containerLenS > 0 3509 var xlen int 3510 if hasLen { 3511 if containerLenS > cap(v) { 3512 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) 3513 if xlen <= cap(v) { 3514 v = v[:uint(xlen)] 3515 } else { 3516 v = make([]uint8, uint(xlen)) 3517 } 3518 changed = true 3519 } else if containerLenS != len(v) { 3520 v = v[:containerLenS] 3521 changed = true 3522 } 3523 } 3524 var j int 3525 for j = 0; d.containerNext(j, containerLenS, hasLen); j++ { 3526 if j == 0 && len(v) == 0 { // means hasLen == false 3527 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) 3528 v = make([]uint8, uint(xlen)) 3529 changed = true 3530 } 3531 if j >= len(v) { 3532 v = append(v, 0) 3533 changed = true 3534 } 3535 slh.ElemContainerState(j) 3536 v[uint(j)] = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 3537 } 3538 if j < len(v) { 3539 v = v[:uint(j)] 3540 changed = true 3541 } else if j == 0 && v == nil { 3542 v = []uint8{} 3543 changed = true 3544 } 3545 slh.End() 3546 return v, changed 3547 } 3548 func (fastpathT) DecSliceUint8N(v []uint8, d *Decoder) { 3549 switch d.d.ContainerType() { 3550 case valueTypeNil, valueTypeMap: 3551 break 3552 default: 3553 v2 := d.decodeBytesInto(v[:len(v):len(v)]) 3554 if !(len(v2) > 0 && len(v2) == len(v) && &v2[0] == &v[0]) { // not same slice 3555 copy(v, v2) 3556 } 3557 return 3558 } 3559 slh, containerLenS := d.decSliceHelperStart() 3560 if slh.IsNil { 3561 return 3562 } 3563 if containerLenS == 0 { 3564 slh.End() 3565 return 3566 } 3567 hasLen := containerLenS > 0 3568 for j := 0; d.containerNext(j, containerLenS, hasLen); j++ { 3569 if j >= len(v) { 3570 slh.arrayCannotExpand(hasLen, len(v), j, containerLenS) 3571 return 3572 } 3573 slh.ElemContainerState(j) 3574 v[uint(j)] = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 3575 } 3576 slh.End() 3577 } 3578 3579 func (d *Decoder) fastpathDecSliceUint64R(f *codecFnInfo, rv reflect.Value) { 3580 var v []uint64 3581 switch rv.Kind() { 3582 case reflect.Ptr: 3583 vp := rv2i(rv).(*[]uint64) 3584 var changed bool 3585 if v, changed = fastpathTV.DecSliceUint64Y(*vp, d); changed { 3586 *vp = v 3587 } 3588 case reflect.Array: 3589 rvGetSlice4Array(rv, &v) 3590 fastpathTV.DecSliceUint64N(v, d) 3591 default: 3592 fastpathTV.DecSliceUint64N(rv2i(rv).([]uint64), d) 3593 } 3594 } 3595 func (f fastpathT) DecSliceUint64X(vp *[]uint64, d *Decoder) { 3596 if v, changed := f.DecSliceUint64Y(*vp, d); changed { 3597 *vp = v 3598 } 3599 } 3600 func (fastpathT) DecSliceUint64Y(v []uint64, d *Decoder) (v2 []uint64, changed bool) { 3601 slh, containerLenS := d.decSliceHelperStart() 3602 if slh.IsNil { 3603 if v == nil { 3604 return 3605 } 3606 return nil, true 3607 } 3608 if containerLenS == 0 { 3609 if v == nil { 3610 v = []uint64{} 3611 } else if len(v) != 0 { 3612 v = v[:0] 3613 } 3614 slh.End() 3615 return v, true 3616 } 3617 hasLen := containerLenS > 0 3618 var xlen int 3619 if hasLen { 3620 if containerLenS > cap(v) { 3621 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) 3622 if xlen <= cap(v) { 3623 v = v[:uint(xlen)] 3624 } else { 3625 v = make([]uint64, uint(xlen)) 3626 } 3627 changed = true 3628 } else if containerLenS != len(v) { 3629 v = v[:containerLenS] 3630 changed = true 3631 } 3632 } 3633 var j int 3634 for j = 0; d.containerNext(j, containerLenS, hasLen); j++ { 3635 if j == 0 && len(v) == 0 { // means hasLen == false 3636 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) 3637 v = make([]uint64, uint(xlen)) 3638 changed = true 3639 } 3640 if j >= len(v) { 3641 v = append(v, 0) 3642 changed = true 3643 } 3644 slh.ElemContainerState(j) 3645 v[uint(j)] = d.d.DecodeUint64() 3646 } 3647 if j < len(v) { 3648 v = v[:uint(j)] 3649 changed = true 3650 } else if j == 0 && v == nil { 3651 v = []uint64{} 3652 changed = true 3653 } 3654 slh.End() 3655 return v, changed 3656 } 3657 func (fastpathT) DecSliceUint64N(v []uint64, d *Decoder) { 3658 slh, containerLenS := d.decSliceHelperStart() 3659 if slh.IsNil { 3660 return 3661 } 3662 if containerLenS == 0 { 3663 slh.End() 3664 return 3665 } 3666 hasLen := containerLenS > 0 3667 for j := 0; d.containerNext(j, containerLenS, hasLen); j++ { 3668 if j >= len(v) { 3669 slh.arrayCannotExpand(hasLen, len(v), j, containerLenS) 3670 return 3671 } 3672 slh.ElemContainerState(j) 3673 v[uint(j)] = d.d.DecodeUint64() 3674 } 3675 slh.End() 3676 } 3677 3678 func (d *Decoder) fastpathDecSliceIntR(f *codecFnInfo, rv reflect.Value) { 3679 var v []int 3680 switch rv.Kind() { 3681 case reflect.Ptr: 3682 vp := rv2i(rv).(*[]int) 3683 var changed bool 3684 if v, changed = fastpathTV.DecSliceIntY(*vp, d); changed { 3685 *vp = v 3686 } 3687 case reflect.Array: 3688 rvGetSlice4Array(rv, &v) 3689 fastpathTV.DecSliceIntN(v, d) 3690 default: 3691 fastpathTV.DecSliceIntN(rv2i(rv).([]int), d) 3692 } 3693 } 3694 func (f fastpathT) DecSliceIntX(vp *[]int, d *Decoder) { 3695 if v, changed := f.DecSliceIntY(*vp, d); changed { 3696 *vp = v 3697 } 3698 } 3699 func (fastpathT) DecSliceIntY(v []int, d *Decoder) (v2 []int, changed bool) { 3700 slh, containerLenS := d.decSliceHelperStart() 3701 if slh.IsNil { 3702 if v == nil { 3703 return 3704 } 3705 return nil, true 3706 } 3707 if containerLenS == 0 { 3708 if v == nil { 3709 v = []int{} 3710 } else if len(v) != 0 { 3711 v = v[:0] 3712 } 3713 slh.End() 3714 return v, true 3715 } 3716 hasLen := containerLenS > 0 3717 var xlen int 3718 if hasLen { 3719 if containerLenS > cap(v) { 3720 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) 3721 if xlen <= cap(v) { 3722 v = v[:uint(xlen)] 3723 } else { 3724 v = make([]int, uint(xlen)) 3725 } 3726 changed = true 3727 } else if containerLenS != len(v) { 3728 v = v[:containerLenS] 3729 changed = true 3730 } 3731 } 3732 var j int 3733 for j = 0; d.containerNext(j, containerLenS, hasLen); j++ { 3734 if j == 0 && len(v) == 0 { // means hasLen == false 3735 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) 3736 v = make([]int, uint(xlen)) 3737 changed = true 3738 } 3739 if j >= len(v) { 3740 v = append(v, 0) 3741 changed = true 3742 } 3743 slh.ElemContainerState(j) 3744 v[uint(j)] = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 3745 } 3746 if j < len(v) { 3747 v = v[:uint(j)] 3748 changed = true 3749 } else if j == 0 && v == nil { 3750 v = []int{} 3751 changed = true 3752 } 3753 slh.End() 3754 return v, changed 3755 } 3756 func (fastpathT) DecSliceIntN(v []int, d *Decoder) { 3757 slh, containerLenS := d.decSliceHelperStart() 3758 if slh.IsNil { 3759 return 3760 } 3761 if containerLenS == 0 { 3762 slh.End() 3763 return 3764 } 3765 hasLen := containerLenS > 0 3766 for j := 0; d.containerNext(j, containerLenS, hasLen); j++ { 3767 if j >= len(v) { 3768 slh.arrayCannotExpand(hasLen, len(v), j, containerLenS) 3769 return 3770 } 3771 slh.ElemContainerState(j) 3772 v[uint(j)] = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 3773 } 3774 slh.End() 3775 } 3776 3777 func (d *Decoder) fastpathDecSliceInt32R(f *codecFnInfo, rv reflect.Value) { 3778 var v []int32 3779 switch rv.Kind() { 3780 case reflect.Ptr: 3781 vp := rv2i(rv).(*[]int32) 3782 var changed bool 3783 if v, changed = fastpathTV.DecSliceInt32Y(*vp, d); changed { 3784 *vp = v 3785 } 3786 case reflect.Array: 3787 rvGetSlice4Array(rv, &v) 3788 fastpathTV.DecSliceInt32N(v, d) 3789 default: 3790 fastpathTV.DecSliceInt32N(rv2i(rv).([]int32), d) 3791 } 3792 } 3793 func (f fastpathT) DecSliceInt32X(vp *[]int32, d *Decoder) { 3794 if v, changed := f.DecSliceInt32Y(*vp, d); changed { 3795 *vp = v 3796 } 3797 } 3798 func (fastpathT) DecSliceInt32Y(v []int32, d *Decoder) (v2 []int32, changed bool) { 3799 slh, containerLenS := d.decSliceHelperStart() 3800 if slh.IsNil { 3801 if v == nil { 3802 return 3803 } 3804 return nil, true 3805 } 3806 if containerLenS == 0 { 3807 if v == nil { 3808 v = []int32{} 3809 } else if len(v) != 0 { 3810 v = v[:0] 3811 } 3812 slh.End() 3813 return v, true 3814 } 3815 hasLen := containerLenS > 0 3816 var xlen int 3817 if hasLen { 3818 if containerLenS > cap(v) { 3819 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) 3820 if xlen <= cap(v) { 3821 v = v[:uint(xlen)] 3822 } else { 3823 v = make([]int32, uint(xlen)) 3824 } 3825 changed = true 3826 } else if containerLenS != len(v) { 3827 v = v[:containerLenS] 3828 changed = true 3829 } 3830 } 3831 var j int 3832 for j = 0; d.containerNext(j, containerLenS, hasLen); j++ { 3833 if j == 0 && len(v) == 0 { // means hasLen == false 3834 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) 3835 v = make([]int32, uint(xlen)) 3836 changed = true 3837 } 3838 if j >= len(v) { 3839 v = append(v, 0) 3840 changed = true 3841 } 3842 slh.ElemContainerState(j) 3843 v[uint(j)] = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 3844 } 3845 if j < len(v) { 3846 v = v[:uint(j)] 3847 changed = true 3848 } else if j == 0 && v == nil { 3849 v = []int32{} 3850 changed = true 3851 } 3852 slh.End() 3853 return v, changed 3854 } 3855 func (fastpathT) DecSliceInt32N(v []int32, d *Decoder) { 3856 slh, containerLenS := d.decSliceHelperStart() 3857 if slh.IsNil { 3858 return 3859 } 3860 if containerLenS == 0 { 3861 slh.End() 3862 return 3863 } 3864 hasLen := containerLenS > 0 3865 for j := 0; d.containerNext(j, containerLenS, hasLen); j++ { 3866 if j >= len(v) { 3867 slh.arrayCannotExpand(hasLen, len(v), j, containerLenS) 3868 return 3869 } 3870 slh.ElemContainerState(j) 3871 v[uint(j)] = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 3872 } 3873 slh.End() 3874 } 3875 3876 func (d *Decoder) fastpathDecSliceInt64R(f *codecFnInfo, rv reflect.Value) { 3877 var v []int64 3878 switch rv.Kind() { 3879 case reflect.Ptr: 3880 vp := rv2i(rv).(*[]int64) 3881 var changed bool 3882 if v, changed = fastpathTV.DecSliceInt64Y(*vp, d); changed { 3883 *vp = v 3884 } 3885 case reflect.Array: 3886 rvGetSlice4Array(rv, &v) 3887 fastpathTV.DecSliceInt64N(v, d) 3888 default: 3889 fastpathTV.DecSliceInt64N(rv2i(rv).([]int64), d) 3890 } 3891 } 3892 func (f fastpathT) DecSliceInt64X(vp *[]int64, d *Decoder) { 3893 if v, changed := f.DecSliceInt64Y(*vp, d); changed { 3894 *vp = v 3895 } 3896 } 3897 func (fastpathT) DecSliceInt64Y(v []int64, d *Decoder) (v2 []int64, changed bool) { 3898 slh, containerLenS := d.decSliceHelperStart() 3899 if slh.IsNil { 3900 if v == nil { 3901 return 3902 } 3903 return nil, true 3904 } 3905 if containerLenS == 0 { 3906 if v == nil { 3907 v = []int64{} 3908 } else if len(v) != 0 { 3909 v = v[:0] 3910 } 3911 slh.End() 3912 return v, true 3913 } 3914 hasLen := containerLenS > 0 3915 var xlen int 3916 if hasLen { 3917 if containerLenS > cap(v) { 3918 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) 3919 if xlen <= cap(v) { 3920 v = v[:uint(xlen)] 3921 } else { 3922 v = make([]int64, uint(xlen)) 3923 } 3924 changed = true 3925 } else if containerLenS != len(v) { 3926 v = v[:containerLenS] 3927 changed = true 3928 } 3929 } 3930 var j int 3931 for j = 0; d.containerNext(j, containerLenS, hasLen); j++ { 3932 if j == 0 && len(v) == 0 { // means hasLen == false 3933 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) 3934 v = make([]int64, uint(xlen)) 3935 changed = true 3936 } 3937 if j >= len(v) { 3938 v = append(v, 0) 3939 changed = true 3940 } 3941 slh.ElemContainerState(j) 3942 v[uint(j)] = d.d.DecodeInt64() 3943 } 3944 if j < len(v) { 3945 v = v[:uint(j)] 3946 changed = true 3947 } else if j == 0 && v == nil { 3948 v = []int64{} 3949 changed = true 3950 } 3951 slh.End() 3952 return v, changed 3953 } 3954 func (fastpathT) DecSliceInt64N(v []int64, d *Decoder) { 3955 slh, containerLenS := d.decSliceHelperStart() 3956 if slh.IsNil { 3957 return 3958 } 3959 if containerLenS == 0 { 3960 slh.End() 3961 return 3962 } 3963 hasLen := containerLenS > 0 3964 for j := 0; d.containerNext(j, containerLenS, hasLen); j++ { 3965 if j >= len(v) { 3966 slh.arrayCannotExpand(hasLen, len(v), j, containerLenS) 3967 return 3968 } 3969 slh.ElemContainerState(j) 3970 v[uint(j)] = d.d.DecodeInt64() 3971 } 3972 slh.End() 3973 } 3974 3975 func (d *Decoder) fastpathDecSliceBoolR(f *codecFnInfo, rv reflect.Value) { 3976 var v []bool 3977 switch rv.Kind() { 3978 case reflect.Ptr: 3979 vp := rv2i(rv).(*[]bool) 3980 var changed bool 3981 if v, changed = fastpathTV.DecSliceBoolY(*vp, d); changed { 3982 *vp = v 3983 } 3984 case reflect.Array: 3985 rvGetSlice4Array(rv, &v) 3986 fastpathTV.DecSliceBoolN(v, d) 3987 default: 3988 fastpathTV.DecSliceBoolN(rv2i(rv).([]bool), d) 3989 } 3990 } 3991 func (f fastpathT) DecSliceBoolX(vp *[]bool, d *Decoder) { 3992 if v, changed := f.DecSliceBoolY(*vp, d); changed { 3993 *vp = v 3994 } 3995 } 3996 func (fastpathT) DecSliceBoolY(v []bool, d *Decoder) (v2 []bool, changed bool) { 3997 slh, containerLenS := d.decSliceHelperStart() 3998 if slh.IsNil { 3999 if v == nil { 4000 return 4001 } 4002 return nil, true 4003 } 4004 if containerLenS == 0 { 4005 if v == nil { 4006 v = []bool{} 4007 } else if len(v) != 0 { 4008 v = v[:0] 4009 } 4010 slh.End() 4011 return v, true 4012 } 4013 hasLen := containerLenS > 0 4014 var xlen int 4015 if hasLen { 4016 if containerLenS > cap(v) { 4017 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) 4018 if xlen <= cap(v) { 4019 v = v[:uint(xlen)] 4020 } else { 4021 v = make([]bool, uint(xlen)) 4022 } 4023 changed = true 4024 } else if containerLenS != len(v) { 4025 v = v[:containerLenS] 4026 changed = true 4027 } 4028 } 4029 var j int 4030 for j = 0; d.containerNext(j, containerLenS, hasLen); j++ { 4031 if j == 0 && len(v) == 0 { // means hasLen == false 4032 xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) 4033 v = make([]bool, uint(xlen)) 4034 changed = true 4035 } 4036 if j >= len(v) { 4037 v = append(v, false) 4038 changed = true 4039 } 4040 slh.ElemContainerState(j) 4041 v[uint(j)] = d.d.DecodeBool() 4042 } 4043 if j < len(v) { 4044 v = v[:uint(j)] 4045 changed = true 4046 } else if j == 0 && v == nil { 4047 v = []bool{} 4048 changed = true 4049 } 4050 slh.End() 4051 return v, changed 4052 } 4053 func (fastpathT) DecSliceBoolN(v []bool, d *Decoder) { 4054 slh, containerLenS := d.decSliceHelperStart() 4055 if slh.IsNil { 4056 return 4057 } 4058 if containerLenS == 0 { 4059 slh.End() 4060 return 4061 } 4062 hasLen := containerLenS > 0 4063 for j := 0; d.containerNext(j, containerLenS, hasLen); j++ { 4064 if j >= len(v) { 4065 slh.arrayCannotExpand(hasLen, len(v), j, containerLenS) 4066 return 4067 } 4068 slh.ElemContainerState(j) 4069 v[uint(j)] = d.d.DecodeBool() 4070 } 4071 slh.End() 4072 } 4073 func (d *Decoder) fastpathDecMapStringIntfR(f *codecFnInfo, rv reflect.Value) { 4074 containerLen := d.mapStart(d.d.ReadMapStart()) 4075 if rv.Kind() == reflect.Ptr { 4076 vp, _ := rv2i(rv).(*map[string]interface{}) 4077 if *vp == nil { 4078 *vp = make(map[string]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 32)) 4079 } 4080 if containerLen != 0 { 4081 fastpathTV.DecMapStringIntfL(*vp, containerLen, d) 4082 } 4083 } else if containerLen != 0 { 4084 fastpathTV.DecMapStringIntfL(rv2i(rv).(map[string]interface{}), containerLen, d) 4085 } 4086 d.mapEnd() 4087 } 4088 func (f fastpathT) DecMapStringIntfX(vp *map[string]interface{}, d *Decoder) { 4089 containerLen := d.mapStart(d.d.ReadMapStart()) 4090 if containerLen == containerLenNil { 4091 *vp = nil 4092 } else { 4093 if *vp == nil { 4094 *vp = make(map[string]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 32)) 4095 } 4096 if containerLen != 0 { 4097 f.DecMapStringIntfL(*vp, containerLen, d) 4098 } 4099 d.mapEnd() 4100 } 4101 } 4102 func (fastpathT) DecMapStringIntfL(v map[string]interface{}, containerLen int, d *Decoder) { 4103 if v == nil { 4104 d.errorf("cannot decode into nil map[string]interface{} given stream length: %v", containerLen) 4105 return 4106 } 4107 mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset 4108 var mk string 4109 var mv interface{} 4110 hasLen := containerLen > 0 4111 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4112 d.mapElemKey() 4113 mk = d.stringZC(d.d.DecodeStringAsBytes()) 4114 d.mapElemValue() 4115 if mapGet { 4116 mv = v[mk] 4117 } else { 4118 mv = nil 4119 } 4120 d.decode(&mv) 4121 v[mk] = mv 4122 } 4123 } 4124 func (d *Decoder) fastpathDecMapStringStringR(f *codecFnInfo, rv reflect.Value) { 4125 containerLen := d.mapStart(d.d.ReadMapStart()) 4126 if rv.Kind() == reflect.Ptr { 4127 vp, _ := rv2i(rv).(*map[string]string) 4128 if *vp == nil { 4129 *vp = make(map[string]string, decInferLen(containerLen, d.h.MaxInitLen, 32)) 4130 } 4131 if containerLen != 0 { 4132 fastpathTV.DecMapStringStringL(*vp, containerLen, d) 4133 } 4134 } else if containerLen != 0 { 4135 fastpathTV.DecMapStringStringL(rv2i(rv).(map[string]string), containerLen, d) 4136 } 4137 d.mapEnd() 4138 } 4139 func (f fastpathT) DecMapStringStringX(vp *map[string]string, d *Decoder) { 4140 containerLen := d.mapStart(d.d.ReadMapStart()) 4141 if containerLen == containerLenNil { 4142 *vp = nil 4143 } else { 4144 if *vp == nil { 4145 *vp = make(map[string]string, decInferLen(containerLen, d.h.MaxInitLen, 32)) 4146 } 4147 if containerLen != 0 { 4148 f.DecMapStringStringL(*vp, containerLen, d) 4149 } 4150 d.mapEnd() 4151 } 4152 } 4153 func (fastpathT) DecMapStringStringL(v map[string]string, containerLen int, d *Decoder) { 4154 if v == nil { 4155 d.errorf("cannot decode into nil map[string]string given stream length: %v", containerLen) 4156 return 4157 } 4158 var mk string 4159 var mv string 4160 hasLen := containerLen > 0 4161 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4162 d.mapElemKey() 4163 mk = d.stringZC(d.d.DecodeStringAsBytes()) 4164 d.mapElemValue() 4165 mv = d.stringZC(d.d.DecodeStringAsBytes()) 4166 v[mk] = mv 4167 } 4168 } 4169 func (d *Decoder) fastpathDecMapStringBytesR(f *codecFnInfo, rv reflect.Value) { 4170 containerLen := d.mapStart(d.d.ReadMapStart()) 4171 if rv.Kind() == reflect.Ptr { 4172 vp, _ := rv2i(rv).(*map[string][]byte) 4173 if *vp == nil { 4174 *vp = make(map[string][]byte, decInferLen(containerLen, d.h.MaxInitLen, 40)) 4175 } 4176 if containerLen != 0 { 4177 fastpathTV.DecMapStringBytesL(*vp, containerLen, d) 4178 } 4179 } else if containerLen != 0 { 4180 fastpathTV.DecMapStringBytesL(rv2i(rv).(map[string][]byte), containerLen, d) 4181 } 4182 d.mapEnd() 4183 } 4184 func (f fastpathT) DecMapStringBytesX(vp *map[string][]byte, d *Decoder) { 4185 containerLen := d.mapStart(d.d.ReadMapStart()) 4186 if containerLen == containerLenNil { 4187 *vp = nil 4188 } else { 4189 if *vp == nil { 4190 *vp = make(map[string][]byte, decInferLen(containerLen, d.h.MaxInitLen, 40)) 4191 } 4192 if containerLen != 0 { 4193 f.DecMapStringBytesL(*vp, containerLen, d) 4194 } 4195 d.mapEnd() 4196 } 4197 } 4198 func (fastpathT) DecMapStringBytesL(v map[string][]byte, containerLen int, d *Decoder) { 4199 if v == nil { 4200 d.errorf("cannot decode into nil map[string][]byte given stream length: %v", containerLen) 4201 return 4202 } 4203 mapGet := v != nil && !d.h.MapValueReset 4204 var mk string 4205 var mv []byte 4206 hasLen := containerLen > 0 4207 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4208 d.mapElemKey() 4209 mk = d.stringZC(d.d.DecodeStringAsBytes()) 4210 d.mapElemValue() 4211 if mapGet { 4212 mv = v[mk] 4213 } else { 4214 mv = nil 4215 } 4216 mv = d.decodeBytesInto(mv) 4217 v[mk] = mv 4218 } 4219 } 4220 func (d *Decoder) fastpathDecMapStringUint8R(f *codecFnInfo, rv reflect.Value) { 4221 containerLen := d.mapStart(d.d.ReadMapStart()) 4222 if rv.Kind() == reflect.Ptr { 4223 vp, _ := rv2i(rv).(*map[string]uint8) 4224 if *vp == nil { 4225 *vp = make(map[string]uint8, decInferLen(containerLen, d.h.MaxInitLen, 17)) 4226 } 4227 if containerLen != 0 { 4228 fastpathTV.DecMapStringUint8L(*vp, containerLen, d) 4229 } 4230 } else if containerLen != 0 { 4231 fastpathTV.DecMapStringUint8L(rv2i(rv).(map[string]uint8), containerLen, d) 4232 } 4233 d.mapEnd() 4234 } 4235 func (f fastpathT) DecMapStringUint8X(vp *map[string]uint8, d *Decoder) { 4236 containerLen := d.mapStart(d.d.ReadMapStart()) 4237 if containerLen == containerLenNil { 4238 *vp = nil 4239 } else { 4240 if *vp == nil { 4241 *vp = make(map[string]uint8, decInferLen(containerLen, d.h.MaxInitLen, 17)) 4242 } 4243 if containerLen != 0 { 4244 f.DecMapStringUint8L(*vp, containerLen, d) 4245 } 4246 d.mapEnd() 4247 } 4248 } 4249 func (fastpathT) DecMapStringUint8L(v map[string]uint8, containerLen int, d *Decoder) { 4250 if v == nil { 4251 d.errorf("cannot decode into nil map[string]uint8 given stream length: %v", containerLen) 4252 return 4253 } 4254 var mk string 4255 var mv uint8 4256 hasLen := containerLen > 0 4257 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4258 d.mapElemKey() 4259 mk = d.stringZC(d.d.DecodeStringAsBytes()) 4260 d.mapElemValue() 4261 mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 4262 v[mk] = mv 4263 } 4264 } 4265 func (d *Decoder) fastpathDecMapStringUint64R(f *codecFnInfo, rv reflect.Value) { 4266 containerLen := d.mapStart(d.d.ReadMapStart()) 4267 if rv.Kind() == reflect.Ptr { 4268 vp, _ := rv2i(rv).(*map[string]uint64) 4269 if *vp == nil { 4270 *vp = make(map[string]uint64, decInferLen(containerLen, d.h.MaxInitLen, 24)) 4271 } 4272 if containerLen != 0 { 4273 fastpathTV.DecMapStringUint64L(*vp, containerLen, d) 4274 } 4275 } else if containerLen != 0 { 4276 fastpathTV.DecMapStringUint64L(rv2i(rv).(map[string]uint64), containerLen, d) 4277 } 4278 d.mapEnd() 4279 } 4280 func (f fastpathT) DecMapStringUint64X(vp *map[string]uint64, d *Decoder) { 4281 containerLen := d.mapStart(d.d.ReadMapStart()) 4282 if containerLen == containerLenNil { 4283 *vp = nil 4284 } else { 4285 if *vp == nil { 4286 *vp = make(map[string]uint64, decInferLen(containerLen, d.h.MaxInitLen, 24)) 4287 } 4288 if containerLen != 0 { 4289 f.DecMapStringUint64L(*vp, containerLen, d) 4290 } 4291 d.mapEnd() 4292 } 4293 } 4294 func (fastpathT) DecMapStringUint64L(v map[string]uint64, containerLen int, d *Decoder) { 4295 if v == nil { 4296 d.errorf("cannot decode into nil map[string]uint64 given stream length: %v", containerLen) 4297 return 4298 } 4299 var mk string 4300 var mv uint64 4301 hasLen := containerLen > 0 4302 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4303 d.mapElemKey() 4304 mk = d.stringZC(d.d.DecodeStringAsBytes()) 4305 d.mapElemValue() 4306 mv = d.d.DecodeUint64() 4307 v[mk] = mv 4308 } 4309 } 4310 func (d *Decoder) fastpathDecMapStringIntR(f *codecFnInfo, rv reflect.Value) { 4311 containerLen := d.mapStart(d.d.ReadMapStart()) 4312 if rv.Kind() == reflect.Ptr { 4313 vp, _ := rv2i(rv).(*map[string]int) 4314 if *vp == nil { 4315 *vp = make(map[string]int, decInferLen(containerLen, d.h.MaxInitLen, 24)) 4316 } 4317 if containerLen != 0 { 4318 fastpathTV.DecMapStringIntL(*vp, containerLen, d) 4319 } 4320 } else if containerLen != 0 { 4321 fastpathTV.DecMapStringIntL(rv2i(rv).(map[string]int), containerLen, d) 4322 } 4323 d.mapEnd() 4324 } 4325 func (f fastpathT) DecMapStringIntX(vp *map[string]int, d *Decoder) { 4326 containerLen := d.mapStart(d.d.ReadMapStart()) 4327 if containerLen == containerLenNil { 4328 *vp = nil 4329 } else { 4330 if *vp == nil { 4331 *vp = make(map[string]int, decInferLen(containerLen, d.h.MaxInitLen, 24)) 4332 } 4333 if containerLen != 0 { 4334 f.DecMapStringIntL(*vp, containerLen, d) 4335 } 4336 d.mapEnd() 4337 } 4338 } 4339 func (fastpathT) DecMapStringIntL(v map[string]int, containerLen int, d *Decoder) { 4340 if v == nil { 4341 d.errorf("cannot decode into nil map[string]int given stream length: %v", containerLen) 4342 return 4343 } 4344 var mk string 4345 var mv int 4346 hasLen := containerLen > 0 4347 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4348 d.mapElemKey() 4349 mk = d.stringZC(d.d.DecodeStringAsBytes()) 4350 d.mapElemValue() 4351 mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 4352 v[mk] = mv 4353 } 4354 } 4355 func (d *Decoder) fastpathDecMapStringInt32R(f *codecFnInfo, rv reflect.Value) { 4356 containerLen := d.mapStart(d.d.ReadMapStart()) 4357 if rv.Kind() == reflect.Ptr { 4358 vp, _ := rv2i(rv).(*map[string]int32) 4359 if *vp == nil { 4360 *vp = make(map[string]int32, decInferLen(containerLen, d.h.MaxInitLen, 20)) 4361 } 4362 if containerLen != 0 { 4363 fastpathTV.DecMapStringInt32L(*vp, containerLen, d) 4364 } 4365 } else if containerLen != 0 { 4366 fastpathTV.DecMapStringInt32L(rv2i(rv).(map[string]int32), containerLen, d) 4367 } 4368 d.mapEnd() 4369 } 4370 func (f fastpathT) DecMapStringInt32X(vp *map[string]int32, d *Decoder) { 4371 containerLen := d.mapStart(d.d.ReadMapStart()) 4372 if containerLen == containerLenNil { 4373 *vp = nil 4374 } else { 4375 if *vp == nil { 4376 *vp = make(map[string]int32, decInferLen(containerLen, d.h.MaxInitLen, 20)) 4377 } 4378 if containerLen != 0 { 4379 f.DecMapStringInt32L(*vp, containerLen, d) 4380 } 4381 d.mapEnd() 4382 } 4383 } 4384 func (fastpathT) DecMapStringInt32L(v map[string]int32, containerLen int, d *Decoder) { 4385 if v == nil { 4386 d.errorf("cannot decode into nil map[string]int32 given stream length: %v", containerLen) 4387 return 4388 } 4389 var mk string 4390 var mv int32 4391 hasLen := containerLen > 0 4392 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4393 d.mapElemKey() 4394 mk = d.stringZC(d.d.DecodeStringAsBytes()) 4395 d.mapElemValue() 4396 mv = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 4397 v[mk] = mv 4398 } 4399 } 4400 func (d *Decoder) fastpathDecMapStringFloat64R(f *codecFnInfo, rv reflect.Value) { 4401 containerLen := d.mapStart(d.d.ReadMapStart()) 4402 if rv.Kind() == reflect.Ptr { 4403 vp, _ := rv2i(rv).(*map[string]float64) 4404 if *vp == nil { 4405 *vp = make(map[string]float64, decInferLen(containerLen, d.h.MaxInitLen, 24)) 4406 } 4407 if containerLen != 0 { 4408 fastpathTV.DecMapStringFloat64L(*vp, containerLen, d) 4409 } 4410 } else if containerLen != 0 { 4411 fastpathTV.DecMapStringFloat64L(rv2i(rv).(map[string]float64), containerLen, d) 4412 } 4413 d.mapEnd() 4414 } 4415 func (f fastpathT) DecMapStringFloat64X(vp *map[string]float64, d *Decoder) { 4416 containerLen := d.mapStart(d.d.ReadMapStart()) 4417 if containerLen == containerLenNil { 4418 *vp = nil 4419 } else { 4420 if *vp == nil { 4421 *vp = make(map[string]float64, decInferLen(containerLen, d.h.MaxInitLen, 24)) 4422 } 4423 if containerLen != 0 { 4424 f.DecMapStringFloat64L(*vp, containerLen, d) 4425 } 4426 d.mapEnd() 4427 } 4428 } 4429 func (fastpathT) DecMapStringFloat64L(v map[string]float64, containerLen int, d *Decoder) { 4430 if v == nil { 4431 d.errorf("cannot decode into nil map[string]float64 given stream length: %v", containerLen) 4432 return 4433 } 4434 var mk string 4435 var mv float64 4436 hasLen := containerLen > 0 4437 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4438 d.mapElemKey() 4439 mk = d.stringZC(d.d.DecodeStringAsBytes()) 4440 d.mapElemValue() 4441 mv = d.d.DecodeFloat64() 4442 v[mk] = mv 4443 } 4444 } 4445 func (d *Decoder) fastpathDecMapStringBoolR(f *codecFnInfo, rv reflect.Value) { 4446 containerLen := d.mapStart(d.d.ReadMapStart()) 4447 if rv.Kind() == reflect.Ptr { 4448 vp, _ := rv2i(rv).(*map[string]bool) 4449 if *vp == nil { 4450 *vp = make(map[string]bool, decInferLen(containerLen, d.h.MaxInitLen, 17)) 4451 } 4452 if containerLen != 0 { 4453 fastpathTV.DecMapStringBoolL(*vp, containerLen, d) 4454 } 4455 } else if containerLen != 0 { 4456 fastpathTV.DecMapStringBoolL(rv2i(rv).(map[string]bool), containerLen, d) 4457 } 4458 d.mapEnd() 4459 } 4460 func (f fastpathT) DecMapStringBoolX(vp *map[string]bool, d *Decoder) { 4461 containerLen := d.mapStart(d.d.ReadMapStart()) 4462 if containerLen == containerLenNil { 4463 *vp = nil 4464 } else { 4465 if *vp == nil { 4466 *vp = make(map[string]bool, decInferLen(containerLen, d.h.MaxInitLen, 17)) 4467 } 4468 if containerLen != 0 { 4469 f.DecMapStringBoolL(*vp, containerLen, d) 4470 } 4471 d.mapEnd() 4472 } 4473 } 4474 func (fastpathT) DecMapStringBoolL(v map[string]bool, containerLen int, d *Decoder) { 4475 if v == nil { 4476 d.errorf("cannot decode into nil map[string]bool given stream length: %v", containerLen) 4477 return 4478 } 4479 var mk string 4480 var mv bool 4481 hasLen := containerLen > 0 4482 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4483 d.mapElemKey() 4484 mk = d.stringZC(d.d.DecodeStringAsBytes()) 4485 d.mapElemValue() 4486 mv = d.d.DecodeBool() 4487 v[mk] = mv 4488 } 4489 } 4490 func (d *Decoder) fastpathDecMapUint8IntfR(f *codecFnInfo, rv reflect.Value) { 4491 containerLen := d.mapStart(d.d.ReadMapStart()) 4492 if rv.Kind() == reflect.Ptr { 4493 vp, _ := rv2i(rv).(*map[uint8]interface{}) 4494 if *vp == nil { 4495 *vp = make(map[uint8]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 17)) 4496 } 4497 if containerLen != 0 { 4498 fastpathTV.DecMapUint8IntfL(*vp, containerLen, d) 4499 } 4500 } else if containerLen != 0 { 4501 fastpathTV.DecMapUint8IntfL(rv2i(rv).(map[uint8]interface{}), containerLen, d) 4502 } 4503 d.mapEnd() 4504 } 4505 func (f fastpathT) DecMapUint8IntfX(vp *map[uint8]interface{}, d *Decoder) { 4506 containerLen := d.mapStart(d.d.ReadMapStart()) 4507 if containerLen == containerLenNil { 4508 *vp = nil 4509 } else { 4510 if *vp == nil { 4511 *vp = make(map[uint8]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 17)) 4512 } 4513 if containerLen != 0 { 4514 f.DecMapUint8IntfL(*vp, containerLen, d) 4515 } 4516 d.mapEnd() 4517 } 4518 } 4519 func (fastpathT) DecMapUint8IntfL(v map[uint8]interface{}, containerLen int, d *Decoder) { 4520 if v == nil { 4521 d.errorf("cannot decode into nil map[uint8]interface{} given stream length: %v", containerLen) 4522 return 4523 } 4524 mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset 4525 var mk uint8 4526 var mv interface{} 4527 hasLen := containerLen > 0 4528 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4529 d.mapElemKey() 4530 mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 4531 d.mapElemValue() 4532 if mapGet { 4533 mv = v[mk] 4534 } else { 4535 mv = nil 4536 } 4537 d.decode(&mv) 4538 v[mk] = mv 4539 } 4540 } 4541 func (d *Decoder) fastpathDecMapUint8StringR(f *codecFnInfo, rv reflect.Value) { 4542 containerLen := d.mapStart(d.d.ReadMapStart()) 4543 if rv.Kind() == reflect.Ptr { 4544 vp, _ := rv2i(rv).(*map[uint8]string) 4545 if *vp == nil { 4546 *vp = make(map[uint8]string, decInferLen(containerLen, d.h.MaxInitLen, 17)) 4547 } 4548 if containerLen != 0 { 4549 fastpathTV.DecMapUint8StringL(*vp, containerLen, d) 4550 } 4551 } else if containerLen != 0 { 4552 fastpathTV.DecMapUint8StringL(rv2i(rv).(map[uint8]string), containerLen, d) 4553 } 4554 d.mapEnd() 4555 } 4556 func (f fastpathT) DecMapUint8StringX(vp *map[uint8]string, d *Decoder) { 4557 containerLen := d.mapStart(d.d.ReadMapStart()) 4558 if containerLen == containerLenNil { 4559 *vp = nil 4560 } else { 4561 if *vp == nil { 4562 *vp = make(map[uint8]string, decInferLen(containerLen, d.h.MaxInitLen, 17)) 4563 } 4564 if containerLen != 0 { 4565 f.DecMapUint8StringL(*vp, containerLen, d) 4566 } 4567 d.mapEnd() 4568 } 4569 } 4570 func (fastpathT) DecMapUint8StringL(v map[uint8]string, containerLen int, d *Decoder) { 4571 if v == nil { 4572 d.errorf("cannot decode into nil map[uint8]string given stream length: %v", containerLen) 4573 return 4574 } 4575 var mk uint8 4576 var mv string 4577 hasLen := containerLen > 0 4578 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4579 d.mapElemKey() 4580 mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 4581 d.mapElemValue() 4582 mv = d.stringZC(d.d.DecodeStringAsBytes()) 4583 v[mk] = mv 4584 } 4585 } 4586 func (d *Decoder) fastpathDecMapUint8BytesR(f *codecFnInfo, rv reflect.Value) { 4587 containerLen := d.mapStart(d.d.ReadMapStart()) 4588 if rv.Kind() == reflect.Ptr { 4589 vp, _ := rv2i(rv).(*map[uint8][]byte) 4590 if *vp == nil { 4591 *vp = make(map[uint8][]byte, decInferLen(containerLen, d.h.MaxInitLen, 25)) 4592 } 4593 if containerLen != 0 { 4594 fastpathTV.DecMapUint8BytesL(*vp, containerLen, d) 4595 } 4596 } else if containerLen != 0 { 4597 fastpathTV.DecMapUint8BytesL(rv2i(rv).(map[uint8][]byte), containerLen, d) 4598 } 4599 d.mapEnd() 4600 } 4601 func (f fastpathT) DecMapUint8BytesX(vp *map[uint8][]byte, d *Decoder) { 4602 containerLen := d.mapStart(d.d.ReadMapStart()) 4603 if containerLen == containerLenNil { 4604 *vp = nil 4605 } else { 4606 if *vp == nil { 4607 *vp = make(map[uint8][]byte, decInferLen(containerLen, d.h.MaxInitLen, 25)) 4608 } 4609 if containerLen != 0 { 4610 f.DecMapUint8BytesL(*vp, containerLen, d) 4611 } 4612 d.mapEnd() 4613 } 4614 } 4615 func (fastpathT) DecMapUint8BytesL(v map[uint8][]byte, containerLen int, d *Decoder) { 4616 if v == nil { 4617 d.errorf("cannot decode into nil map[uint8][]byte given stream length: %v", containerLen) 4618 return 4619 } 4620 mapGet := v != nil && !d.h.MapValueReset 4621 var mk uint8 4622 var mv []byte 4623 hasLen := containerLen > 0 4624 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4625 d.mapElemKey() 4626 mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 4627 d.mapElemValue() 4628 if mapGet { 4629 mv = v[mk] 4630 } else { 4631 mv = nil 4632 } 4633 mv = d.decodeBytesInto(mv) 4634 v[mk] = mv 4635 } 4636 } 4637 func (d *Decoder) fastpathDecMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) { 4638 containerLen := d.mapStart(d.d.ReadMapStart()) 4639 if rv.Kind() == reflect.Ptr { 4640 vp, _ := rv2i(rv).(*map[uint8]uint8) 4641 if *vp == nil { 4642 *vp = make(map[uint8]uint8, decInferLen(containerLen, d.h.MaxInitLen, 2)) 4643 } 4644 if containerLen != 0 { 4645 fastpathTV.DecMapUint8Uint8L(*vp, containerLen, d) 4646 } 4647 } else if containerLen != 0 { 4648 fastpathTV.DecMapUint8Uint8L(rv2i(rv).(map[uint8]uint8), containerLen, d) 4649 } 4650 d.mapEnd() 4651 } 4652 func (f fastpathT) DecMapUint8Uint8X(vp *map[uint8]uint8, d *Decoder) { 4653 containerLen := d.mapStart(d.d.ReadMapStart()) 4654 if containerLen == containerLenNil { 4655 *vp = nil 4656 } else { 4657 if *vp == nil { 4658 *vp = make(map[uint8]uint8, decInferLen(containerLen, d.h.MaxInitLen, 2)) 4659 } 4660 if containerLen != 0 { 4661 f.DecMapUint8Uint8L(*vp, containerLen, d) 4662 } 4663 d.mapEnd() 4664 } 4665 } 4666 func (fastpathT) DecMapUint8Uint8L(v map[uint8]uint8, containerLen int, d *Decoder) { 4667 if v == nil { 4668 d.errorf("cannot decode into nil map[uint8]uint8 given stream length: %v", containerLen) 4669 return 4670 } 4671 var mk uint8 4672 var mv uint8 4673 hasLen := containerLen > 0 4674 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4675 d.mapElemKey() 4676 mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 4677 d.mapElemValue() 4678 mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 4679 v[mk] = mv 4680 } 4681 } 4682 func (d *Decoder) fastpathDecMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) { 4683 containerLen := d.mapStart(d.d.ReadMapStart()) 4684 if rv.Kind() == reflect.Ptr { 4685 vp, _ := rv2i(rv).(*map[uint8]uint64) 4686 if *vp == nil { 4687 *vp = make(map[uint8]uint64, decInferLen(containerLen, d.h.MaxInitLen, 9)) 4688 } 4689 if containerLen != 0 { 4690 fastpathTV.DecMapUint8Uint64L(*vp, containerLen, d) 4691 } 4692 } else if containerLen != 0 { 4693 fastpathTV.DecMapUint8Uint64L(rv2i(rv).(map[uint8]uint64), containerLen, d) 4694 } 4695 d.mapEnd() 4696 } 4697 func (f fastpathT) DecMapUint8Uint64X(vp *map[uint8]uint64, d *Decoder) { 4698 containerLen := d.mapStart(d.d.ReadMapStart()) 4699 if containerLen == containerLenNil { 4700 *vp = nil 4701 } else { 4702 if *vp == nil { 4703 *vp = make(map[uint8]uint64, decInferLen(containerLen, d.h.MaxInitLen, 9)) 4704 } 4705 if containerLen != 0 { 4706 f.DecMapUint8Uint64L(*vp, containerLen, d) 4707 } 4708 d.mapEnd() 4709 } 4710 } 4711 func (fastpathT) DecMapUint8Uint64L(v map[uint8]uint64, containerLen int, d *Decoder) { 4712 if v == nil { 4713 d.errorf("cannot decode into nil map[uint8]uint64 given stream length: %v", containerLen) 4714 return 4715 } 4716 var mk uint8 4717 var mv uint64 4718 hasLen := containerLen > 0 4719 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4720 d.mapElemKey() 4721 mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 4722 d.mapElemValue() 4723 mv = d.d.DecodeUint64() 4724 v[mk] = mv 4725 } 4726 } 4727 func (d *Decoder) fastpathDecMapUint8IntR(f *codecFnInfo, rv reflect.Value) { 4728 containerLen := d.mapStart(d.d.ReadMapStart()) 4729 if rv.Kind() == reflect.Ptr { 4730 vp, _ := rv2i(rv).(*map[uint8]int) 4731 if *vp == nil { 4732 *vp = make(map[uint8]int, decInferLen(containerLen, d.h.MaxInitLen, 9)) 4733 } 4734 if containerLen != 0 { 4735 fastpathTV.DecMapUint8IntL(*vp, containerLen, d) 4736 } 4737 } else if containerLen != 0 { 4738 fastpathTV.DecMapUint8IntL(rv2i(rv).(map[uint8]int), containerLen, d) 4739 } 4740 d.mapEnd() 4741 } 4742 func (f fastpathT) DecMapUint8IntX(vp *map[uint8]int, d *Decoder) { 4743 containerLen := d.mapStart(d.d.ReadMapStart()) 4744 if containerLen == containerLenNil { 4745 *vp = nil 4746 } else { 4747 if *vp == nil { 4748 *vp = make(map[uint8]int, decInferLen(containerLen, d.h.MaxInitLen, 9)) 4749 } 4750 if containerLen != 0 { 4751 f.DecMapUint8IntL(*vp, containerLen, d) 4752 } 4753 d.mapEnd() 4754 } 4755 } 4756 func (fastpathT) DecMapUint8IntL(v map[uint8]int, containerLen int, d *Decoder) { 4757 if v == nil { 4758 d.errorf("cannot decode into nil map[uint8]int given stream length: %v", containerLen) 4759 return 4760 } 4761 var mk uint8 4762 var mv int 4763 hasLen := containerLen > 0 4764 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4765 d.mapElemKey() 4766 mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 4767 d.mapElemValue() 4768 mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 4769 v[mk] = mv 4770 } 4771 } 4772 func (d *Decoder) fastpathDecMapUint8Int32R(f *codecFnInfo, rv reflect.Value) { 4773 containerLen := d.mapStart(d.d.ReadMapStart()) 4774 if rv.Kind() == reflect.Ptr { 4775 vp, _ := rv2i(rv).(*map[uint8]int32) 4776 if *vp == nil { 4777 *vp = make(map[uint8]int32, decInferLen(containerLen, d.h.MaxInitLen, 5)) 4778 } 4779 if containerLen != 0 { 4780 fastpathTV.DecMapUint8Int32L(*vp, containerLen, d) 4781 } 4782 } else if containerLen != 0 { 4783 fastpathTV.DecMapUint8Int32L(rv2i(rv).(map[uint8]int32), containerLen, d) 4784 } 4785 d.mapEnd() 4786 } 4787 func (f fastpathT) DecMapUint8Int32X(vp *map[uint8]int32, d *Decoder) { 4788 containerLen := d.mapStart(d.d.ReadMapStart()) 4789 if containerLen == containerLenNil { 4790 *vp = nil 4791 } else { 4792 if *vp == nil { 4793 *vp = make(map[uint8]int32, decInferLen(containerLen, d.h.MaxInitLen, 5)) 4794 } 4795 if containerLen != 0 { 4796 f.DecMapUint8Int32L(*vp, containerLen, d) 4797 } 4798 d.mapEnd() 4799 } 4800 } 4801 func (fastpathT) DecMapUint8Int32L(v map[uint8]int32, containerLen int, d *Decoder) { 4802 if v == nil { 4803 d.errorf("cannot decode into nil map[uint8]int32 given stream length: %v", containerLen) 4804 return 4805 } 4806 var mk uint8 4807 var mv int32 4808 hasLen := containerLen > 0 4809 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4810 d.mapElemKey() 4811 mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 4812 d.mapElemValue() 4813 mv = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 4814 v[mk] = mv 4815 } 4816 } 4817 func (d *Decoder) fastpathDecMapUint8Float64R(f *codecFnInfo, rv reflect.Value) { 4818 containerLen := d.mapStart(d.d.ReadMapStart()) 4819 if rv.Kind() == reflect.Ptr { 4820 vp, _ := rv2i(rv).(*map[uint8]float64) 4821 if *vp == nil { 4822 *vp = make(map[uint8]float64, decInferLen(containerLen, d.h.MaxInitLen, 9)) 4823 } 4824 if containerLen != 0 { 4825 fastpathTV.DecMapUint8Float64L(*vp, containerLen, d) 4826 } 4827 } else if containerLen != 0 { 4828 fastpathTV.DecMapUint8Float64L(rv2i(rv).(map[uint8]float64), containerLen, d) 4829 } 4830 d.mapEnd() 4831 } 4832 func (f fastpathT) DecMapUint8Float64X(vp *map[uint8]float64, d *Decoder) { 4833 containerLen := d.mapStart(d.d.ReadMapStart()) 4834 if containerLen == containerLenNil { 4835 *vp = nil 4836 } else { 4837 if *vp == nil { 4838 *vp = make(map[uint8]float64, decInferLen(containerLen, d.h.MaxInitLen, 9)) 4839 } 4840 if containerLen != 0 { 4841 f.DecMapUint8Float64L(*vp, containerLen, d) 4842 } 4843 d.mapEnd() 4844 } 4845 } 4846 func (fastpathT) DecMapUint8Float64L(v map[uint8]float64, containerLen int, d *Decoder) { 4847 if v == nil { 4848 d.errorf("cannot decode into nil map[uint8]float64 given stream length: %v", containerLen) 4849 return 4850 } 4851 var mk uint8 4852 var mv float64 4853 hasLen := containerLen > 0 4854 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4855 d.mapElemKey() 4856 mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 4857 d.mapElemValue() 4858 mv = d.d.DecodeFloat64() 4859 v[mk] = mv 4860 } 4861 } 4862 func (d *Decoder) fastpathDecMapUint8BoolR(f *codecFnInfo, rv reflect.Value) { 4863 containerLen := d.mapStart(d.d.ReadMapStart()) 4864 if rv.Kind() == reflect.Ptr { 4865 vp, _ := rv2i(rv).(*map[uint8]bool) 4866 if *vp == nil { 4867 *vp = make(map[uint8]bool, decInferLen(containerLen, d.h.MaxInitLen, 2)) 4868 } 4869 if containerLen != 0 { 4870 fastpathTV.DecMapUint8BoolL(*vp, containerLen, d) 4871 } 4872 } else if containerLen != 0 { 4873 fastpathTV.DecMapUint8BoolL(rv2i(rv).(map[uint8]bool), containerLen, d) 4874 } 4875 d.mapEnd() 4876 } 4877 func (f fastpathT) DecMapUint8BoolX(vp *map[uint8]bool, d *Decoder) { 4878 containerLen := d.mapStart(d.d.ReadMapStart()) 4879 if containerLen == containerLenNil { 4880 *vp = nil 4881 } else { 4882 if *vp == nil { 4883 *vp = make(map[uint8]bool, decInferLen(containerLen, d.h.MaxInitLen, 2)) 4884 } 4885 if containerLen != 0 { 4886 f.DecMapUint8BoolL(*vp, containerLen, d) 4887 } 4888 d.mapEnd() 4889 } 4890 } 4891 func (fastpathT) DecMapUint8BoolL(v map[uint8]bool, containerLen int, d *Decoder) { 4892 if v == nil { 4893 d.errorf("cannot decode into nil map[uint8]bool given stream length: %v", containerLen) 4894 return 4895 } 4896 var mk uint8 4897 var mv bool 4898 hasLen := containerLen > 0 4899 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4900 d.mapElemKey() 4901 mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 4902 d.mapElemValue() 4903 mv = d.d.DecodeBool() 4904 v[mk] = mv 4905 } 4906 } 4907 func (d *Decoder) fastpathDecMapUint64IntfR(f *codecFnInfo, rv reflect.Value) { 4908 containerLen := d.mapStart(d.d.ReadMapStart()) 4909 if rv.Kind() == reflect.Ptr { 4910 vp, _ := rv2i(rv).(*map[uint64]interface{}) 4911 if *vp == nil { 4912 *vp = make(map[uint64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) 4913 } 4914 if containerLen != 0 { 4915 fastpathTV.DecMapUint64IntfL(*vp, containerLen, d) 4916 } 4917 } else if containerLen != 0 { 4918 fastpathTV.DecMapUint64IntfL(rv2i(rv).(map[uint64]interface{}), containerLen, d) 4919 } 4920 d.mapEnd() 4921 } 4922 func (f fastpathT) DecMapUint64IntfX(vp *map[uint64]interface{}, d *Decoder) { 4923 containerLen := d.mapStart(d.d.ReadMapStart()) 4924 if containerLen == containerLenNil { 4925 *vp = nil 4926 } else { 4927 if *vp == nil { 4928 *vp = make(map[uint64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) 4929 } 4930 if containerLen != 0 { 4931 f.DecMapUint64IntfL(*vp, containerLen, d) 4932 } 4933 d.mapEnd() 4934 } 4935 } 4936 func (fastpathT) DecMapUint64IntfL(v map[uint64]interface{}, containerLen int, d *Decoder) { 4937 if v == nil { 4938 d.errorf("cannot decode into nil map[uint64]interface{} given stream length: %v", containerLen) 4939 return 4940 } 4941 mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset 4942 var mk uint64 4943 var mv interface{} 4944 hasLen := containerLen > 0 4945 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4946 d.mapElemKey() 4947 mk = d.d.DecodeUint64() 4948 d.mapElemValue() 4949 if mapGet { 4950 mv = v[mk] 4951 } else { 4952 mv = nil 4953 } 4954 d.decode(&mv) 4955 v[mk] = mv 4956 } 4957 } 4958 func (d *Decoder) fastpathDecMapUint64StringR(f *codecFnInfo, rv reflect.Value) { 4959 containerLen := d.mapStart(d.d.ReadMapStart()) 4960 if rv.Kind() == reflect.Ptr { 4961 vp, _ := rv2i(rv).(*map[uint64]string) 4962 if *vp == nil { 4963 *vp = make(map[uint64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) 4964 } 4965 if containerLen != 0 { 4966 fastpathTV.DecMapUint64StringL(*vp, containerLen, d) 4967 } 4968 } else if containerLen != 0 { 4969 fastpathTV.DecMapUint64StringL(rv2i(rv).(map[uint64]string), containerLen, d) 4970 } 4971 d.mapEnd() 4972 } 4973 func (f fastpathT) DecMapUint64StringX(vp *map[uint64]string, d *Decoder) { 4974 containerLen := d.mapStart(d.d.ReadMapStart()) 4975 if containerLen == containerLenNil { 4976 *vp = nil 4977 } else { 4978 if *vp == nil { 4979 *vp = make(map[uint64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) 4980 } 4981 if containerLen != 0 { 4982 f.DecMapUint64StringL(*vp, containerLen, d) 4983 } 4984 d.mapEnd() 4985 } 4986 } 4987 func (fastpathT) DecMapUint64StringL(v map[uint64]string, containerLen int, d *Decoder) { 4988 if v == nil { 4989 d.errorf("cannot decode into nil map[uint64]string given stream length: %v", containerLen) 4990 return 4991 } 4992 var mk uint64 4993 var mv string 4994 hasLen := containerLen > 0 4995 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 4996 d.mapElemKey() 4997 mk = d.d.DecodeUint64() 4998 d.mapElemValue() 4999 mv = d.stringZC(d.d.DecodeStringAsBytes()) 5000 v[mk] = mv 5001 } 5002 } 5003 func (d *Decoder) fastpathDecMapUint64BytesR(f *codecFnInfo, rv reflect.Value) { 5004 containerLen := d.mapStart(d.d.ReadMapStart()) 5005 if rv.Kind() == reflect.Ptr { 5006 vp, _ := rv2i(rv).(*map[uint64][]byte) 5007 if *vp == nil { 5008 *vp = make(map[uint64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) 5009 } 5010 if containerLen != 0 { 5011 fastpathTV.DecMapUint64BytesL(*vp, containerLen, d) 5012 } 5013 } else if containerLen != 0 { 5014 fastpathTV.DecMapUint64BytesL(rv2i(rv).(map[uint64][]byte), containerLen, d) 5015 } 5016 d.mapEnd() 5017 } 5018 func (f fastpathT) DecMapUint64BytesX(vp *map[uint64][]byte, d *Decoder) { 5019 containerLen := d.mapStart(d.d.ReadMapStart()) 5020 if containerLen == containerLenNil { 5021 *vp = nil 5022 } else { 5023 if *vp == nil { 5024 *vp = make(map[uint64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) 5025 } 5026 if containerLen != 0 { 5027 f.DecMapUint64BytesL(*vp, containerLen, d) 5028 } 5029 d.mapEnd() 5030 } 5031 } 5032 func (fastpathT) DecMapUint64BytesL(v map[uint64][]byte, containerLen int, d *Decoder) { 5033 if v == nil { 5034 d.errorf("cannot decode into nil map[uint64][]byte given stream length: %v", containerLen) 5035 return 5036 } 5037 mapGet := v != nil && !d.h.MapValueReset 5038 var mk uint64 5039 var mv []byte 5040 hasLen := containerLen > 0 5041 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5042 d.mapElemKey() 5043 mk = d.d.DecodeUint64() 5044 d.mapElemValue() 5045 if mapGet { 5046 mv = v[mk] 5047 } else { 5048 mv = nil 5049 } 5050 mv = d.decodeBytesInto(mv) 5051 v[mk] = mv 5052 } 5053 } 5054 func (d *Decoder) fastpathDecMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) { 5055 containerLen := d.mapStart(d.d.ReadMapStart()) 5056 if rv.Kind() == reflect.Ptr { 5057 vp, _ := rv2i(rv).(*map[uint64]uint8) 5058 if *vp == nil { 5059 *vp = make(map[uint64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) 5060 } 5061 if containerLen != 0 { 5062 fastpathTV.DecMapUint64Uint8L(*vp, containerLen, d) 5063 } 5064 } else if containerLen != 0 { 5065 fastpathTV.DecMapUint64Uint8L(rv2i(rv).(map[uint64]uint8), containerLen, d) 5066 } 5067 d.mapEnd() 5068 } 5069 func (f fastpathT) DecMapUint64Uint8X(vp *map[uint64]uint8, d *Decoder) { 5070 containerLen := d.mapStart(d.d.ReadMapStart()) 5071 if containerLen == containerLenNil { 5072 *vp = nil 5073 } else { 5074 if *vp == nil { 5075 *vp = make(map[uint64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) 5076 } 5077 if containerLen != 0 { 5078 f.DecMapUint64Uint8L(*vp, containerLen, d) 5079 } 5080 d.mapEnd() 5081 } 5082 } 5083 func (fastpathT) DecMapUint64Uint8L(v map[uint64]uint8, containerLen int, d *Decoder) { 5084 if v == nil { 5085 d.errorf("cannot decode into nil map[uint64]uint8 given stream length: %v", containerLen) 5086 return 5087 } 5088 var mk uint64 5089 var mv uint8 5090 hasLen := containerLen > 0 5091 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5092 d.mapElemKey() 5093 mk = d.d.DecodeUint64() 5094 d.mapElemValue() 5095 mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 5096 v[mk] = mv 5097 } 5098 } 5099 func (d *Decoder) fastpathDecMapUint64Uint64R(f *codecFnInfo, rv reflect.Value) { 5100 containerLen := d.mapStart(d.d.ReadMapStart()) 5101 if rv.Kind() == reflect.Ptr { 5102 vp, _ := rv2i(rv).(*map[uint64]uint64) 5103 if *vp == nil { 5104 *vp = make(map[uint64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) 5105 } 5106 if containerLen != 0 { 5107 fastpathTV.DecMapUint64Uint64L(*vp, containerLen, d) 5108 } 5109 } else if containerLen != 0 { 5110 fastpathTV.DecMapUint64Uint64L(rv2i(rv).(map[uint64]uint64), containerLen, d) 5111 } 5112 d.mapEnd() 5113 } 5114 func (f fastpathT) DecMapUint64Uint64X(vp *map[uint64]uint64, d *Decoder) { 5115 containerLen := d.mapStart(d.d.ReadMapStart()) 5116 if containerLen == containerLenNil { 5117 *vp = nil 5118 } else { 5119 if *vp == nil { 5120 *vp = make(map[uint64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) 5121 } 5122 if containerLen != 0 { 5123 f.DecMapUint64Uint64L(*vp, containerLen, d) 5124 } 5125 d.mapEnd() 5126 } 5127 } 5128 func (fastpathT) DecMapUint64Uint64L(v map[uint64]uint64, containerLen int, d *Decoder) { 5129 if v == nil { 5130 d.errorf("cannot decode into nil map[uint64]uint64 given stream length: %v", containerLen) 5131 return 5132 } 5133 var mk uint64 5134 var mv uint64 5135 hasLen := containerLen > 0 5136 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5137 d.mapElemKey() 5138 mk = d.d.DecodeUint64() 5139 d.mapElemValue() 5140 mv = d.d.DecodeUint64() 5141 v[mk] = mv 5142 } 5143 } 5144 func (d *Decoder) fastpathDecMapUint64IntR(f *codecFnInfo, rv reflect.Value) { 5145 containerLen := d.mapStart(d.d.ReadMapStart()) 5146 if rv.Kind() == reflect.Ptr { 5147 vp, _ := rv2i(rv).(*map[uint64]int) 5148 if *vp == nil { 5149 *vp = make(map[uint64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) 5150 } 5151 if containerLen != 0 { 5152 fastpathTV.DecMapUint64IntL(*vp, containerLen, d) 5153 } 5154 } else if containerLen != 0 { 5155 fastpathTV.DecMapUint64IntL(rv2i(rv).(map[uint64]int), containerLen, d) 5156 } 5157 d.mapEnd() 5158 } 5159 func (f fastpathT) DecMapUint64IntX(vp *map[uint64]int, d *Decoder) { 5160 containerLen := d.mapStart(d.d.ReadMapStart()) 5161 if containerLen == containerLenNil { 5162 *vp = nil 5163 } else { 5164 if *vp == nil { 5165 *vp = make(map[uint64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) 5166 } 5167 if containerLen != 0 { 5168 f.DecMapUint64IntL(*vp, containerLen, d) 5169 } 5170 d.mapEnd() 5171 } 5172 } 5173 func (fastpathT) DecMapUint64IntL(v map[uint64]int, containerLen int, d *Decoder) { 5174 if v == nil { 5175 d.errorf("cannot decode into nil map[uint64]int given stream length: %v", containerLen) 5176 return 5177 } 5178 var mk uint64 5179 var mv int 5180 hasLen := containerLen > 0 5181 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5182 d.mapElemKey() 5183 mk = d.d.DecodeUint64() 5184 d.mapElemValue() 5185 mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 5186 v[mk] = mv 5187 } 5188 } 5189 func (d *Decoder) fastpathDecMapUint64Int32R(f *codecFnInfo, rv reflect.Value) { 5190 containerLen := d.mapStart(d.d.ReadMapStart()) 5191 if rv.Kind() == reflect.Ptr { 5192 vp, _ := rv2i(rv).(*map[uint64]int32) 5193 if *vp == nil { 5194 *vp = make(map[uint64]int32, decInferLen(containerLen, d.h.MaxInitLen, 12)) 5195 } 5196 if containerLen != 0 { 5197 fastpathTV.DecMapUint64Int32L(*vp, containerLen, d) 5198 } 5199 } else if containerLen != 0 { 5200 fastpathTV.DecMapUint64Int32L(rv2i(rv).(map[uint64]int32), containerLen, d) 5201 } 5202 d.mapEnd() 5203 } 5204 func (f fastpathT) DecMapUint64Int32X(vp *map[uint64]int32, d *Decoder) { 5205 containerLen := d.mapStart(d.d.ReadMapStart()) 5206 if containerLen == containerLenNil { 5207 *vp = nil 5208 } else { 5209 if *vp == nil { 5210 *vp = make(map[uint64]int32, decInferLen(containerLen, d.h.MaxInitLen, 12)) 5211 } 5212 if containerLen != 0 { 5213 f.DecMapUint64Int32L(*vp, containerLen, d) 5214 } 5215 d.mapEnd() 5216 } 5217 } 5218 func (fastpathT) DecMapUint64Int32L(v map[uint64]int32, containerLen int, d *Decoder) { 5219 if v == nil { 5220 d.errorf("cannot decode into nil map[uint64]int32 given stream length: %v", containerLen) 5221 return 5222 } 5223 var mk uint64 5224 var mv int32 5225 hasLen := containerLen > 0 5226 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5227 d.mapElemKey() 5228 mk = d.d.DecodeUint64() 5229 d.mapElemValue() 5230 mv = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 5231 v[mk] = mv 5232 } 5233 } 5234 func (d *Decoder) fastpathDecMapUint64Float64R(f *codecFnInfo, rv reflect.Value) { 5235 containerLen := d.mapStart(d.d.ReadMapStart()) 5236 if rv.Kind() == reflect.Ptr { 5237 vp, _ := rv2i(rv).(*map[uint64]float64) 5238 if *vp == nil { 5239 *vp = make(map[uint64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) 5240 } 5241 if containerLen != 0 { 5242 fastpathTV.DecMapUint64Float64L(*vp, containerLen, d) 5243 } 5244 } else if containerLen != 0 { 5245 fastpathTV.DecMapUint64Float64L(rv2i(rv).(map[uint64]float64), containerLen, d) 5246 } 5247 d.mapEnd() 5248 } 5249 func (f fastpathT) DecMapUint64Float64X(vp *map[uint64]float64, d *Decoder) { 5250 containerLen := d.mapStart(d.d.ReadMapStart()) 5251 if containerLen == containerLenNil { 5252 *vp = nil 5253 } else { 5254 if *vp == nil { 5255 *vp = make(map[uint64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) 5256 } 5257 if containerLen != 0 { 5258 f.DecMapUint64Float64L(*vp, containerLen, d) 5259 } 5260 d.mapEnd() 5261 } 5262 } 5263 func (fastpathT) DecMapUint64Float64L(v map[uint64]float64, containerLen int, d *Decoder) { 5264 if v == nil { 5265 d.errorf("cannot decode into nil map[uint64]float64 given stream length: %v", containerLen) 5266 return 5267 } 5268 var mk uint64 5269 var mv float64 5270 hasLen := containerLen > 0 5271 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5272 d.mapElemKey() 5273 mk = d.d.DecodeUint64() 5274 d.mapElemValue() 5275 mv = d.d.DecodeFloat64() 5276 v[mk] = mv 5277 } 5278 } 5279 func (d *Decoder) fastpathDecMapUint64BoolR(f *codecFnInfo, rv reflect.Value) { 5280 containerLen := d.mapStart(d.d.ReadMapStart()) 5281 if rv.Kind() == reflect.Ptr { 5282 vp, _ := rv2i(rv).(*map[uint64]bool) 5283 if *vp == nil { 5284 *vp = make(map[uint64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) 5285 } 5286 if containerLen != 0 { 5287 fastpathTV.DecMapUint64BoolL(*vp, containerLen, d) 5288 } 5289 } else if containerLen != 0 { 5290 fastpathTV.DecMapUint64BoolL(rv2i(rv).(map[uint64]bool), containerLen, d) 5291 } 5292 d.mapEnd() 5293 } 5294 func (f fastpathT) DecMapUint64BoolX(vp *map[uint64]bool, d *Decoder) { 5295 containerLen := d.mapStart(d.d.ReadMapStart()) 5296 if containerLen == containerLenNil { 5297 *vp = nil 5298 } else { 5299 if *vp == nil { 5300 *vp = make(map[uint64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) 5301 } 5302 if containerLen != 0 { 5303 f.DecMapUint64BoolL(*vp, containerLen, d) 5304 } 5305 d.mapEnd() 5306 } 5307 } 5308 func (fastpathT) DecMapUint64BoolL(v map[uint64]bool, containerLen int, d *Decoder) { 5309 if v == nil { 5310 d.errorf("cannot decode into nil map[uint64]bool given stream length: %v", containerLen) 5311 return 5312 } 5313 var mk uint64 5314 var mv bool 5315 hasLen := containerLen > 0 5316 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5317 d.mapElemKey() 5318 mk = d.d.DecodeUint64() 5319 d.mapElemValue() 5320 mv = d.d.DecodeBool() 5321 v[mk] = mv 5322 } 5323 } 5324 func (d *Decoder) fastpathDecMapIntIntfR(f *codecFnInfo, rv reflect.Value) { 5325 containerLen := d.mapStart(d.d.ReadMapStart()) 5326 if rv.Kind() == reflect.Ptr { 5327 vp, _ := rv2i(rv).(*map[int]interface{}) 5328 if *vp == nil { 5329 *vp = make(map[int]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) 5330 } 5331 if containerLen != 0 { 5332 fastpathTV.DecMapIntIntfL(*vp, containerLen, d) 5333 } 5334 } else if containerLen != 0 { 5335 fastpathTV.DecMapIntIntfL(rv2i(rv).(map[int]interface{}), containerLen, d) 5336 } 5337 d.mapEnd() 5338 } 5339 func (f fastpathT) DecMapIntIntfX(vp *map[int]interface{}, d *Decoder) { 5340 containerLen := d.mapStart(d.d.ReadMapStart()) 5341 if containerLen == containerLenNil { 5342 *vp = nil 5343 } else { 5344 if *vp == nil { 5345 *vp = make(map[int]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) 5346 } 5347 if containerLen != 0 { 5348 f.DecMapIntIntfL(*vp, containerLen, d) 5349 } 5350 d.mapEnd() 5351 } 5352 } 5353 func (fastpathT) DecMapIntIntfL(v map[int]interface{}, containerLen int, d *Decoder) { 5354 if v == nil { 5355 d.errorf("cannot decode into nil map[int]interface{} given stream length: %v", containerLen) 5356 return 5357 } 5358 mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset 5359 var mk int 5360 var mv interface{} 5361 hasLen := containerLen > 0 5362 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5363 d.mapElemKey() 5364 mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 5365 d.mapElemValue() 5366 if mapGet { 5367 mv = v[mk] 5368 } else { 5369 mv = nil 5370 } 5371 d.decode(&mv) 5372 v[mk] = mv 5373 } 5374 } 5375 func (d *Decoder) fastpathDecMapIntStringR(f *codecFnInfo, rv reflect.Value) { 5376 containerLen := d.mapStart(d.d.ReadMapStart()) 5377 if rv.Kind() == reflect.Ptr { 5378 vp, _ := rv2i(rv).(*map[int]string) 5379 if *vp == nil { 5380 *vp = make(map[int]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) 5381 } 5382 if containerLen != 0 { 5383 fastpathTV.DecMapIntStringL(*vp, containerLen, d) 5384 } 5385 } else if containerLen != 0 { 5386 fastpathTV.DecMapIntStringL(rv2i(rv).(map[int]string), containerLen, d) 5387 } 5388 d.mapEnd() 5389 } 5390 func (f fastpathT) DecMapIntStringX(vp *map[int]string, d *Decoder) { 5391 containerLen := d.mapStart(d.d.ReadMapStart()) 5392 if containerLen == containerLenNil { 5393 *vp = nil 5394 } else { 5395 if *vp == nil { 5396 *vp = make(map[int]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) 5397 } 5398 if containerLen != 0 { 5399 f.DecMapIntStringL(*vp, containerLen, d) 5400 } 5401 d.mapEnd() 5402 } 5403 } 5404 func (fastpathT) DecMapIntStringL(v map[int]string, containerLen int, d *Decoder) { 5405 if v == nil { 5406 d.errorf("cannot decode into nil map[int]string given stream length: %v", containerLen) 5407 return 5408 } 5409 var mk int 5410 var mv string 5411 hasLen := containerLen > 0 5412 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5413 d.mapElemKey() 5414 mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 5415 d.mapElemValue() 5416 mv = d.stringZC(d.d.DecodeStringAsBytes()) 5417 v[mk] = mv 5418 } 5419 } 5420 func (d *Decoder) fastpathDecMapIntBytesR(f *codecFnInfo, rv reflect.Value) { 5421 containerLen := d.mapStart(d.d.ReadMapStart()) 5422 if rv.Kind() == reflect.Ptr { 5423 vp, _ := rv2i(rv).(*map[int][]byte) 5424 if *vp == nil { 5425 *vp = make(map[int][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) 5426 } 5427 if containerLen != 0 { 5428 fastpathTV.DecMapIntBytesL(*vp, containerLen, d) 5429 } 5430 } else if containerLen != 0 { 5431 fastpathTV.DecMapIntBytesL(rv2i(rv).(map[int][]byte), containerLen, d) 5432 } 5433 d.mapEnd() 5434 } 5435 func (f fastpathT) DecMapIntBytesX(vp *map[int][]byte, d *Decoder) { 5436 containerLen := d.mapStart(d.d.ReadMapStart()) 5437 if containerLen == containerLenNil { 5438 *vp = nil 5439 } else { 5440 if *vp == nil { 5441 *vp = make(map[int][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) 5442 } 5443 if containerLen != 0 { 5444 f.DecMapIntBytesL(*vp, containerLen, d) 5445 } 5446 d.mapEnd() 5447 } 5448 } 5449 func (fastpathT) DecMapIntBytesL(v map[int][]byte, containerLen int, d *Decoder) { 5450 if v == nil { 5451 d.errorf("cannot decode into nil map[int][]byte given stream length: %v", containerLen) 5452 return 5453 } 5454 mapGet := v != nil && !d.h.MapValueReset 5455 var mk int 5456 var mv []byte 5457 hasLen := containerLen > 0 5458 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5459 d.mapElemKey() 5460 mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 5461 d.mapElemValue() 5462 if mapGet { 5463 mv = v[mk] 5464 } else { 5465 mv = nil 5466 } 5467 mv = d.decodeBytesInto(mv) 5468 v[mk] = mv 5469 } 5470 } 5471 func (d *Decoder) fastpathDecMapIntUint8R(f *codecFnInfo, rv reflect.Value) { 5472 containerLen := d.mapStart(d.d.ReadMapStart()) 5473 if rv.Kind() == reflect.Ptr { 5474 vp, _ := rv2i(rv).(*map[int]uint8) 5475 if *vp == nil { 5476 *vp = make(map[int]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) 5477 } 5478 if containerLen != 0 { 5479 fastpathTV.DecMapIntUint8L(*vp, containerLen, d) 5480 } 5481 } else if containerLen != 0 { 5482 fastpathTV.DecMapIntUint8L(rv2i(rv).(map[int]uint8), containerLen, d) 5483 } 5484 d.mapEnd() 5485 } 5486 func (f fastpathT) DecMapIntUint8X(vp *map[int]uint8, d *Decoder) { 5487 containerLen := d.mapStart(d.d.ReadMapStart()) 5488 if containerLen == containerLenNil { 5489 *vp = nil 5490 } else { 5491 if *vp == nil { 5492 *vp = make(map[int]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) 5493 } 5494 if containerLen != 0 { 5495 f.DecMapIntUint8L(*vp, containerLen, d) 5496 } 5497 d.mapEnd() 5498 } 5499 } 5500 func (fastpathT) DecMapIntUint8L(v map[int]uint8, containerLen int, d *Decoder) { 5501 if v == nil { 5502 d.errorf("cannot decode into nil map[int]uint8 given stream length: %v", containerLen) 5503 return 5504 } 5505 var mk int 5506 var mv uint8 5507 hasLen := containerLen > 0 5508 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5509 d.mapElemKey() 5510 mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 5511 d.mapElemValue() 5512 mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 5513 v[mk] = mv 5514 } 5515 } 5516 func (d *Decoder) fastpathDecMapIntUint64R(f *codecFnInfo, rv reflect.Value) { 5517 containerLen := d.mapStart(d.d.ReadMapStart()) 5518 if rv.Kind() == reflect.Ptr { 5519 vp, _ := rv2i(rv).(*map[int]uint64) 5520 if *vp == nil { 5521 *vp = make(map[int]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) 5522 } 5523 if containerLen != 0 { 5524 fastpathTV.DecMapIntUint64L(*vp, containerLen, d) 5525 } 5526 } else if containerLen != 0 { 5527 fastpathTV.DecMapIntUint64L(rv2i(rv).(map[int]uint64), containerLen, d) 5528 } 5529 d.mapEnd() 5530 } 5531 func (f fastpathT) DecMapIntUint64X(vp *map[int]uint64, d *Decoder) { 5532 containerLen := d.mapStart(d.d.ReadMapStart()) 5533 if containerLen == containerLenNil { 5534 *vp = nil 5535 } else { 5536 if *vp == nil { 5537 *vp = make(map[int]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) 5538 } 5539 if containerLen != 0 { 5540 f.DecMapIntUint64L(*vp, containerLen, d) 5541 } 5542 d.mapEnd() 5543 } 5544 } 5545 func (fastpathT) DecMapIntUint64L(v map[int]uint64, containerLen int, d *Decoder) { 5546 if v == nil { 5547 d.errorf("cannot decode into nil map[int]uint64 given stream length: %v", containerLen) 5548 return 5549 } 5550 var mk int 5551 var mv uint64 5552 hasLen := containerLen > 0 5553 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5554 d.mapElemKey() 5555 mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 5556 d.mapElemValue() 5557 mv = d.d.DecodeUint64() 5558 v[mk] = mv 5559 } 5560 } 5561 func (d *Decoder) fastpathDecMapIntIntR(f *codecFnInfo, rv reflect.Value) { 5562 containerLen := d.mapStart(d.d.ReadMapStart()) 5563 if rv.Kind() == reflect.Ptr { 5564 vp, _ := rv2i(rv).(*map[int]int) 5565 if *vp == nil { 5566 *vp = make(map[int]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) 5567 } 5568 if containerLen != 0 { 5569 fastpathTV.DecMapIntIntL(*vp, containerLen, d) 5570 } 5571 } else if containerLen != 0 { 5572 fastpathTV.DecMapIntIntL(rv2i(rv).(map[int]int), containerLen, d) 5573 } 5574 d.mapEnd() 5575 } 5576 func (f fastpathT) DecMapIntIntX(vp *map[int]int, d *Decoder) { 5577 containerLen := d.mapStart(d.d.ReadMapStart()) 5578 if containerLen == containerLenNil { 5579 *vp = nil 5580 } else { 5581 if *vp == nil { 5582 *vp = make(map[int]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) 5583 } 5584 if containerLen != 0 { 5585 f.DecMapIntIntL(*vp, containerLen, d) 5586 } 5587 d.mapEnd() 5588 } 5589 } 5590 func (fastpathT) DecMapIntIntL(v map[int]int, containerLen int, d *Decoder) { 5591 if v == nil { 5592 d.errorf("cannot decode into nil map[int]int given stream length: %v", containerLen) 5593 return 5594 } 5595 var mk int 5596 var mv int 5597 hasLen := containerLen > 0 5598 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5599 d.mapElemKey() 5600 mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 5601 d.mapElemValue() 5602 mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 5603 v[mk] = mv 5604 } 5605 } 5606 func (d *Decoder) fastpathDecMapIntInt32R(f *codecFnInfo, rv reflect.Value) { 5607 containerLen := d.mapStart(d.d.ReadMapStart()) 5608 if rv.Kind() == reflect.Ptr { 5609 vp, _ := rv2i(rv).(*map[int]int32) 5610 if *vp == nil { 5611 *vp = make(map[int]int32, decInferLen(containerLen, d.h.MaxInitLen, 12)) 5612 } 5613 if containerLen != 0 { 5614 fastpathTV.DecMapIntInt32L(*vp, containerLen, d) 5615 } 5616 } else if containerLen != 0 { 5617 fastpathTV.DecMapIntInt32L(rv2i(rv).(map[int]int32), containerLen, d) 5618 } 5619 d.mapEnd() 5620 } 5621 func (f fastpathT) DecMapIntInt32X(vp *map[int]int32, d *Decoder) { 5622 containerLen := d.mapStart(d.d.ReadMapStart()) 5623 if containerLen == containerLenNil { 5624 *vp = nil 5625 } else { 5626 if *vp == nil { 5627 *vp = make(map[int]int32, decInferLen(containerLen, d.h.MaxInitLen, 12)) 5628 } 5629 if containerLen != 0 { 5630 f.DecMapIntInt32L(*vp, containerLen, d) 5631 } 5632 d.mapEnd() 5633 } 5634 } 5635 func (fastpathT) DecMapIntInt32L(v map[int]int32, containerLen int, d *Decoder) { 5636 if v == nil { 5637 d.errorf("cannot decode into nil map[int]int32 given stream length: %v", containerLen) 5638 return 5639 } 5640 var mk int 5641 var mv int32 5642 hasLen := containerLen > 0 5643 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5644 d.mapElemKey() 5645 mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 5646 d.mapElemValue() 5647 mv = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 5648 v[mk] = mv 5649 } 5650 } 5651 func (d *Decoder) fastpathDecMapIntFloat64R(f *codecFnInfo, rv reflect.Value) { 5652 containerLen := d.mapStart(d.d.ReadMapStart()) 5653 if rv.Kind() == reflect.Ptr { 5654 vp, _ := rv2i(rv).(*map[int]float64) 5655 if *vp == nil { 5656 *vp = make(map[int]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) 5657 } 5658 if containerLen != 0 { 5659 fastpathTV.DecMapIntFloat64L(*vp, containerLen, d) 5660 } 5661 } else if containerLen != 0 { 5662 fastpathTV.DecMapIntFloat64L(rv2i(rv).(map[int]float64), containerLen, d) 5663 } 5664 d.mapEnd() 5665 } 5666 func (f fastpathT) DecMapIntFloat64X(vp *map[int]float64, d *Decoder) { 5667 containerLen := d.mapStart(d.d.ReadMapStart()) 5668 if containerLen == containerLenNil { 5669 *vp = nil 5670 } else { 5671 if *vp == nil { 5672 *vp = make(map[int]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) 5673 } 5674 if containerLen != 0 { 5675 f.DecMapIntFloat64L(*vp, containerLen, d) 5676 } 5677 d.mapEnd() 5678 } 5679 } 5680 func (fastpathT) DecMapIntFloat64L(v map[int]float64, containerLen int, d *Decoder) { 5681 if v == nil { 5682 d.errorf("cannot decode into nil map[int]float64 given stream length: %v", containerLen) 5683 return 5684 } 5685 var mk int 5686 var mv float64 5687 hasLen := containerLen > 0 5688 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5689 d.mapElemKey() 5690 mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 5691 d.mapElemValue() 5692 mv = d.d.DecodeFloat64() 5693 v[mk] = mv 5694 } 5695 } 5696 func (d *Decoder) fastpathDecMapIntBoolR(f *codecFnInfo, rv reflect.Value) { 5697 containerLen := d.mapStart(d.d.ReadMapStart()) 5698 if rv.Kind() == reflect.Ptr { 5699 vp, _ := rv2i(rv).(*map[int]bool) 5700 if *vp == nil { 5701 *vp = make(map[int]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) 5702 } 5703 if containerLen != 0 { 5704 fastpathTV.DecMapIntBoolL(*vp, containerLen, d) 5705 } 5706 } else if containerLen != 0 { 5707 fastpathTV.DecMapIntBoolL(rv2i(rv).(map[int]bool), containerLen, d) 5708 } 5709 d.mapEnd() 5710 } 5711 func (f fastpathT) DecMapIntBoolX(vp *map[int]bool, d *Decoder) { 5712 containerLen := d.mapStart(d.d.ReadMapStart()) 5713 if containerLen == containerLenNil { 5714 *vp = nil 5715 } else { 5716 if *vp == nil { 5717 *vp = make(map[int]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) 5718 } 5719 if containerLen != 0 { 5720 f.DecMapIntBoolL(*vp, containerLen, d) 5721 } 5722 d.mapEnd() 5723 } 5724 } 5725 func (fastpathT) DecMapIntBoolL(v map[int]bool, containerLen int, d *Decoder) { 5726 if v == nil { 5727 d.errorf("cannot decode into nil map[int]bool given stream length: %v", containerLen) 5728 return 5729 } 5730 var mk int 5731 var mv bool 5732 hasLen := containerLen > 0 5733 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5734 d.mapElemKey() 5735 mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 5736 d.mapElemValue() 5737 mv = d.d.DecodeBool() 5738 v[mk] = mv 5739 } 5740 } 5741 func (d *Decoder) fastpathDecMapInt32IntfR(f *codecFnInfo, rv reflect.Value) { 5742 containerLen := d.mapStart(d.d.ReadMapStart()) 5743 if rv.Kind() == reflect.Ptr { 5744 vp, _ := rv2i(rv).(*map[int32]interface{}) 5745 if *vp == nil { 5746 *vp = make(map[int32]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 20)) 5747 } 5748 if containerLen != 0 { 5749 fastpathTV.DecMapInt32IntfL(*vp, containerLen, d) 5750 } 5751 } else if containerLen != 0 { 5752 fastpathTV.DecMapInt32IntfL(rv2i(rv).(map[int32]interface{}), containerLen, d) 5753 } 5754 d.mapEnd() 5755 } 5756 func (f fastpathT) DecMapInt32IntfX(vp *map[int32]interface{}, d *Decoder) { 5757 containerLen := d.mapStart(d.d.ReadMapStart()) 5758 if containerLen == containerLenNil { 5759 *vp = nil 5760 } else { 5761 if *vp == nil { 5762 *vp = make(map[int32]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 20)) 5763 } 5764 if containerLen != 0 { 5765 f.DecMapInt32IntfL(*vp, containerLen, d) 5766 } 5767 d.mapEnd() 5768 } 5769 } 5770 func (fastpathT) DecMapInt32IntfL(v map[int32]interface{}, containerLen int, d *Decoder) { 5771 if v == nil { 5772 d.errorf("cannot decode into nil map[int32]interface{} given stream length: %v", containerLen) 5773 return 5774 } 5775 mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset 5776 var mk int32 5777 var mv interface{} 5778 hasLen := containerLen > 0 5779 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5780 d.mapElemKey() 5781 mk = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 5782 d.mapElemValue() 5783 if mapGet { 5784 mv = v[mk] 5785 } else { 5786 mv = nil 5787 } 5788 d.decode(&mv) 5789 v[mk] = mv 5790 } 5791 } 5792 func (d *Decoder) fastpathDecMapInt32StringR(f *codecFnInfo, rv reflect.Value) { 5793 containerLen := d.mapStart(d.d.ReadMapStart()) 5794 if rv.Kind() == reflect.Ptr { 5795 vp, _ := rv2i(rv).(*map[int32]string) 5796 if *vp == nil { 5797 *vp = make(map[int32]string, decInferLen(containerLen, d.h.MaxInitLen, 20)) 5798 } 5799 if containerLen != 0 { 5800 fastpathTV.DecMapInt32StringL(*vp, containerLen, d) 5801 } 5802 } else if containerLen != 0 { 5803 fastpathTV.DecMapInt32StringL(rv2i(rv).(map[int32]string), containerLen, d) 5804 } 5805 d.mapEnd() 5806 } 5807 func (f fastpathT) DecMapInt32StringX(vp *map[int32]string, d *Decoder) { 5808 containerLen := d.mapStart(d.d.ReadMapStart()) 5809 if containerLen == containerLenNil { 5810 *vp = nil 5811 } else { 5812 if *vp == nil { 5813 *vp = make(map[int32]string, decInferLen(containerLen, d.h.MaxInitLen, 20)) 5814 } 5815 if containerLen != 0 { 5816 f.DecMapInt32StringL(*vp, containerLen, d) 5817 } 5818 d.mapEnd() 5819 } 5820 } 5821 func (fastpathT) DecMapInt32StringL(v map[int32]string, containerLen int, d *Decoder) { 5822 if v == nil { 5823 d.errorf("cannot decode into nil map[int32]string given stream length: %v", containerLen) 5824 return 5825 } 5826 var mk int32 5827 var mv string 5828 hasLen := containerLen > 0 5829 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5830 d.mapElemKey() 5831 mk = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 5832 d.mapElemValue() 5833 mv = d.stringZC(d.d.DecodeStringAsBytes()) 5834 v[mk] = mv 5835 } 5836 } 5837 func (d *Decoder) fastpathDecMapInt32BytesR(f *codecFnInfo, rv reflect.Value) { 5838 containerLen := d.mapStart(d.d.ReadMapStart()) 5839 if rv.Kind() == reflect.Ptr { 5840 vp, _ := rv2i(rv).(*map[int32][]byte) 5841 if *vp == nil { 5842 *vp = make(map[int32][]byte, decInferLen(containerLen, d.h.MaxInitLen, 28)) 5843 } 5844 if containerLen != 0 { 5845 fastpathTV.DecMapInt32BytesL(*vp, containerLen, d) 5846 } 5847 } else if containerLen != 0 { 5848 fastpathTV.DecMapInt32BytesL(rv2i(rv).(map[int32][]byte), containerLen, d) 5849 } 5850 d.mapEnd() 5851 } 5852 func (f fastpathT) DecMapInt32BytesX(vp *map[int32][]byte, d *Decoder) { 5853 containerLen := d.mapStart(d.d.ReadMapStart()) 5854 if containerLen == containerLenNil { 5855 *vp = nil 5856 } else { 5857 if *vp == nil { 5858 *vp = make(map[int32][]byte, decInferLen(containerLen, d.h.MaxInitLen, 28)) 5859 } 5860 if containerLen != 0 { 5861 f.DecMapInt32BytesL(*vp, containerLen, d) 5862 } 5863 d.mapEnd() 5864 } 5865 } 5866 func (fastpathT) DecMapInt32BytesL(v map[int32][]byte, containerLen int, d *Decoder) { 5867 if v == nil { 5868 d.errorf("cannot decode into nil map[int32][]byte given stream length: %v", containerLen) 5869 return 5870 } 5871 mapGet := v != nil && !d.h.MapValueReset 5872 var mk int32 5873 var mv []byte 5874 hasLen := containerLen > 0 5875 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5876 d.mapElemKey() 5877 mk = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 5878 d.mapElemValue() 5879 if mapGet { 5880 mv = v[mk] 5881 } else { 5882 mv = nil 5883 } 5884 mv = d.decodeBytesInto(mv) 5885 v[mk] = mv 5886 } 5887 } 5888 func (d *Decoder) fastpathDecMapInt32Uint8R(f *codecFnInfo, rv reflect.Value) { 5889 containerLen := d.mapStart(d.d.ReadMapStart()) 5890 if rv.Kind() == reflect.Ptr { 5891 vp, _ := rv2i(rv).(*map[int32]uint8) 5892 if *vp == nil { 5893 *vp = make(map[int32]uint8, decInferLen(containerLen, d.h.MaxInitLen, 5)) 5894 } 5895 if containerLen != 0 { 5896 fastpathTV.DecMapInt32Uint8L(*vp, containerLen, d) 5897 } 5898 } else if containerLen != 0 { 5899 fastpathTV.DecMapInt32Uint8L(rv2i(rv).(map[int32]uint8), containerLen, d) 5900 } 5901 d.mapEnd() 5902 } 5903 func (f fastpathT) DecMapInt32Uint8X(vp *map[int32]uint8, d *Decoder) { 5904 containerLen := d.mapStart(d.d.ReadMapStart()) 5905 if containerLen == containerLenNil { 5906 *vp = nil 5907 } else { 5908 if *vp == nil { 5909 *vp = make(map[int32]uint8, decInferLen(containerLen, d.h.MaxInitLen, 5)) 5910 } 5911 if containerLen != 0 { 5912 f.DecMapInt32Uint8L(*vp, containerLen, d) 5913 } 5914 d.mapEnd() 5915 } 5916 } 5917 func (fastpathT) DecMapInt32Uint8L(v map[int32]uint8, containerLen int, d *Decoder) { 5918 if v == nil { 5919 d.errorf("cannot decode into nil map[int32]uint8 given stream length: %v", containerLen) 5920 return 5921 } 5922 var mk int32 5923 var mv uint8 5924 hasLen := containerLen > 0 5925 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5926 d.mapElemKey() 5927 mk = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 5928 d.mapElemValue() 5929 mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) 5930 v[mk] = mv 5931 } 5932 } 5933 func (d *Decoder) fastpathDecMapInt32Uint64R(f *codecFnInfo, rv reflect.Value) { 5934 containerLen := d.mapStart(d.d.ReadMapStart()) 5935 if rv.Kind() == reflect.Ptr { 5936 vp, _ := rv2i(rv).(*map[int32]uint64) 5937 if *vp == nil { 5938 *vp = make(map[int32]uint64, decInferLen(containerLen, d.h.MaxInitLen, 12)) 5939 } 5940 if containerLen != 0 { 5941 fastpathTV.DecMapInt32Uint64L(*vp, containerLen, d) 5942 } 5943 } else if containerLen != 0 { 5944 fastpathTV.DecMapInt32Uint64L(rv2i(rv).(map[int32]uint64), containerLen, d) 5945 } 5946 d.mapEnd() 5947 } 5948 func (f fastpathT) DecMapInt32Uint64X(vp *map[int32]uint64, d *Decoder) { 5949 containerLen := d.mapStart(d.d.ReadMapStart()) 5950 if containerLen == containerLenNil { 5951 *vp = nil 5952 } else { 5953 if *vp == nil { 5954 *vp = make(map[int32]uint64, decInferLen(containerLen, d.h.MaxInitLen, 12)) 5955 } 5956 if containerLen != 0 { 5957 f.DecMapInt32Uint64L(*vp, containerLen, d) 5958 } 5959 d.mapEnd() 5960 } 5961 } 5962 func (fastpathT) DecMapInt32Uint64L(v map[int32]uint64, containerLen int, d *Decoder) { 5963 if v == nil { 5964 d.errorf("cannot decode into nil map[int32]uint64 given stream length: %v", containerLen) 5965 return 5966 } 5967 var mk int32 5968 var mv uint64 5969 hasLen := containerLen > 0 5970 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 5971 d.mapElemKey() 5972 mk = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 5973 d.mapElemValue() 5974 mv = d.d.DecodeUint64() 5975 v[mk] = mv 5976 } 5977 } 5978 func (d *Decoder) fastpathDecMapInt32IntR(f *codecFnInfo, rv reflect.Value) { 5979 containerLen := d.mapStart(d.d.ReadMapStart()) 5980 if rv.Kind() == reflect.Ptr { 5981 vp, _ := rv2i(rv).(*map[int32]int) 5982 if *vp == nil { 5983 *vp = make(map[int32]int, decInferLen(containerLen, d.h.MaxInitLen, 12)) 5984 } 5985 if containerLen != 0 { 5986 fastpathTV.DecMapInt32IntL(*vp, containerLen, d) 5987 } 5988 } else if containerLen != 0 { 5989 fastpathTV.DecMapInt32IntL(rv2i(rv).(map[int32]int), containerLen, d) 5990 } 5991 d.mapEnd() 5992 } 5993 func (f fastpathT) DecMapInt32IntX(vp *map[int32]int, d *Decoder) { 5994 containerLen := d.mapStart(d.d.ReadMapStart()) 5995 if containerLen == containerLenNil { 5996 *vp = nil 5997 } else { 5998 if *vp == nil { 5999 *vp = make(map[int32]int, decInferLen(containerLen, d.h.MaxInitLen, 12)) 6000 } 6001 if containerLen != 0 { 6002 f.DecMapInt32IntL(*vp, containerLen, d) 6003 } 6004 d.mapEnd() 6005 } 6006 } 6007 func (fastpathT) DecMapInt32IntL(v map[int32]int, containerLen int, d *Decoder) { 6008 if v == nil { 6009 d.errorf("cannot decode into nil map[int32]int given stream length: %v", containerLen) 6010 return 6011 } 6012 var mk int32 6013 var mv int 6014 hasLen := containerLen > 0 6015 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 6016 d.mapElemKey() 6017 mk = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 6018 d.mapElemValue() 6019 mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) 6020 v[mk] = mv 6021 } 6022 } 6023 func (d *Decoder) fastpathDecMapInt32Int32R(f *codecFnInfo, rv reflect.Value) { 6024 containerLen := d.mapStart(d.d.ReadMapStart()) 6025 if rv.Kind() == reflect.Ptr { 6026 vp, _ := rv2i(rv).(*map[int32]int32) 6027 if *vp == nil { 6028 *vp = make(map[int32]int32, decInferLen(containerLen, d.h.MaxInitLen, 8)) 6029 } 6030 if containerLen != 0 { 6031 fastpathTV.DecMapInt32Int32L(*vp, containerLen, d) 6032 } 6033 } else if containerLen != 0 { 6034 fastpathTV.DecMapInt32Int32L(rv2i(rv).(map[int32]int32), containerLen, d) 6035 } 6036 d.mapEnd() 6037 } 6038 func (f fastpathT) DecMapInt32Int32X(vp *map[int32]int32, d *Decoder) { 6039 containerLen := d.mapStart(d.d.ReadMapStart()) 6040 if containerLen == containerLenNil { 6041 *vp = nil 6042 } else { 6043 if *vp == nil { 6044 *vp = make(map[int32]int32, decInferLen(containerLen, d.h.MaxInitLen, 8)) 6045 } 6046 if containerLen != 0 { 6047 f.DecMapInt32Int32L(*vp, containerLen, d) 6048 } 6049 d.mapEnd() 6050 } 6051 } 6052 func (fastpathT) DecMapInt32Int32L(v map[int32]int32, containerLen int, d *Decoder) { 6053 if v == nil { 6054 d.errorf("cannot decode into nil map[int32]int32 given stream length: %v", containerLen) 6055 return 6056 } 6057 var mk int32 6058 var mv int32 6059 hasLen := containerLen > 0 6060 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 6061 d.mapElemKey() 6062 mk = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 6063 d.mapElemValue() 6064 mv = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 6065 v[mk] = mv 6066 } 6067 } 6068 func (d *Decoder) fastpathDecMapInt32Float64R(f *codecFnInfo, rv reflect.Value) { 6069 containerLen := d.mapStart(d.d.ReadMapStart()) 6070 if rv.Kind() == reflect.Ptr { 6071 vp, _ := rv2i(rv).(*map[int32]float64) 6072 if *vp == nil { 6073 *vp = make(map[int32]float64, decInferLen(containerLen, d.h.MaxInitLen, 12)) 6074 } 6075 if containerLen != 0 { 6076 fastpathTV.DecMapInt32Float64L(*vp, containerLen, d) 6077 } 6078 } else if containerLen != 0 { 6079 fastpathTV.DecMapInt32Float64L(rv2i(rv).(map[int32]float64), containerLen, d) 6080 } 6081 d.mapEnd() 6082 } 6083 func (f fastpathT) DecMapInt32Float64X(vp *map[int32]float64, d *Decoder) { 6084 containerLen := d.mapStart(d.d.ReadMapStart()) 6085 if containerLen == containerLenNil { 6086 *vp = nil 6087 } else { 6088 if *vp == nil { 6089 *vp = make(map[int32]float64, decInferLen(containerLen, d.h.MaxInitLen, 12)) 6090 } 6091 if containerLen != 0 { 6092 f.DecMapInt32Float64L(*vp, containerLen, d) 6093 } 6094 d.mapEnd() 6095 } 6096 } 6097 func (fastpathT) DecMapInt32Float64L(v map[int32]float64, containerLen int, d *Decoder) { 6098 if v == nil { 6099 d.errorf("cannot decode into nil map[int32]float64 given stream length: %v", containerLen) 6100 return 6101 } 6102 var mk int32 6103 var mv float64 6104 hasLen := containerLen > 0 6105 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 6106 d.mapElemKey() 6107 mk = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 6108 d.mapElemValue() 6109 mv = d.d.DecodeFloat64() 6110 v[mk] = mv 6111 } 6112 } 6113 func (d *Decoder) fastpathDecMapInt32BoolR(f *codecFnInfo, rv reflect.Value) { 6114 containerLen := d.mapStart(d.d.ReadMapStart()) 6115 if rv.Kind() == reflect.Ptr { 6116 vp, _ := rv2i(rv).(*map[int32]bool) 6117 if *vp == nil { 6118 *vp = make(map[int32]bool, decInferLen(containerLen, d.h.MaxInitLen, 5)) 6119 } 6120 if containerLen != 0 { 6121 fastpathTV.DecMapInt32BoolL(*vp, containerLen, d) 6122 } 6123 } else if containerLen != 0 { 6124 fastpathTV.DecMapInt32BoolL(rv2i(rv).(map[int32]bool), containerLen, d) 6125 } 6126 d.mapEnd() 6127 } 6128 func (f fastpathT) DecMapInt32BoolX(vp *map[int32]bool, d *Decoder) { 6129 containerLen := d.mapStart(d.d.ReadMapStart()) 6130 if containerLen == containerLenNil { 6131 *vp = nil 6132 } else { 6133 if *vp == nil { 6134 *vp = make(map[int32]bool, decInferLen(containerLen, d.h.MaxInitLen, 5)) 6135 } 6136 if containerLen != 0 { 6137 f.DecMapInt32BoolL(*vp, containerLen, d) 6138 } 6139 d.mapEnd() 6140 } 6141 } 6142 func (fastpathT) DecMapInt32BoolL(v map[int32]bool, containerLen int, d *Decoder) { 6143 if v == nil { 6144 d.errorf("cannot decode into nil map[int32]bool given stream length: %v", containerLen) 6145 return 6146 } 6147 var mk int32 6148 var mv bool 6149 hasLen := containerLen > 0 6150 for j := 0; d.containerNext(j, containerLen, hasLen); j++ { 6151 d.mapElemKey() 6152 mk = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) 6153 d.mapElemValue() 6154 mv = d.d.DecodeBool() 6155 v[mk] = mv 6156 } 6157 }