From 03a656619bb2e6daa39d3eee8b5b252843792d9c Mon Sep 17 00:00:00 2001 From: marvzhang Date: Fri, 15 May 2020 10:41:38 +0800 Subject: [PATCH] disable es logging --- backend/services/task.go | 30 +- .../vendor/github.com/pkg/errors/.travis.yml | 11 +- .../vendor/github.com/pkg/errors/README.md | 11 +- .../vendor/github.com/pkg/errors/errors.go | 8 +- backend/vendor/github.com/pkg/errors/stack.go | 58 +- backend/vendor/github.com/ugorji/go/LICENSE | 22 - .../vendor/github.com/ugorji/go/codec/0doc.go | 227 - .../github.com/ugorji/go/codec/README.md | 207 - .../vendor/github.com/ugorji/go/codec/binc.go | 50 +- .../github.com/ugorji/go/codec/build.sh | 74 +- .../vendor/github.com/ugorji/go/codec/cbor.go | 26 +- .../github.com/ugorji/go/codec/decode.go | 292 +- .../github.com/ugorji/go/codec/encode.go | 742 +- .../ugorji/go/codec/fast-path.generated.go | 29322 ++-------------- .../ugorji/go/codec/fast-path.go.tmpl | 168 +- .../ugorji/go/codec/gen-dec-array.go.tmpl | 29 +- .../ugorji/go/codec/gen-dec-map.go.tmpl | 30 +- .../ugorji/go/codec/gen-helper.generated.go | 166 +- .../ugorji/go/codec/gen-helper.go.tmpl | 150 +- .../ugorji/go/codec/gen.generated.go | 59 +- .../vendor/github.com/ugorji/go/codec/gen.go | 656 +- .../github.com/ugorji/go/codec/helper.go | 346 +- .../ugorji/go/codec/helper_not_unsafe.go | 6 +- .../ugorji/go/codec/helper_unsafe.go | 12 +- .../vendor/github.com/ugorji/go/codec/json.go | 568 +- .../github.com/ugorji/go/codec/msgpack.go | 64 +- .../github.com/ugorji/go/codec/simple.go | 66 +- backend/vendor/golang.org/x/net/html/const.go | 1 - .../vendor/golang.org/x/net/html/foreign.go | 1 - backend/vendor/golang.org/x/net/html/node.go | 5 + backend/vendor/golang.org/x/net/html/parse.go | 298 +- .../vendor/golang.org/x/net/html/render.go | 34 +- backend/vendor/golang.org/x/net/html/token.go | 9 +- .../golang.org/x/net/internal/socks/socks.go | 2 +- backend/vendor/modules.txt | 48 +- 35 files changed, 4954 insertions(+), 28844 deletions(-) delete mode 100644 backend/vendor/github.com/ugorji/go/LICENSE delete mode 100644 backend/vendor/github.com/ugorji/go/codec/0doc.go delete mode 100644 backend/vendor/github.com/ugorji/go/codec/README.md diff --git a/backend/services/task.go b/backend/services/task.go index 16278d24..f7cb51ec 100644 --- a/backend/services/task.go +++ b/backend/services/task.go @@ -166,11 +166,11 @@ func SetEnv(cmd *exec.Cmd, envs []model.Env, task model.Task, spider model.Spide return cmd } -func SetLogConfig(wg *sync.WaitGroup, cmd *exec.Cmd, t model.Task, u model.User) error { +func SetLogConfig(wg *sync.WaitGroup, cmd *exec.Cmd, t model.Task, u model.User) error { - esChan := make(chan string, 1) - esClientStr := viper.GetString("setting.esClient") - spiderLogIndex := viper.GetString("setting.spiderLogIndex") + //esChan := make(chan string, 1) + //esClientStr := viper.GetString("setting.esClient") + //spiderLogIndex := viper.GetString("setting.spiderLogIndex") // get stdout reader stdout, err := cmd.StdoutPipe() readerStdout := bufio.NewReader(stdout) @@ -217,7 +217,7 @@ func SetLogConfig(wg *sync.WaitGroup, cmd *exec.Cmd, t model.Task, u model.User // read stdout go func() { - defer wg.Done() + //defer wg.Done() for { line, err := readerStdout.ReadString('\n') if err != nil { @@ -234,10 +234,10 @@ func SetLogConfig(wg *sync.WaitGroup, cmd *exec.Cmd, t model.Task, u model.User Ts: time.Now(), ExpireTs: time.Now().Add(time.Duration(expireDuration) * time.Second), } - esChan <- l.Message - if esClientStr != "" { - go database.WriteMsgToES(time.Now(), esChan, spiderLogIndex) - } + //esChan <- l.Message + //if esClientStr != "" { + // go database.WriteMsgToES(time.Now(), esChan, spiderLogIndex) + //} logs = append(logs, l) } @@ -245,7 +245,7 @@ func SetLogConfig(wg *sync.WaitGroup, cmd *exec.Cmd, t model.Task, u model.User // read stderr go func() { - defer wg.Done() + //defer wg.Done() for { line, err := readerStderr.ReadString('\n') if err != nil { @@ -262,15 +262,15 @@ func SetLogConfig(wg *sync.WaitGroup, cmd *exec.Cmd, t model.Task, u model.User Ts: time.Now(), ExpireTs: time.Now().Add(time.Duration(expireDuration) * time.Second), } - esChan <- l.Message - if esClientStr != "" { - go database.WriteMsgToES(time.Now(), esChan, spiderLogIndex) - } + //esChan <- l.Message + //if esClientStr != "" { + // go database.WriteMsgToES(time.Now(), esChan, spiderLogIndex) + //} logs = append(logs, l) } }() - wg.Wait() + //wg.Wait() return nil } diff --git a/backend/vendor/github.com/pkg/errors/.travis.yml b/backend/vendor/github.com/pkg/errors/.travis.yml index d4b92663..9159de03 100644 --- a/backend/vendor/github.com/pkg/errors/.travis.yml +++ b/backend/vendor/github.com/pkg/errors/.travis.yml @@ -1,15 +1,10 @@ language: go go_import_path: github.com/pkg/errors go: - - 1.4.x - - 1.5.x - - 1.6.x - - 1.7.x - - 1.8.x - - 1.9.x - - 1.10.x - 1.11.x + - 1.12.x + - 1.13.x - tip script: - - go test -v ./... + - make check diff --git a/backend/vendor/github.com/pkg/errors/README.md b/backend/vendor/github.com/pkg/errors/README.md index 6483ba2a..54dfdcb1 100644 --- a/backend/vendor/github.com/pkg/errors/README.md +++ b/backend/vendor/github.com/pkg/errors/README.md @@ -41,11 +41,18 @@ default: [Read the package documentation for more information](https://godoc.org/github.com/pkg/errors). +## Roadmap + +With the upcoming [Go2 error proposals](https://go.googlesource.com/proposal/+/master/design/go2draft.md) this package is moving into maintenance mode. The roadmap for a 1.0 release is as follows: + +- 0.9. Remove pre Go 1.9 and Go 1.10 support, address outstanding pull requests (if possible) +- 1.0. Final release. + ## Contributing -We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high. +Because of the Go2 errors changes, this package is not accepting proposals for new functionality. With that said, we welcome pull requests, bug fixes and issue reports. -Before proposing a change, please discuss your change by raising an issue. +Before sending a PR, please discuss your change by raising an issue. ## License diff --git a/backend/vendor/github.com/pkg/errors/errors.go b/backend/vendor/github.com/pkg/errors/errors.go index 7421f326..161aea25 100644 --- a/backend/vendor/github.com/pkg/errors/errors.go +++ b/backend/vendor/github.com/pkg/errors/errors.go @@ -82,7 +82,7 @@ // // if err, ok := err.(stackTracer); ok { // for _, f := range err.StackTrace() { -// fmt.Printf("%+s:%d", f) +// fmt.Printf("%+s:%d\n", f, f) // } // } // @@ -159,6 +159,9 @@ type withStack struct { func (w *withStack) Cause() error { return w.error } +// Unwrap provides compatibility for Go 1.13 error chains. +func (w *withStack) Unwrap() error { return w.error } + func (w *withStack) Format(s fmt.State, verb rune) { switch verb { case 'v': @@ -241,6 +244,9 @@ type withMessage struct { func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() } func (w *withMessage) Cause() error { return w.cause } +// Unwrap provides compatibility for Go 1.13 error chains. +func (w *withMessage) Unwrap() error { return w.cause } + func (w *withMessage) Format(s fmt.State, verb rune) { switch verb { case 'v': diff --git a/backend/vendor/github.com/pkg/errors/stack.go b/backend/vendor/github.com/pkg/errors/stack.go index 2874a048..779a8348 100644 --- a/backend/vendor/github.com/pkg/errors/stack.go +++ b/backend/vendor/github.com/pkg/errors/stack.go @@ -5,10 +5,13 @@ import ( "io" "path" "runtime" + "strconv" "strings" ) // Frame represents a program counter inside a stack frame. +// For historical reasons if Frame is interpreted as a uintptr +// its value represents the program counter + 1. type Frame uintptr // pc returns the program counter for this frame; @@ -37,6 +40,15 @@ func (f Frame) line() int { return line } +// name returns the name of this function, if known. +func (f Frame) name() string { + fn := runtime.FuncForPC(f.pc()) + if fn == nil { + return "unknown" + } + return fn.Name() +} + // Format formats the frame according to the fmt.Formatter interface. // // %s source file @@ -54,22 +66,16 @@ func (f Frame) Format(s fmt.State, verb rune) { case 's': switch { case s.Flag('+'): - pc := f.pc() - fn := runtime.FuncForPC(pc) - if fn == nil { - io.WriteString(s, "unknown") - } else { - file, _ := fn.FileLine(pc) - fmt.Fprintf(s, "%s\n\t%s", fn.Name(), file) - } + io.WriteString(s, f.name()) + io.WriteString(s, "\n\t") + io.WriteString(s, f.file()) default: io.WriteString(s, path.Base(f.file())) } case 'd': - fmt.Fprintf(s, "%d", f.line()) + io.WriteString(s, strconv.Itoa(f.line())) case 'n': - name := runtime.FuncForPC(f.pc()).Name() - io.WriteString(s, funcname(name)) + io.WriteString(s, funcname(f.name())) case 'v': f.Format(s, 's') io.WriteString(s, ":") @@ -77,6 +83,16 @@ func (f Frame) Format(s fmt.State, verb rune) { } } +// MarshalText formats a stacktrace Frame as a text string. The output is the +// same as that of fmt.Sprintf("%+v", f), but without newlines or tabs. +func (f Frame) MarshalText() ([]byte, error) { + name := f.name() + if name == "unknown" { + return []byte(name), nil + } + return []byte(fmt.Sprintf("%s %s:%d", name, f.file(), f.line())), nil +} + // StackTrace is stack of Frames from innermost (newest) to outermost (oldest). type StackTrace []Frame @@ -94,18 +110,32 @@ func (st StackTrace) Format(s fmt.State, verb rune) { switch { case s.Flag('+'): for _, f := range st { - fmt.Fprintf(s, "\n%+v", f) + io.WriteString(s, "\n") + f.Format(s, verb) } case s.Flag('#'): fmt.Fprintf(s, "%#v", []Frame(st)) default: - fmt.Fprintf(s, "%v", []Frame(st)) + st.formatSlice(s, verb) } case 's': - fmt.Fprintf(s, "%s", []Frame(st)) + st.formatSlice(s, verb) } } +// formatSlice will format this StackTrace into the given buffer as a slice of +// Frame, only valid when called with '%s' or '%v'. +func (st StackTrace) formatSlice(s fmt.State, verb rune) { + io.WriteString(s, "[") + for i, f := range st { + if i > 0 { + io.WriteString(s, " ") + } + f.Format(s, verb) + } + io.WriteString(s, "]") +} + // stack represents a stack of program counters. type stack []uintptr diff --git a/backend/vendor/github.com/ugorji/go/LICENSE b/backend/vendor/github.com/ugorji/go/LICENSE deleted file mode 100644 index 95a0f054..00000000 --- a/backend/vendor/github.com/ugorji/go/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2012-2015 Ugorji Nwoke. -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/backend/vendor/github.com/ugorji/go/codec/0doc.go b/backend/vendor/github.com/ugorji/go/codec/0doc.go deleted file mode 100644 index 295ee346..00000000 --- a/backend/vendor/github.com/ugorji/go/codec/0doc.go +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a MIT license found in the LICENSE file. - -/* -Package codec provides a -High Performance, Feature-Rich Idiomatic Go 1.4+ codec/encoding library -for binc, msgpack, cbor, json. - -Supported Serialization formats are: - - - msgpack: https://github.com/msgpack/msgpack - - binc: http://github.com/ugorji/binc - - cbor: http://cbor.io http://tools.ietf.org/html/rfc7049 - - json: http://json.org http://tools.ietf.org/html/rfc7159 - - simple: - -To install: - - go get github.com/ugorji/go/codec - -This package will carefully use 'unsafe' for performance reasons in specific places. -You can build without unsafe use by passing the safe or appengine tag -i.e. 'go install -tags=safe ...'. Note that unsafe is only supported for the last 3 -go sdk versions e.g. current go release is go 1.9, so we support unsafe use only from -go 1.7+ . This is because supporting unsafe requires knowledge of implementation details. - -For detailed usage information, read the primer at http://ugorji.net/blog/go-codec-primer . - -The idiomatic Go support is as seen in other encoding packages in -the standard library (ie json, xml, gob, etc). - -Rich Feature Set includes: - - - Simple but extremely powerful and feature-rich API - - Support for go1.4 and above, while selectively using newer APIs for later releases - - Excellent code coverage ( > 90% ) - - Very High Performance. - Our extensive benchmarks show us outperforming Gob, Json, Bson, etc by 2-4X. - - Careful selected use of 'unsafe' for targeted performance gains. - 100% mode exists where 'unsafe' is not used at all. - - Lock-free (sans mutex) concurrency for scaling to 100's of cores - - In-place updates during decode, with option to zero value in maps and slices prior to decode - - Coerce types where appropriate - e.g. decode an int in the stream into a float, decode numbers from formatted strings, etc - - Corner Cases: - Overflows, nil maps/slices, nil values in streams are handled correctly - - Standard field renaming via tags - - Support for omitting empty fields during an encoding - - Encoding from any value and decoding into pointer to any value - (struct, slice, map, primitives, pointers, interface{}, etc) - - Extensions to support efficient encoding/decoding of any named types - - Support encoding.(Binary|Text)(M|Unm)arshaler interfaces - - Support IsZero() bool to determine if a value is a zero value. - Analogous to time.Time.IsZero() bool. - - Decoding without a schema (into a interface{}). - Includes Options to configure what specific map or slice type to use - when decoding an encoded list or map into a nil interface{} - - Mapping a non-interface type to an interface, so we can decode appropriately - into any interface type with a correctly configured non-interface value. - - Encode a struct as an array, and decode struct from an array in the data stream - - Option to encode struct keys as numbers (instead of strings) - (to support structured streams with fields encoded as numeric codes) - - Comprehensive support for anonymous fields - - Fast (no-reflection) encoding/decoding of common maps and slices - - Code-generation for faster performance. - - Support binary (e.g. messagepack, cbor) and text (e.g. json) formats - - Support indefinite-length formats to enable true streaming - (for formats which support it e.g. json, cbor) - - Support canonical encoding, where a value is ALWAYS encoded as same sequence of bytes. - This mostly applies to maps, where iteration order is non-deterministic. - - NIL in data stream decoded as zero value - - Never silently skip data when decoding. - User decides whether to return an error or silently skip data when keys or indexes - in the data stream do not map to fields in the struct. - - Detect and error when encoding a cyclic reference (instead of stack overflow shutdown) - - Encode/Decode from/to chan types (for iterative streaming support) - - Drop-in replacement for encoding/json. `json:` key in struct tag supported. - - Provides a RPC Server and Client Codec for net/rpc communication protocol. - - Handle unique idiosyncrasies of codecs e.g. - - For messagepack, configure how ambiguities in handling raw bytes are resolved - - For messagepack, provide rpc server/client codec to support - msgpack-rpc protocol defined at: - https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md - -Extension Support - -Users can register a function to handle the encoding or decoding of -their custom types. - -There are no restrictions on what the custom type can be. Some examples: - - type BisSet []int - type BitSet64 uint64 - type UUID string - type MyStructWithUnexportedFields struct { a int; b bool; c []int; } - type GifImage struct { ... } - -As an illustration, MyStructWithUnexportedFields would normally be -encoded as an empty map because it has no exported fields, while UUID -would be encoded as a string. However, with extension support, you can -encode any of these however you like. - -Custom Encoding and Decoding - -This package maintains symmetry in the encoding and decoding halfs. -We determine how to encode or decode by walking this decision tree - - - is type a codec.Selfer? - - is there an extension registered for the type? - - is format binary, and is type a encoding.BinaryMarshaler and BinaryUnmarshaler? - - is format specifically json, and is type a encoding/json.Marshaler and Unmarshaler? - - is format text-based, and type an encoding.TextMarshaler and TextUnmarshaler? - - else we use a pair of functions based on the "kind" of the type e.g. map, slice, int64, etc - -This symmetry is important to reduce chances of issues happening because the -encoding and decoding sides are out of sync e.g. decoded via very specific -encoding.TextUnmarshaler but encoded via kind-specific generalized mode. - -Consequently, if a type only defines one-half of the symmetry -(e.g. it implements UnmarshalJSON() but not MarshalJSON() ), -then that type doesn't satisfy the check and we will continue walking down the -decision tree. - -RPC - -RPC Client and Server Codecs are implemented, so the codecs can be used -with the standard net/rpc package. - -Usage - -The Handle is SAFE for concurrent READ, but NOT SAFE for concurrent modification. - -The Encoder and Decoder are NOT safe for concurrent use. - -Consequently, the usage model is basically: - - - Create and initialize the Handle before any use. - Once created, DO NOT modify it. - - Multiple Encoders or Decoders can now use the Handle concurrently. - They only read information off the Handle (never write). - - However, each Encoder or Decoder MUST not be used concurrently - - To re-use an Encoder/Decoder, call Reset(...) on it first. - This allows you use state maintained on the Encoder/Decoder. - -Sample usage model: - - // create and configure Handle - var ( - bh codec.BincHandle - mh codec.MsgpackHandle - ch codec.CborHandle - ) - - mh.MapType = reflect.TypeOf(map[string]interface{}(nil)) - - // configure extensions - // e.g. for msgpack, define functions and enable Time support for tag 1 - // mh.SetExt(reflect.TypeOf(time.Time{}), 1, myExt) - - // create and use decoder/encoder - var ( - r io.Reader - w io.Writer - b []byte - h = &bh // or mh to use msgpack - ) - - dec = codec.NewDecoder(r, h) - dec = codec.NewDecoderBytes(b, h) - err = dec.Decode(&v) - - enc = codec.NewEncoder(w, h) - enc = codec.NewEncoderBytes(&b, h) - err = enc.Encode(v) - - //RPC Server - go func() { - for { - conn, err := listener.Accept() - rpcCodec := codec.GoRpc.ServerCodec(conn, h) - //OR rpcCodec := codec.MsgpackSpecRpc.ServerCodec(conn, h) - rpc.ServeCodec(rpcCodec) - } - }() - - //RPC Communication (client side) - conn, err = net.Dial("tcp", "localhost:5555") - rpcCodec := codec.GoRpc.ClientCodec(conn, h) - //OR rpcCodec := codec.MsgpackSpecRpc.ClientCodec(conn, h) - client := rpc.NewClientWithCodec(rpcCodec) - -Running Tests - -To run tests, use the following: - - go test - -To run the full suite of tests, use the following: - - go test -tags alltests -run Suite - -You can run the tag 'safe' to run tests or build in safe mode. e.g. - - go test -tags safe -run Json - go test -tags "alltests safe" -run Suite - -Running Benchmarks - -Please see http://github.com/ugorji/go-codec-bench . - -Caveats - -Struct fields matching the following are ignored during encoding and decoding - - struct tag value set to - - - func, complex numbers, unsafe pointers - - unexported and not embedded - - unexported and embedded and not struct kind - - unexported and embedded pointers (from go1.10) - -Every other field in a struct will be encoded/decoded. - -Embedded fields are encoded as if they exist in the top-level struct, -with some caveats. See Encode documentation. - -*/ -package codec - diff --git a/backend/vendor/github.com/ugorji/go/codec/README.md b/backend/vendor/github.com/ugorji/go/codec/README.md deleted file mode 100644 index 8aa68f5b..00000000 --- a/backend/vendor/github.com/ugorji/go/codec/README.md +++ /dev/null @@ -1,207 +0,0 @@ -# Codec - -High Performance, Feature-Rich Idiomatic Go codec/encoding library for -binc, msgpack, cbor, json. - -Supported Serialization formats are: - - - msgpack: https://github.com/msgpack/msgpack - - binc: http://github.com/ugorji/binc - - cbor: http://cbor.io http://tools.ietf.org/html/rfc7049 - - json: http://json.org http://tools.ietf.org/html/rfc7159 - - simple: - -To install: - - go get github.com/ugorji/go/codec - -This package will carefully use 'unsafe' for performance reasons in specific places. -You can build without unsafe use by passing the safe or appengine tag -i.e. 'go install -tags=safe ...'. Note that unsafe is only supported for the last 3 -go sdk versions e.g. current go release is go 1.9, so we support unsafe use only from -go 1.7+ . This is because supporting unsafe requires knowledge of implementation details. - -Online documentation: http://godoc.org/github.com/ugorji/go/codec -Detailed Usage/How-to Primer: http://ugorji.net/blog/go-codec-primer - -The idiomatic Go support is as seen in other encoding packages in -the standard library (ie json, xml, gob, etc). - -Rich Feature Set includes: - - - Simple but extremely powerful and feature-rich API - - Support for go1.4 and above, while selectively using newer APIs for later releases - - Excellent code coverage ( > 90% ) - - Very High Performance. - Our extensive benchmarks show us outperforming Gob, Json, Bson, etc by 2-4X. - - Careful selected use of 'unsafe' for targeted performance gains. - 100% mode exists where 'unsafe' is not used at all. - - Lock-free (sans mutex) concurrency for scaling to 100's of cores - - In-place updates during decode, with option to zero the value in maps and slices prior to decode - - Coerce types where appropriate - e.g. decode an int in the stream into a float, decode numbers from formatted strings, etc - - Corner Cases: - Overflows, nil maps/slices, nil values in streams are handled correctly - - Standard field renaming via tags - - Support for omitting empty fields during an encoding - - Encoding from any value and decoding into pointer to any value - (struct, slice, map, primitives, pointers, interface{}, etc) - - Extensions to support efficient encoding/decoding of any named types - - Support encoding.(Binary|Text)(M|Unm)arshaler interfaces - - Support IsZero() bool to determine if a value is a zero value. - Analogous to time.Time.IsZero() bool. - - Decoding without a schema (into a interface{}). - Includes Options to configure what specific map or slice type to use - when decoding an encoded list or map into a nil interface{} - - Mapping a non-interface type to an interface, so we can decode appropriately - into any interface type with a correctly configured non-interface value. - - Encode a struct as an array, and decode struct from an array in the data stream - - Option to encode struct keys as numbers (instead of strings) - (to support structured streams with fields encoded as numeric codes) - - Comprehensive support for anonymous fields - - Fast (no-reflection) encoding/decoding of common maps and slices - - Code-generation for faster performance. - - Support binary (e.g. messagepack, cbor) and text (e.g. json) formats - - Support indefinite-length formats to enable true streaming - (for formats which support it e.g. json, cbor) - - Support canonical encoding, where a value is ALWAYS encoded as same sequence of bytes. - This mostly applies to maps, where iteration order is non-deterministic. - - NIL in data stream decoded as zero value - - Never silently skip data when decoding. - User decides whether to return an error or silently skip data when keys or indexes - in the data stream do not map to fields in the struct. - - Encode/Decode from/to chan types (for iterative streaming support) - - Drop-in replacement for encoding/json. `json:` key in struct tag supported. - - Provides a RPC Server and Client Codec for net/rpc communication protocol. - - Handle unique idiosyncrasies of codecs e.g. - - For messagepack, configure how ambiguities in handling raw bytes are resolved - - For messagepack, provide rpc server/client codec to support - msgpack-rpc protocol defined at: - https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md - -## Extension Support - -Users can register a function to handle the encoding or decoding of -their custom types. - -There are no restrictions on what the custom type can be. Some examples: - - type BisSet []int - type BitSet64 uint64 - type UUID string - type MyStructWithUnexportedFields struct { a int; b bool; c []int; } - type GifImage struct { ... } - -As an illustration, MyStructWithUnexportedFields would normally be -encoded as an empty map because it has no exported fields, while UUID -would be encoded as a string. However, with extension support, you can -encode any of these however you like. - -## Custom Encoding and Decoding - -This package maintains symmetry in the encoding and decoding halfs. -We determine how to encode or decode by walking this decision tree - - - is type a codec.Selfer? - - is there an extension registered for the type? - - is format binary, and is type a encoding.BinaryMarshaler and BinaryUnmarshaler? - - is format specifically json, and is type a encoding/json.Marshaler and Unmarshaler? - - is format text-based, and type an encoding.TextMarshaler and TextUnmarshaler? - - else we use a pair of functions based on the "kind" of the type e.g. map, slice, int64, etc - -This symmetry is important to reduce chances of issues happening because the -encoding and decoding sides are out of sync e.g. decoded via very specific -encoding.TextUnmarshaler but encoded via kind-specific generalized mode. - -Consequently, if a type only defines one-half of the symmetry -(e.g. it implements UnmarshalJSON() but not MarshalJSON() ), -then that type doesn't satisfy the check and we will continue walking down the -decision tree. - -## RPC - -RPC Client and Server Codecs are implemented, so the codecs can be used -with the standard net/rpc package. - -## Usage - -Typical usage model: - - // create and configure Handle - var ( - bh codec.BincHandle - mh codec.MsgpackHandle - ch codec.CborHandle - ) - - mh.MapType = reflect.TypeOf(map[string]interface{}(nil)) - - // configure extensions - // e.g. for msgpack, define functions and enable Time support for tag 1 - // mh.SetExt(reflect.TypeOf(time.Time{}), 1, myExt) - - // create and use decoder/encoder - var ( - r io.Reader - w io.Writer - b []byte - h = &bh // or mh to use msgpack - ) - - dec = codec.NewDecoder(r, h) - dec = codec.NewDecoderBytes(b, h) - err = dec.Decode(&v) - - enc = codec.NewEncoder(w, h) - enc = codec.NewEncoderBytes(&b, h) - err = enc.Encode(v) - - //RPC Server - go func() { - for { - conn, err := listener.Accept() - rpcCodec := codec.GoRpc.ServerCodec(conn, h) - //OR rpcCodec := codec.MsgpackSpecRpc.ServerCodec(conn, h) - rpc.ServeCodec(rpcCodec) - } - }() - - //RPC Communication (client side) - conn, err = net.Dial("tcp", "localhost:5555") - rpcCodec := codec.GoRpc.ClientCodec(conn, h) - //OR rpcCodec := codec.MsgpackSpecRpc.ClientCodec(conn, h) - client := rpc.NewClientWithCodec(rpcCodec) - -## Running Tests - -To run tests, use the following: - - go test - -To run the full suite of tests, use the following: - - go test -tags alltests -run Suite - -You can run the tag 'safe' to run tests or build in safe mode. e.g. - - go test -tags safe -run Json - go test -tags "alltests safe" -run Suite - -## Running Benchmarks - -Please see http://github.com/ugorji/go-codec-bench . - -## Caveats - -Struct fields matching the following are ignored during encoding and decoding - - - struct tag value set to - - - func, complex numbers, unsafe pointers - - unexported and not embedded - - unexported and embedded and not struct kind - - unexported and embedded pointers (from go1.10) - -Every other field in a struct will be encoded/decoded. - -Embedded fields are encoded as if they exist in the top-level struct, -with some caveats. See Encode documentation. diff --git a/backend/vendor/github.com/ugorji/go/codec/binc.go b/backend/vendor/github.com/ugorji/go/codec/binc.go index c9877ac7..333d9cea 100644 --- a/backend/vendor/github.com/ugorji/go/codec/binc.go +++ b/backend/vendor/github.com/ugorji/go/codec/binc.go @@ -100,6 +100,7 @@ func bincdesc(vd, vs byte) string { } type bincEncDriver struct { + encDriverNoopContainerWriter e *Encoder h *BincHandle w *encWriterSwitch @@ -107,10 +108,10 @@ type bincEncDriver struct { b [16]byte // scratch, used for encoding numbers - bigendian style s uint16 // symbols sequencer // c containerState - encDriverTrackContainerWriter + // encDriverTrackContainerWriter noBuiltInTypes // encNoSeparator - _ [1]uint64 // padding + // _ [1]uint64 // padding } func (e *bincEncDriver) EncodeNil() { @@ -236,12 +237,10 @@ func (e *bincEncDriver) encodeExtPreamble(xtag byte, length int) { func (e *bincEncDriver) WriteArrayStart(length int) { e.encLen(bincVdArray<<4, uint64(length)) - e.c = containerArrayStart } func (e *bincEncDriver) WriteMapStart(length int) { e.encLen(bincVdMap<<4, uint64(length)) - e.c = containerMapStart } func (e *bincEncDriver) EncodeSymbol(v string) { @@ -308,20 +307,8 @@ func (e *bincEncDriver) EncodeSymbol(v string) { } } -func (e *bincEncDriver) EncodeString(c charEncoding, v string) { - if e.c == containerMapKey && c == cUTF8 && (e.h.AsSymbols == 0 || e.h.AsSymbols == 1) { - e.EncodeSymbol(v) - return - } - l := uint64(len(v)) - e.encBytesLen(c, l) - if l > 0 { - e.w.writestr(v) - } -} - func (e *bincEncDriver) EncodeStringEnc(c charEncoding, v string) { - if e.c == containerMapKey && c == cUTF8 && (e.h.AsSymbols == 0 || e.h.AsSymbols == 1) { + if e.e.c == containerMapKey && c == cUTF8 && (e.h.AsSymbols == 0 || e.h.AsSymbols == 1) { e.EncodeSymbol(v) return } @@ -333,18 +320,6 @@ func (e *bincEncDriver) EncodeStringEnc(c charEncoding, v string) { } -func (e *bincEncDriver) EncodeStringBytes(c charEncoding, v []byte) { - if v == nil { - e.EncodeNil() - return - } - l := uint64(len(v)) - e.encBytesLen(c, l) - if l > 0 { - e.w.writeb(v) - } -} - func (e *bincEncDriver) EncodeStringBytesRaw(v []byte) { if v == nil { e.EncodeNil() @@ -409,7 +384,7 @@ type bincDecDriver struct { bd byte vd byte vs byte - _ [3]byte // padding + // _ [3]byte // padding // linear searching on this slice is ok, // because we typically expect < 32 symbols in each stream. s []bincDecSymbol @@ -1007,7 +982,7 @@ type BincHandle struct { // - n: none // - a: all: same as m, s, ... - // _ [1]uint64 // padding + _ [1]uint64 // padding (cache-aligned) } // Name returns the name of the handle: binc @@ -1015,26 +990,25 @@ func (h *BincHandle) Name() string { return "binc" } // SetBytesExt sets an extension func (h *BincHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) { - return h.SetExt(rt, tag, &extWrapper{ext, interfaceExtFailer{}}) + return h.SetExt(rt, tag, &bytesExtWrapper{BytesExt: ext}) } func (h *BincHandle) newEncDriver(e *Encoder) encDriver { - return &bincEncDriver{e: e, h: h, w: e.w} + return &bincEncDriver{e: e, h: h, w: e.w()} } func (h *BincHandle) newDecDriver(d *Decoder) decDriver { - return &bincDecDriver{d: d, h: h, r: d.r, br: d.bytes} + return &bincDecDriver{d: d, h: h, r: d.r(), br: d.bytes} } func (e *bincEncDriver) reset() { - e.w = e.e.w + e.w = e.e.w() e.s = 0 - e.c = 0 e.m = nil } func (d *bincDecDriver) reset() { - d.r, d.br = d.d.r, d.d.bytes + d.r, d.br = d.d.r(), d.d.bytes d.s = nil d.bd, d.bdRead, d.vd, d.vs = 0, false, 0, 0 } @@ -1173,7 +1147,7 @@ func bincDecodeTime(bs []byte) (tt time.Time, err error) { return } // In stdlib time.Parse, when a date is parsed without a zone name, it uses "" as zone name. - // However, we need name here, so it can be shown when time is printed. + // However, we need name here, so it can be shown when time is printf.d. // Zone name is in form: UTC-08:00. // Note that Go Libs do not give access to dst flag, so we ignore dst bits diff --git a/backend/vendor/github.com/ugorji/go/codec/build.sh b/backend/vendor/github.com/ugorji/go/codec/build.sh index c0853078..f1ba243e 100644 --- a/backend/vendor/github.com/ugorji/go/codec/build.sh +++ b/backend/vendor/github.com/ugorji/go/codec/build.sh @@ -116,60 +116,67 @@ run("fast-path.go.tmpl", "fast-path.generated.go") run("gen-helper.go.tmpl", "gen-helper.generated.go") run("mammoth-test.go.tmpl", "mammoth_generated_test.go") run("mammoth2-test.go.tmpl", "mammoth2_generated_test.go") +// run("sort-slice.go.tmpl", "sort-slice.generated.go") } EOF + sed -e 's+// __DO_NOT_REMOVE__NEEDED_FOR_REPLACING__IMPORT_PATH__FOR_CODEC_BENCH__+import . "github.com/ugorji/go/codec"+' \ + shared_test.go > bench/shared_test.go + # explicitly return 0 if this passes, else return 1 - go run -tags "notfastpath safe codecgen.exec" gen-from-tmpl.generated.go && - rm -f gen-from-tmpl.*generated.go && - return 0 - return 1 + go run -tags "prebuild" prebuild.go || return 1 + go run -tags "notfastpath safe codecgen.exec" gen-from-tmpl.generated.go || return 1 + rm -f gen-from-tmpl.*generated.go + return 0 } _codegenerators() { - if ! [[ $zforce || $(_ng "values_codecgen${zsfx}") ]]; then return 0; fi - - # Note: ensure you run the codecgen for this codebase/directory i.e. ./codecgen/codecgen + local c5="_generated_test.go" + local c7="$PWD/codecgen" + local c8="$c7/__codecgen" local c9="codecgen-scratch.go" - local c7="$zmydir/codecgen" + + if ! [[ $zforce || $(_ng "values_codecgen${c5}") ]]; then return 0; fi + + # Note: ensure you run the codecgen for this codebase/directory i.e. ./codecgen/codecgen true && echo "codecgen ... " && - if [[ $zforce || ! -f "$c7/codecgen" || "$c7/gen.go" -nt "$c7/codecgen" ]]; then - echo "rebuilding codecgen ... " && ( cd codecgen && go build -o codecgen ${zargs[*]} . ) + if [[ $zforce || ! -f "$c8" || "$c7/gen.go" -nt "$c8" ]]; then + echo "rebuilding codecgen ... " && ( cd codecgen && go build -o $c8 ${zargs[*]} . ) fi && - $c7/codecgen -rt codecgen -t 'codecgen generated' -o values_codecgen${zsfx} -d 19780 $zfin $zfin2 && + $c8 -rt codecgen -t 'codecgen generated' -o values_codecgen${c5} -d 19780 $zfin $zfin2 && cp mammoth2_generated_test.go $c9 && - $c7/codecgen -t '!notfastpath' -o mammoth2_codecgen${zsfx} -d 19781 mammoth2_generated_test.go && + $c8 -t 'codecgen,!notfastpath generated,!notfastpath' -o mammoth2_codecgen${c5} -d 19781 mammoth2_generated_test.go && rm -f $c9 && echo "generators done!" } _prebuild() { - echo "prebuild: zforce: $zforce , zexternal: $zexternal" - zmydir=`pwd` - zfin="test_values.generated.go" - zfin2="test_values_flex.generated.go" - zsfx="_generated_test.go" - # zpkg="ugorji.net/codec" - zpkg=${zmydir##*/src/} - zgobase=${zmydir%%/src/*} + echo "prebuild: zforce: $zforce" + local d="$PWD" + local zfin="test_values.generated.go" + local zfin2="test_values_flex.generated.go" + local zpkg="github.com/ugorji/go/codec" + # zpkg=${d##*/src/} + # zgobase=${d%%/src/*} # rm -f *_generated_test.go rm -f codecgen-*.go && _build && - cp $zmydir/values_test.go $zmydir/$zfin && - cp $zmydir/values_flex_test.go $zmydir/$zfin2 && + cp $d/values_test.go $d/$zfin && + cp $d/values_flex_test.go $d/$zfin2 && _codegenerators && if [[ "$(type -t _codegenerators_external )" = "function" ]]; then _codegenerators_external ; fi && if [[ $zforce ]]; then go install ${zargs[*]} .; fi && echo "prebuild done successfully" - rm -f $zmydir/$zfin $zmydir/$zfin2 + rm -f $d/$zfin $d/$zfin2 + # unset zfin zfin2 zpkg } _make() { + local makeforce=${zforce} zforce=1 - zexternal=1 (cd codecgen && go install ${zargs[*]} .) && _prebuild && go install ${zargs[*]} . - unset zforce zexternal + zforce=${makeforce} } _clean() { @@ -194,6 +201,7 @@ _release() { EOF # # go 1.6 and below kept giving memory errors on Mac OS X during SDK build or go run execution, # # that is fine, as we only explicitly test the last 3 releases and tip (2 years). + local makeforce=${zforce} zforce=1 for i in 1.10 1.11 1.12 master do @@ -210,7 +218,7 @@ EOF _tests "$@" if [[ "$?" != 0 ]]; then return 1; fi done - unset zforce + zforce=${makeforce} echo "++++++++ RELEASE TEST SUITES ALL PASSED ++++++++" } @@ -226,16 +234,19 @@ EOF _main() { if [[ -z "$1" ]]; then _usage; return 1; fi local x - unset zforce zexternal + local zforce + local zargs=() + local zverbose=() + local zbenchflags + # unset zforce zargs=() zbenchflags="" OPTIND=1 - while getopts ":ctmnrgupfvxlzdb:" flag + while getopts ":ctmnrgpfvlzdb:" flag do case "x$flag" in 'xf') zforce=1 ;; - 'xx') zexternal=1 ;; - 'xv') zverbose=1 ;; + 'xv') zverbose+=(1) ;; 'xl') zargs+=("-gcflags"); zargs+=("-l=4") ;; 'xn') zargs+=("-gcflags"); zargs+=("-m=2") ;; 'xd') zargs+=("-race") ;; @@ -251,13 +262,12 @@ _main() { 'xm') _make "$@" ;; 'xr') _release "$@" ;; 'xg') _go ;; - 'xu') _githubupdate ;; 'xp') _prebuild "$@" ;; 'xc') _clean "$@" ;; 'xz') _analyze "$@" ;; 'xb') _bench "$@" ;; esac - unset zforce zexternal + # unset zforce zargs zbenchflags } [ "." = `dirname $0` ] && _main "$@" diff --git a/backend/vendor/github.com/ugorji/go/codec/cbor.go b/backend/vendor/github.com/ugorji/go/codec/cbor.go index 7833f9d6..68c9b101 100644 --- a/backend/vendor/github.com/ugorji/go/codec/cbor.go +++ b/backend/vendor/github.com/ugorji/go/codec/cbor.go @@ -235,24 +235,10 @@ func (e *cborEncDriver) WriteArrayEnd() { } } -func (e *cborEncDriver) EncodeString(c charEncoding, v string) { - e.encStringBytesS(cborBaseString, v) -} - func (e *cborEncDriver) EncodeStringEnc(c charEncoding, v string) { e.encStringBytesS(cborBaseString, v) } -func (e *cborEncDriver) EncodeStringBytes(c charEncoding, v []byte) { - if v == nil { - e.EncodeNil() - } else if c == cRAW { - e.encStringBytesS(cborBaseBytes, stringView(v)) - } else { - e.encStringBytesS(cborBaseString, stringView(v)) - } -} - func (e *cborEncDriver) EncodeStringBytesRaw(v []byte) { if v == nil { e.EncodeNil() @@ -735,7 +721,7 @@ type CborHandle struct { // If unset, we encode time.Time using seconds past epoch. TimeRFC3339 bool - // _ [1]uint64 // padding + _ [1]uint64 // padding (cache-aligned) } // Name returns the name of the handle: cbor @@ -743,23 +729,23 @@ func (h *CborHandle) Name() string { return "cbor" } // SetInterfaceExt sets an extension func (h *CborHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) { - return h.SetExt(rt, tag, &extWrapper{bytesExtFailer{}, ext}) + return h.SetExt(rt, tag, &interfaceExtWrapper{InterfaceExt: ext}) } func (h *CborHandle) newEncDriver(e *Encoder) encDriver { - return &cborEncDriver{e: e, w: e.w, h: h} + return &cborEncDriver{e: e, w: e.w(), h: h} } func (h *CborHandle) newDecDriver(d *Decoder) decDriver { - return &cborDecDriver{d: d, h: h, r: d.r, br: d.bytes} + return &cborDecDriver{d: d, h: h, r: d.r(), br: d.bytes} } func (e *cborEncDriver) reset() { - e.w = e.e.w + e.w = e.e.w() } func (d *cborDecDriver) reset() { - d.r, d.br = d.d.r, d.d.bytes + d.r, d.br = d.d.r(), d.d.bytes d.bd, d.bdRead = 0, false } diff --git a/backend/vendor/github.com/ugorji/go/codec/decode.go b/backend/vendor/github.com/ugorji/go/codec/decode.go index 1f14e7a5..f9772369 100644 --- a/backend/vendor/github.com/ugorji/go/codec/decode.go +++ b/backend/vendor/github.com/ugorji/go/codec/decode.go @@ -24,7 +24,7 @@ const ( decDefMaxDepth = 1024 // maximum depth decDefSliceCap = 8 decDefChanCap = 64 // should be large, as cap cannot be expanded - decScratchByteArrayLen = cacheLineSize // + (8 * 2) // - (8 * 1) + decScratchByteArrayLen = cacheLineSize // - 5 // + (8 * 2) // - (8 * 1) ) var ( @@ -96,10 +96,6 @@ type decDriver interface { // kInterface will extract the detached byte slice if it has to pass it outside its realm. DecodeNaked() - // Deprecated: use DecodeInt64 and DecodeUint64 instead - // DecodeInt(bitsize uint8) (i int64) - // DecodeUint(bitsize uint8) (ui uint64) - DecodeInt64() (i int64) DecodeUint64() (ui uint64) @@ -125,17 +121,20 @@ type decDriver interface { DecodeTime() (t time.Time) ReadArrayStart() int - ReadArrayElem() ReadArrayEnd() ReadMapStart() int - ReadMapElemKey() - ReadMapElemValue() ReadMapEnd() reset() uncacheRead() } +type decDriverContainerTracker interface { + ReadArrayElem() + ReadMapElemKey() + ReadMapElemValue() +} + type decodeError struct { codecError pos int @@ -148,14 +147,15 @@ func (d decodeError) Error() string { type decDriverNoopContainerReader struct{} func (x decDriverNoopContainerReader) ReadArrayStart() (v int) { return } -func (x decDriverNoopContainerReader) ReadArrayElem() {} func (x decDriverNoopContainerReader) ReadArrayEnd() {} func (x decDriverNoopContainerReader) ReadMapStart() (v int) { return } -func (x decDriverNoopContainerReader) ReadMapElemKey() {} -func (x decDriverNoopContainerReader) ReadMapElemValue() {} func (x decDriverNoopContainerReader) ReadMapEnd() {} func (x decDriverNoopContainerReader) CheckBreak() (v bool) { return } +// func (x decDriverNoopContainerReader) ReadArrayElem() {} +// func (x decDriverNoopContainerReader) ReadMapElemKey() {} +// func (x decDriverNoopContainerReader) ReadMapElemValue() {} + // func (x decNoSeparator) uncacheRead() {} // DecodeOptions captures configuration options during decode. @@ -326,8 +326,8 @@ type ioDecReader struct { rr io.Reader br io.ByteScanner - x [scratchByteArrayLen]byte // for: get struct field name, swallow valueTypeBytes, etc - _ [1]uint64 // padding + x [scratchByteArrayLen + 8]byte // for: get struct field name, swallow valueTypeBytes, etc + // _ [1]uint64 // padding } func (z *ioDecReader) reset(r io.Reader) { @@ -549,6 +549,7 @@ func (z *ioDecReader) unreadn1() { type bufioDecReader struct { ioDecReaderCommon + _ uint64 // padding (cache-aligned) c uint // cursor buf []byte @@ -563,8 +564,6 @@ type bufioDecReader struct { calls uint16 // what depth in mustDecode are we in now. _ [6]uint8 // padding - - _ [1]uint64 // padding } func (z *bufioDecReader) reset(r io.Reader, bufsize int) { @@ -1407,7 +1406,6 @@ func decStructFieldKey(dd decDriver, keyType valueType, b *[decScratchByteArrayL func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { fti := f.ti dd := d.d - elemsep := d.esep sfn := structFieldNode{v: rv, update: true} ctyp := dd.ContainerType() var mf MissingFielder @@ -1417,24 +1415,19 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { mf = rv2i(rv.Addr()).(MissingFielder) } if ctyp == valueTypeMap { - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return } - d.depthIncr() tisfi := fti.sfiSort hasLen := containerLen >= 0 var rvkencname []byte for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if elemsep { - dd.ReadMapElemKey() - } + d.mapElemKey() rvkencname = decStructFieldKey(dd, fti.keyType, &d.b) - if elemsep { - dd.ReadMapElemValue() - } + d.mapElemValue() if k := fti.indexForEncName(rvkencname); k > -1 { si := tisfi[k] if dd.TryDecodeAsNil() { @@ -1461,15 +1454,13 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { } // keepAlive4StringView(rvkencnameB) // not needed, as reference is outside loop } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() } else if ctyp == valueTypeArray { - containerLen := dd.ReadArrayStart() + containerLen := d.arrayStart() if containerLen == 0 { - dd.ReadArrayEnd() + d.arrayEnd() return } - d.depthIncr() // Not much gain from doing it two ways for array. // Arrays are not used as much for structs. hasLen := containerLen >= 0 @@ -1482,9 +1473,7 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { checkbreak = true break } - if elemsep { - dd.ReadArrayElem() - } + d.arrayElem() if dd.TryDecodeAsNil() { si.setToZeroValue(rv) } else { @@ -1497,14 +1486,11 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { if (hasLen && j == containerLen) || (!hasLen && dd.CheckBreak()) { break } - if elemsep { - dd.ReadArrayElem() - } + d.arrayElem() d.structFieldNotFound(j, "") } } - dd.ReadArrayEnd() - d.depthDecr() + d.arrayEnd() } else { d.errorstr(errstrOnlyMapOrArrayCanDecodeIntoStruct) return @@ -1514,17 +1500,18 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { // A slice can be set from a map or array in stream. // This way, the order can be kept (as order is lost with map). - ti := f.ti - if f.seq == seqTypeChan && ti.chandir&uint8(reflect.SendDir) == 0 { + + frt := f.ti.rt + if f.seq == seqTypeChan && f.ti.chandir&uint8(reflect.SendDir) == 0 { d.errorf("receive-only channel cannot be decoded") } dd := d.d - rtelem0 := ti.elem + rtelem0 := f.ti.elem ctyp := dd.ContainerType() if ctyp == valueTypeBytes || ctyp == valueTypeString { // you can only decode bytes or string in the stream into a slice or array of bytes - if !(ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8) { - d.errorf("bytes/string in stream must decode into slice/array of bytes, not %v", ti.rt) + if !(f.ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8) { + d.errorf("bytes/string in stream must decode into slice/array of bytes, not %v", frt) } if f.seq == seqTypeChan { bs2 := dd.DecodeBytes(nil, true) @@ -1560,13 +1547,13 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { if rv.CanSet() { if f.seq == seqTypeSlice { if rv.IsNil() { - rv.Set(reflect.MakeSlice(ti.rt, 0, 0)) + rv.Set(reflect.MakeSlice(frt, 0, 0)) } else { rv.SetLen(0) } } else if f.seq == seqTypeChan { if rv.IsNil() { - rv.Set(reflect.MakeChan(ti.rt, 0)) + rv.Set(reflect.MakeChan(frt, 0)) } } } @@ -1574,8 +1561,6 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { return } - d.depthIncr() - rtelem0Size := int(rtelem0.Size()) rtElem0Kind := rtelem0.Kind() rtelem0Mut := !isImmutableKind(rtElem0Kind) @@ -1605,7 +1590,7 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { rv.SetLen(rvlen) } } else if rvCanset { - rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) + rv = reflect.MakeSlice(frt, rvlen, rvlen) rvcap = rvlen rvChanged = true } else { @@ -1644,10 +1629,10 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { } if rvCanset { if f.seq == seqTypeSlice { - rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) + rv = reflect.MakeSlice(frt, rvlen, rvlen) rvChanged = true } else { // chan - rv = reflect.MakeChan(ti.rt, rvlen) + rv = reflect.MakeChan(frt, rvlen) rvChanged = true } } else { @@ -1681,7 +1666,7 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { var rvcap2 int var rvErrmsg2 string rv9, rvcap2, rvChanged, rvErrmsg2 = - expandSliceRV(rv, ti.rt, rvCanset, rtelem0Size, 1, rvlen, rvcap) + expandSliceRV(rv, frt, rvCanset, rtelem0Size, 1, rvlen, rvcap) if rvErrmsg2 != "" { d.errorf(rvErrmsg2) } @@ -1727,7 +1712,7 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { rvlen = j } else if j == 0 && rv.IsNil() { if rvCanset { - rv = reflect.MakeSlice(ti.rt, 0, 0) + rv = reflect.MakeSlice(frt, 0, 0) rvChanged = true } // else { d.errorf("kSlice: cannot change non-settable slice") } } @@ -1738,7 +1723,6 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { rv0.Set(rv) } - d.depthDecr() } // func (d *Decoder) kArray(f *codecFnInfo, rv reflect.Value) { @@ -1748,8 +1732,7 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { dd := d.d - containerLen := dd.ReadMapStart() - elemsep := d.esep + containerLen := d.mapStart() ti := f.ti if rv.IsNil() { rvlen := decInferLen(containerLen, d.h.MaxInitLen, int(ti.key.Size()+ti.elem.Size())) @@ -1757,12 +1740,10 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return } - d.depthIncr() - ktype, vtype := ti.key, ti.elem ktypeId := rt2id(ktype) vtypeKind := vtype.Kind() @@ -1806,9 +1787,7 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { rvkp = reflect.New(ktype) rvk = rvkp.Elem() } - if elemsep { - dd.ReadMapElemKey() - } + d.mapElemKey() // if false && dd.TryDecodeAsNil() { // nil cannot be a map key, so disregard this block // // Previously, if a nil key, we just ignored the mapped value and continued. // // However, that makes the result of encoding and then decoding map[intf]intf{nil:nil} @@ -1837,9 +1816,7 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { } } - if elemsep { - dd.ReadMapElemValue() - } + d.mapElemValue() // Brittle, but OK per TryDecodeAsNil() contract. // i.e. TryDecodeAsNil never shares slices with other decDriver procedures @@ -1904,9 +1881,8 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { // } } - dd.ReadMapEnd() + d.mapEnd() - d.depthDecr() } // decNaked is used to keep track of the primitives decoded. @@ -1944,7 +1920,7 @@ type decNaked struct { // state v valueType - _ [6]bool // padding + // _ [6]bool // padding // ru, ri, rf, rl, rs, rb, rt reflect.Value // mapping to the primitives above // @@ -2001,21 +1977,20 @@ type decNaked struct { // -------------- type decReaderSwitch struct { - rb bytesDecReader - // ---- cpu cache line boundary? - ri *ioDecReader - bi *bufioDecReader - + esep bool // has elem separators mtr, str bool // whether maptype or slicetype are known types be bool // is binary encoding js bool // is json handle jsms bool // is json handle, and MapKeyAsString - esep bool // has elem separators // typ entryType bytes bool // is bytes reader bufio bool // is this a bufioDecReader? + + rb bytesDecReader + ri *ioDecReader + bi *bufioDecReader } // numread, track and stopTrack are always inlined, as they just check int fields, etc. @@ -2286,17 +2261,18 @@ type Decoder struct { d decDriver - // NOTE: Decoder shouldn't call it's read methods, + // NOTE: Decoder shouldn't call its read methods, // as the handler MAY need to do some coordination. - r *decReaderSwitch + // r *decReaderSwitch // bi *bufioDecReader // cache the mapTypeId and sliceTypeId for faster comparisons mtid uintptr stid uintptr - hh Handle - h *BasicHandle + jdec *jsonDecDriver + h *BasicHandle + hh Handle // ---- cpu cache line boundary? decReaderSwitch @@ -2305,17 +2281,20 @@ type Decoder struct { n decNaked // cr containerStateRecv - err error - depth int16 - maxdepth int16 - - _ [4]uint8 // padding + // _ [4]uint8 // padding is map[string]string // used for interning strings + err error + // ---- cpu cache line boundary? - b [decScratchByteArrayLen]byte // scratch buffer, used by Decoder and xxxEncDrivers + // ---- writable fields during execution --- *try* to keep in sep cache line + maxdepth int16 + depth int16 + c containerState + _ [3]byte // padding + b [decScratchByteArrayLen]byte // scratch buffer, used by Decoder and xxxEncDrivers // padding - false sharing help // modify 232 if Decoder struct changes. // _ [cacheLineSize - 232%cacheLineSize]byte @@ -2348,12 +2327,13 @@ func newDecoder(h Handle) *Decoder { runtime.SetFinalizer(d, (*Decoder).finalize) // xdebugf(">>>> new(Decoder) with finalizer") } - d.r = &d.decReaderSwitch + // d.r = &d.decReaderSwitch d.hh = h d.be = h.isBinary() // NOTE: do not initialize d.n here. It is lazily initialized in d.naked() var jh *JsonHandle jh, d.js = h.(*JsonHandle) + d.jdec = nil if d.js { d.jsms = jh.MapKeyAsString } @@ -2362,10 +2342,17 @@ func newDecoder(h Handle) *Decoder { d.is = make(map[string]string, 32) } d.d = h.newDecDriver(d) + if d.js { + d.jdec = d.d.(*jsonDecDriver) + } // d.cr, _ = d.d.(containerStateRecv) return d } +func (d *Decoder) r() *decReaderSwitch { + return &d.decReaderSwitch +} + func (d *Decoder) resetCommon() { // d.r = &d.decReaderSwitch d.d.reset() @@ -2510,7 +2497,9 @@ func (d *Decoder) Decode(v interface{}) (err error) { defer func() { if x := recover(); x != nil { panicValToErr(d, x, &d.err) - err = d.err + if d.err != err { + err = d.err + } } }() } @@ -2544,7 +2533,7 @@ func (d *Decoder) mustDecode(v interface{}) { d.bi.calls++ d.decode(v) - // xprintf(">>>>>>>> >>>>>>>> num decFns: %v\n", d.cf.sn) + // xprintf.(">>>>>>>> >>>>>>>> num decFns: %v\n", d.cf.sn) d.bi.calls-- if !d.h.ExplicitRelease && d.bi.calls == 0 { d.bi.release() @@ -2591,37 +2580,26 @@ func (d *Decoder) swallow() { if dd.TryDecodeAsNil() { return } - elemsep := d.esep switch dd.ContainerType() { case valueTypeMap: - containerLen := dd.ReadMapStart() - d.depthIncr() + containerLen := d.mapStart() hasLen := containerLen >= 0 for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { // if clenGtEqualZero {if j >= containerLen {break} } else if dd.CheckBreak() {break} - if elemsep { - dd.ReadMapElemKey() - } + d.mapElemKey() d.swallow() - if elemsep { - dd.ReadMapElemValue() - } + d.mapElemValue() d.swallow() } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() case valueTypeArray: - containerLen := dd.ReadArrayStart() - d.depthIncr() + containerLen := d.arrayStart() hasLen := containerLen >= 0 for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if elemsep { - dd.ReadArrayElem() - } + d.arrayElem() d.swallow() } - dd.ReadArrayEnd() - d.depthDecr() + d.arrayEnd() case valueTypeBytes: dd.DecodeBytes(d.b[:], true) case valueTypeString: @@ -2733,11 +2711,7 @@ func (d *Decoder) decode(iv interface{}) { case *uint64: *v = d.d.DecodeUint64() case *float32: - f64 := d.d.DecodeFloat64() - if chkOvf.Float32(f64) { - d.errorf("float32 overflow: %v", f64) - } - *v = float32(f64) + *v = float32(d.decodeFloat32()) case *float64: *v = d.d.DecodeFloat64() case *[]uint8: @@ -2898,9 +2872,9 @@ func (d *Decoder) string(v []byte) (s string) { // nextValueBytes returns the next value in the stream as a set of bytes. func (d *Decoder) nextValueBytes() (bs []byte) { d.d.uncacheRead() - d.r.track() + d.r().track() d.swallow() - bs = d.r.stopTrack() + bs = d.r().stopTrack() return } @@ -2914,12 +2888,76 @@ func (d *Decoder) rawBytes() []byte { } func (d *Decoder) wrapErr(v interface{}, err *error) { - *err = decodeError{codecError: codecError{name: d.hh.Name(), err: v}, pos: int(d.r.numread())} + *err = decodeError{codecError: codecError{name: d.hh.Name(), err: v}, pos: int(d.r().numread())} } // NumBytesRead returns the number of bytes read func (d *Decoder) NumBytesRead() int { - return int(d.r.numread()) + return int(d.r().numread()) +} + +// decodeFloat32 will delegate to an appropriate DecodeFloat32 implementation (if exists), +// else if will call DecodeFloat64 and ensure the value doesn't overflow. +// +// Note that we return float64 to reduce unnecessary conversions +func (d *Decoder) decodeFloat32() float64 { + if d.js { + return d.jdec.DecodeFloat32() // custom implementation for 32-bit + } + return chkOvf.Float32V(d.d.DecodeFloat64()) +} + +// ---- container tracking +// Note: We update the .c after calling the callback. +// This way, the callback can know what the last status was. + +func (d *Decoder) mapStart() (v int) { + v = d.d.ReadMapStart() + d.depthIncr() + d.c = containerMapStart + return +} + +func (d *Decoder) mapElemKey() { + if d.js { + d.jdec.ReadMapElemKey() + } + d.c = containerMapKey +} + +func (d *Decoder) mapElemValue() { + if d.js { + d.jdec.ReadMapElemValue() + } + d.c = containerMapValue +} + +func (d *Decoder) mapEnd() { + d.d.ReadMapEnd() + d.depthDecr() + d.c = containerMapEnd + d.c = 0 +} + +func (d *Decoder) arrayStart() (v int) { + v = d.d.ReadArrayStart() + d.depthIncr() + d.c = containerArrayStart + return +} + +func (d *Decoder) arrayElem() { + if d.js { + d.jdec.ReadArrayElem() + } + d.c = containerArrayElem +} + +func (d *Decoder) arrayEnd() { + d.d.ReadArrayEnd() + d.depthDecr() + d.c = containerArrayEnd + d.c = 0 } // -------------------------------------------------- @@ -2927,43 +2965,41 @@ func (d *Decoder) NumBytesRead() int { // decSliceHelper assists when decoding into a slice, from a map or an array in the stream. // A slice can be set from a map or array in stream. This supports the MapBySlice interface. type decSliceHelper struct { - d *Decoder - // ct valueType + d *Decoder + ct valueType array bool } func (d *Decoder) decSliceHelperStart() (x decSliceHelper, clen int) { - dd := d.d - ctyp := dd.ContainerType() - switch ctyp { + x.ct = d.d.ContainerType() + x.d = d + switch x.ct { case valueTypeArray: x.array = true - clen = dd.ReadArrayStart() + clen = d.arrayStart() case valueTypeMap: - clen = dd.ReadMapStart() * 2 + clen = d.mapStart() * 2 default: - d.errorf("only encoded map or array can be decoded into a slice (%d)", ctyp) + d.errorf("only encoded map or array can be decoded into a slice (%d)", x.ct) } - // x.ct = ctyp - x.d = d return } func (x decSliceHelper) End() { if x.array { - x.d.d.ReadArrayEnd() + x.d.arrayEnd() } else { - x.d.d.ReadMapEnd() + x.d.mapEnd() } } func (x decSliceHelper) ElemContainerState(index int) { if x.array { - x.d.d.ReadArrayElem() + x.d.arrayElem() } else if index%2 == 0 { - x.d.d.ReadMapElemKey() + x.d.mapElemKey() } else { - x.d.d.ReadMapElemValue() + x.d.mapElemValue() } } diff --git a/backend/vendor/github.com/ugorji/go/codec/encode.go b/backend/vendor/github.com/ugorji/go/codec/encode.go index 8462440c..0a55dda8 100644 --- a/backend/vendor/github.com/ugorji/go/codec/encode.go +++ b/backend/vendor/github.com/ugorji/go/codec/encode.go @@ -30,6 +30,7 @@ var errEncoderNotInitialized = errors.New("Encoder not initialized") type encWriter interface { writeb([]byte) writestr(string) + writeqstr(string) // write string wrapped in quotes ie "..." writen1(byte) writen2(byte, byte) end() @@ -48,10 +49,6 @@ type encDriver interface { // encodeExtPreamble(xtag byte, length int) EncodeRawExt(re *RawExt, e *Encoder) EncodeExt(v interface{}, xtag uint64, ext Ext, e *Encoder) - // Deprecated: use EncodeStringEnc instead - EncodeString(c charEncoding, v string) - // Deprecated: use EncodeStringBytesRaw instead - EncodeStringBytes(c charEncoding, v []byte) EncodeStringEnc(c charEncoding, v string) // c cannot be cRAW // EncodeSymbol(v string) EncodeStringBytesRaw(v []byte) @@ -59,17 +56,20 @@ type encDriver interface { //encBignum(f *big.Int) //encStringRunes(c charEncoding, v []rune) WriteArrayStart(length int) - WriteArrayElem() WriteArrayEnd() WriteMapStart(length int) - WriteMapElemKey() - WriteMapElemValue() WriteMapEnd() reset() atEndOfEncode() } +type encDriverContainerTracker interface { + WriteArrayElem() + WriteMapElemKey() + WriteMapElemValue() +} + type encDriverAsis interface { EncodeAsis(v []byte) } @@ -85,26 +85,27 @@ func (e encodeError) Error() string { type encDriverNoopContainerWriter struct{} func (encDriverNoopContainerWriter) WriteArrayStart(length int) {} -func (encDriverNoopContainerWriter) WriteArrayElem() {} func (encDriverNoopContainerWriter) WriteArrayEnd() {} func (encDriverNoopContainerWriter) WriteMapStart(length int) {} -func (encDriverNoopContainerWriter) WriteMapElemKey() {} -func (encDriverNoopContainerWriter) WriteMapElemValue() {} func (encDriverNoopContainerWriter) WriteMapEnd() {} func (encDriverNoopContainerWriter) atEndOfEncode() {} -type encDriverTrackContainerWriter struct { - c containerState -} +// func (encDriverNoopContainerWriter) WriteArrayElem() {} +// func (encDriverNoopContainerWriter) WriteMapElemKey() {} +// func (encDriverNoopContainerWriter) WriteMapElemValue() {} -func (e *encDriverTrackContainerWriter) WriteArrayStart(length int) { e.c = containerArrayStart } -func (e *encDriverTrackContainerWriter) WriteArrayElem() { e.c = containerArrayElem } -func (e *encDriverTrackContainerWriter) WriteArrayEnd() { e.c = containerArrayEnd } -func (e *encDriverTrackContainerWriter) WriteMapStart(length int) { e.c = containerMapStart } -func (e *encDriverTrackContainerWriter) WriteMapElemKey() { e.c = containerMapKey } -func (e *encDriverTrackContainerWriter) WriteMapElemValue() { e.c = containerMapValue } -func (e *encDriverTrackContainerWriter) WriteMapEnd() { e.c = containerMapEnd } -func (e *encDriverTrackContainerWriter) atEndOfEncode() {} +// type encDriverTrackContainerWriter struct { +// c containerState +// } + +// func (e *encDriverTrackContainerWriter) WriteArrayStart(length int) { e.c = containerArrayStart } +// func (e *encDriverTrackContainerWriter) WriteArrayElem() { e.c = containerArrayElem } +// func (e *encDriverTrackContainerWriter) WriteArrayEnd() { e.c = containerArrayEnd } +// func (e *encDriverTrackContainerWriter) WriteMapStart(length int) { e.c = containerMapStart } +// func (e *encDriverTrackContainerWriter) WriteMapElemKey() { e.c = containerMapKey } +// func (e *encDriverTrackContainerWriter) WriteMapElemValue() { e.c = containerMapValue } +// func (e *encDriverTrackContainerWriter) WriteMapEnd() { e.c = containerMapEnd } +// func (e *encDriverTrackContainerWriter) atEndOfEncode() {} // type ioEncWriterWriter interface { // WriteByte(c byte) error @@ -250,6 +251,10 @@ func (z *ioEncWriter) writestr(s string) { } } +func (z *ioEncWriter) writeqstr(s string) { + writestr("\"" + s + "\"") +} + func (z *ioEncWriter) writen1(b byte) { if err := z.bw.WriteByte(b); err != nil { panic(err) @@ -288,21 +293,28 @@ func (z *ioEncWriter) end() { // bufioEncWriter type bufioEncWriter struct { + w io.Writer + buf []byte - w io.Writer - n int - sz int // buf size + + n int // Extensions can call Encode() within a current Encode() call. // We need to know when the top level Encode() call returns, // so we can decide whether to Release() or not. calls uint16 // what depth in mustDecode are we in now. - _ [6]uint8 // padding + sz int // buf size + // _ uint64 // padding (cache-aligned) + // ---- cache line + + // write-most fields below + + // less used fields bytesBufPooler - _ [1]uint64 // padding + b [40]byte // scratch buffer and padding (cache-aligned) // a int // b [4]byte // err @@ -318,6 +330,8 @@ func (z *bufioEncWriter) reset(w io.Writer, bufsize int) { z.sz = bufsize if cap(z.buf) >= bufsize { z.buf = z.buf[:cap(z.buf)] + } else if bufsize <= len(z.b) { + z.buf = z.b[:] } else { z.buf = z.bytesBufPooler.get(bufsize) // z.buf = make([]byte, bufsize) @@ -373,6 +387,29 @@ LOOP: z.n += copy(z.buf[z.n:], s) } +func (z *bufioEncWriter) writeqstr(s string) { + // z.writen1('"') + // z.writestr(s) + // z.writen1('"') + + if z.n+len(s)+2 > len(z.buf) { + z.flush() + } + z.buf[z.n] = '"' + z.n++ +LOOP: + a := len(z.buf) - z.n + if len(s)+1 > a { + z.n += copy(z.buf[z.n:], s[:a]) + s = s[a:] + z.flush() + goto LOOP + } + z.n += copy(z.buf[z.n:], s) + z.buf[z.n] = '"' + z.n++ +} + func (z *bufioEncWriter) writen1(b1 byte) { if 1 > len(z.buf)-z.n { z.flush() @@ -411,6 +448,15 @@ func (z *bytesEncAppender) writeb(s []byte) { func (z *bytesEncAppender) writestr(s string) { z.b = append(z.b, s...) } +func (z *bytesEncAppender) writeqstr(s string) { + // z.writen1('"') + // z.writestr(s) + // z.writen1('"') + z.b = append(append(append(z.b, '"'), s...), '"') + // z.b = append(z.b, '"') + // z.b = append(z.b, s...) + // z.b = append(z.b, '"') +} func (z *bytesEncAppender) writen1(b1 byte) { z.b = append(z.b, b1) } @@ -468,97 +514,30 @@ func (e *Encoder) kErr(f *codecFnInfo, rv reflect.Value) { } func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { - ti := f.ti - ee := e.e // array may be non-addressable, so we have to manage with care // (don't call rv.Bytes, rv.Slice, etc). // E.g. type struct S{B [2]byte}; // Encode(S{}) will bomb on "panic: slice of unaddressable array". if f.seq != seqTypeArray { if rv.IsNil() { - ee.EncodeNil() + e.e.EncodeNil() return } // If in this method, then there was no extension function defined. // So it's okay to treat as []byte. - if ti.rtid == uint8SliceTypId { - ee.EncodeStringBytesRaw(rv.Bytes()) + if f.ti.rtid == uint8SliceTypId { + e.e.EncodeStringBytesRaw(rv.Bytes()) return } } - if f.seq == seqTypeChan && ti.chandir&uint8(reflect.RecvDir) == 0 { + if f.seq == seqTypeChan && f.ti.chandir&uint8(reflect.RecvDir) == 0 { e.errorf("send-only channel cannot be encoded") } - elemsep := e.esep - rtelem := ti.elem - rtelemIsByte := uint8TypId == rt2id(rtelem) // NOT rtelem.Kind() == reflect.Uint8 - var l int + mbs := f.ti.mbs + rtelem := f.ti.elem // if a slice, array or chan of bytes, treat specially - if rtelemIsByte { - switch f.seq { - case seqTypeSlice: - ee.EncodeStringBytesRaw(rv.Bytes()) - case seqTypeArray: - l = rv.Len() - if rv.CanAddr() { - ee.EncodeStringBytesRaw(rv.Slice(0, l).Bytes()) - } else { - var bs []byte - if l <= cap(e.b) { - bs = e.b[:l] - } else { - bs = make([]byte, l) - } - reflect.Copy(reflect.ValueOf(bs), rv) - ee.EncodeStringBytesRaw(bs) - } - case seqTypeChan: - // do not use range, so that the number of elements encoded - // does not change, and encoding does not hang waiting on someone to close chan. - // for b := range rv2i(rv).(<-chan byte) { bs = append(bs, b) } - // ch := rv2i(rv).(<-chan byte) // fix error - that this is a chan byte, not a <-chan byte. - - if rv.IsNil() { - ee.EncodeNil() - break - } - bs := e.b[:0] - irv := rv2i(rv) - ch, ok := irv.(<-chan byte) - if !ok { - ch = irv.(chan byte) - } - - L1: - switch timeout := e.h.ChanRecvTimeout; { - case timeout == 0: // only consume available - for { - select { - case b := <-ch: - bs = append(bs, b) - default: - break L1 - } - } - case timeout > 0: // consume until timeout - tt := time.NewTimer(timeout) - for { - select { - case b := <-ch: - bs = append(bs, b) - case <-tt.C: - // close(tt.C) - break L1 - } - } - default: // consume until close - for b := range ch { - bs = append(bs, b) - } - } - - ee.EncodeStringBytesRaw(bs) - } + if !mbs && uint8TypId == rt2id(rtelem) { // NOT rtelem.Kind() == reflect.Uint8 + e.kSliceBytes(rv, f.seq) return } @@ -594,15 +573,15 @@ func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { rv = rvcs // TODO: ensure this doesn't mess up anywhere that rv of kind chan is expected } - l = rv.Len() - if ti.mbs { + var l = rv.Len() + if mbs { if l%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", l) return } - ee.WriteMapStart(l / 2) + e.mapStart(l / 2) } else { - ee.WriteArrayStart(l) + e.arrayStart(l) } if l > 0 { @@ -617,81 +596,122 @@ func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { fn = e.h.fn(rtelem, true, true) } for j := 0; j < l; j++ { - if elemsep { - if ti.mbs { - if j%2 == 0 { - ee.WriteMapElemKey() - } else { - ee.WriteMapElemValue() - } + if mbs { + if j%2 == 0 { + e.mapElemKey() } else { - ee.WriteArrayElem() + e.mapElemValue() } + } else { + e.arrayElem() } e.encodeValue(rv.Index(j), fn, true) } } - if ti.mbs { - ee.WriteMapEnd() + if mbs { + e.mapEnd() } else { - ee.WriteArrayEnd() + e.arrayEnd() + } +} + +func (e *Encoder) kSliceBytes(rv reflect.Value, seq seqType) { + // xdebugf("kSliceBytes: seq: %d, rvType: %v", seq, rv.Type()) + switch seq { + case seqTypeSlice: + e.e.EncodeStringBytesRaw(rv.Bytes()) + case seqTypeArray: + var l = rv.Len() + if rv.CanAddr() { + e.e.EncodeStringBytesRaw(rv.Slice(0, l).Bytes()) + } else { + var bs []byte + if l <= cap(e.b) { + bs = e.b[:l] + } else { + bs = make([]byte, l) + } + reflect.Copy(reflect.ValueOf(bs), rv) + e.e.EncodeStringBytesRaw(bs) + } + case seqTypeChan: + // do not use range, so that the number of elements encoded + // does not change, and encoding does not hang waiting on someone to close chan. + // for b := range rv2i(rv).(<-chan byte) { bs = append(bs, b) } + // ch := rv2i(rv).(<-chan byte) // fix error - that this is a chan byte, not a <-chan byte. + + if rv.IsNil() { + e.e.EncodeNil() + break + } + bs := e.b[:0] + irv := rv2i(rv) + ch, ok := irv.(<-chan byte) + if !ok { + ch = irv.(chan byte) + } + + L1: + switch timeout := e.h.ChanRecvTimeout; { + case timeout == 0: // only consume available + for { + select { + case b := <-ch: + bs = append(bs, b) + default: + break L1 + } + } + case timeout > 0: // consume until timeout + tt := time.NewTimer(timeout) + for { + select { + case b := <-ch: + bs = append(bs, b) + case <-tt.C: + // close(tt.C) + break L1 + } + } + default: // consume until close + for b := range ch { + bs = append(bs, b) + } + } + + e.e.EncodeStringBytesRaw(bs) } } func (e *Encoder) kStructNoOmitempty(f *codecFnInfo, rv reflect.Value) { - fti := f.ti - tisfi := fti.sfiSrc - toMap := !(fti.toArray || e.h.StructToArray) - if toMap { - tisfi = fti.sfiSort - } - - ee := e.e - sfn := structFieldNode{v: rv, update: false} - if toMap { - ee.WriteMapStart(len(tisfi)) - if e.esep { - for _, si := range tisfi { - ee.WriteMapElemKey() - e.kStructFieldKey(fti.keyType, si.encNameAsciiAlphaNum, si.encName) - ee.WriteMapElemValue() - e.encodeValue(sfn.field(si), nil, true) - } - } else { - for _, si := range tisfi { - e.kStructFieldKey(fti.keyType, si.encNameAsciiAlphaNum, si.encName) - e.encodeValue(sfn.field(si), nil, true) - } + if f.ti.toArray || e.h.StructToArray { // toArray + e.arrayStart(len(f.ti.sfiSrc)) + for _, si := range f.ti.sfiSrc { + e.arrayElem() + e.encodeValue(sfn.field(si), nil, true) } - ee.WriteMapEnd() + e.arrayEnd() } else { - ee.WriteArrayStart(len(tisfi)) - if e.esep { - for _, si := range tisfi { - ee.WriteArrayElem() - e.encodeValue(sfn.field(si), nil, true) - } - } else { - for _, si := range tisfi { - e.encodeValue(sfn.field(si), nil, true) - } + e.mapStart(len(f.ti.sfiSort)) + for _, si := range f.ti.sfiSort { + e.mapElemKey() + e.kStructFieldKey(f.ti.keyType, si.encNameAsciiAlphaNum, si.encName) + e.mapElemValue() + e.encodeValue(sfn.field(si), nil, true) } - ee.WriteArrayEnd() + e.mapEnd() } } func (e *Encoder) kStructFieldKey(keyType valueType, encNameAsciiAlphaNum bool, encName string) { - encStructFieldKey(encName, e.e, e.w, keyType, encNameAsciiAlphaNum, e.js) + encStructFieldKey(encName, e.e, e.w(), keyType, encNameAsciiAlphaNum, e.js) } func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) { - fti := f.ti - elemsep := e.esep - tisfi := fti.sfiSrc var newlen int - toMap := !(fti.toArray || e.h.StructToArray) + toMap := !(f.ti.toArray || e.h.StructToArray) var mf map[string]interface{} if f.ti.mf { mf = rv2i(rv).(MissingFielder).CodecMissingFields() @@ -709,12 +729,7 @@ func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) { toMap = true newlen += len(mf) } - // if toMap, use the sorted array. If toArray, use unsorted array (to match sequence in struct) - if toMap { - tisfi = fti.sfiSort - } - newlen += len(tisfi) - ee := e.e + newlen += len(f.ti.sfiSrc) // Use sync.Pool to reduce allocating slices unnecessarily. // The cost of sync.Pool is less than the cost of new allocation. @@ -732,86 +747,75 @@ func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) { var spool sfiRvPooler var fkvs = spool.get(newlen) - var kv sfiRv recur := e.h.RecursiveEmptyCheck sfn := structFieldNode{v: rv, update: false} - newlen = 0 - for _, si := range tisfi { - // kv.r = si.field(rv, false) - kv.r = sfn.field(si) - if toMap { + + var kv sfiRv + var j int + if toMap { + newlen = 0 + for _, si := range f.ti.sfiSort { // use sorted array + // kv.r = si.field(rv, false) + kv.r = sfn.field(si) if si.omitEmpty() && isEmptyValue(kv.r, e.h.TypeInfos, recur, recur) { continue } kv.v = si // si.encName - } else { + fkvs[newlen] = kv + newlen++ + } + var mflen int + for k, v := range mf { + if k == "" { + delete(mf, k) + continue + } + if f.ti.infoFieldOmitempty && isEmptyValue(reflect.ValueOf(v), e.h.TypeInfos, recur, recur) { + delete(mf, k) + continue + } + mflen++ + } + // encode it all + e.mapStart(newlen + mflen) + for j = 0; j < newlen; j++ { + kv = fkvs[j] + e.mapElemKey() + e.kStructFieldKey(f.ti.keyType, kv.v.encNameAsciiAlphaNum, kv.v.encName) + e.mapElemValue() + e.encodeValue(kv.r, nil, true) + } + // now, add the others + for k, v := range mf { + e.mapElemKey() + e.kStructFieldKey(f.ti.keyType, false, k) + e.mapElemValue() + e.encode(v) + } + e.mapEnd() + } else { + newlen = len(f.ti.sfiSrc) + // kv.v = nil + for i, si := range f.ti.sfiSrc { // use unsorted array (to match sequence in struct) + // kv.r = si.field(rv, false) + kv.r = sfn.field(si) // use the zero value. // if a reference or struct, set to nil (so you do not output too much) if si.omitEmpty() && isEmptyValue(kv.r, e.h.TypeInfos, recur, recur) { switch kv.r.Kind() { - case reflect.Struct, reflect.Interface, reflect.Ptr, - reflect.Array, reflect.Map, reflect.Slice: + case reflect.Struct, reflect.Interface, reflect.Ptr, reflect.Array, reflect.Map, reflect.Slice: kv.r = reflect.Value{} //encode as nil } } + fkvs[i] = kv } - fkvs[newlen] = kv - newlen++ - } - fkvs = fkvs[:newlen] - - var mflen int - for k, v := range mf { - if k == "" { - delete(mf, k) - continue + // encode it all + e.arrayStart(newlen) + for j = 0; j < newlen; j++ { + e.arrayElem() + e.encodeValue(fkvs[j].r, nil, true) } - if fti.infoFieldOmitempty && isEmptyValue(reflect.ValueOf(v), e.h.TypeInfos, recur, recur) { - delete(mf, k) - continue - } - mflen++ - } - - var j int - if toMap { - ee.WriteMapStart(newlen + mflen) - if elemsep { - for j = 0; j < len(fkvs); j++ { - kv = fkvs[j] - ee.WriteMapElemKey() - e.kStructFieldKey(fti.keyType, kv.v.encNameAsciiAlphaNum, kv.v.encName) - ee.WriteMapElemValue() - e.encodeValue(kv.r, nil, true) - } - } else { - for j = 0; j < len(fkvs); j++ { - kv = fkvs[j] - e.kStructFieldKey(fti.keyType, kv.v.encNameAsciiAlphaNum, kv.v.encName) - e.encodeValue(kv.r, nil, true) - } - } - // now, add the others - for k, v := range mf { - ee.WriteMapElemKey() - e.kStructFieldKey(fti.keyType, false, k) - ee.WriteMapElemValue() - e.encode(v) - } - ee.WriteMapEnd() - } else { - ee.WriteArrayStart(newlen) - if elemsep { - for j = 0; j < len(fkvs); j++ { - ee.WriteArrayElem() - e.encodeValue(fkvs[j].r, nil, true) - } - } else { - for j = 0; j < len(fkvs); j++ { - e.encodeValue(fkvs[j].r, nil, true) - } - } - ee.WriteArrayEnd() + e.arrayEnd() } // do not use defer. Instead, use explicit pool return at end of function. @@ -821,16 +825,15 @@ func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) { } func (e *Encoder) kMap(f *codecFnInfo, rv reflect.Value) { - ee := e.e if rv.IsNil() { - ee.EncodeNil() + e.e.EncodeNil() return } l := rv.Len() - ee.WriteMapStart(l) + e.mapStart(l) if l == 0 { - ee.WriteMapEnd() + e.mapEnd() return } // var asSymbols bool @@ -842,12 +845,8 @@ func (e *Encoder) kMap(f *codecFnInfo, rv reflect.Value) { // encoding type, because preEncodeValue may break it down to // a concrete type and kInterface will bomb. var keyFn, valFn *codecFn - ti := f.ti - rtkey0 := ti.key - rtkey := rtkey0 - rtval0 := ti.elem - rtval := rtval0 - // rtkeyid := rt2id(rtkey0) + rtval := f.ti.elem + // rtkeyid := rt2id(f.ti.key) for rtval.Kind() == reflect.Ptr { rtval = rtval.Elem() } @@ -857,12 +856,13 @@ func (e *Encoder) kMap(f *codecFnInfo, rv reflect.Value) { mks := rv.MapKeys() if e.h.Canonical { - e.kMapCanonical(rtkey, rv, mks, valFn) - ee.WriteMapEnd() + e.kMapCanonical(f.ti.key, rv, mks, valFn) + e.mapEnd() return } - var keyTypeIsString = stringTypId == rt2id(rtkey0) // rtkeyid + rtkey := f.ti.key + var keyTypeIsString = stringTypId == rt2id(rtkey) // rtkeyid if !keyTypeIsString { for rtkey.Kind() == reflect.Ptr { rtkey = rtkey.Elem() @@ -875,30 +875,23 @@ func (e *Encoder) kMap(f *codecFnInfo, rv reflect.Value) { // for j, lmks := 0, len(mks); j < lmks; j++ { for j := range mks { - if e.esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if keyTypeIsString { if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(mks[j].String())) + e.e.EncodeStringBytesRaw(bytesView(mks[j].String())) } else { - ee.EncodeStringEnc(cUTF8, mks[j].String()) + e.e.EncodeStringEnc(cUTF8, mks[j].String()) } } else { e.encodeValue(mks[j], keyFn, true) } - if e.esep { - ee.WriteMapElemValue() - } + e.mapElemValue() e.encodeValue(rv.MapIndex(mks[j]), valFn, true) - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []reflect.Value, valFn *codecFn) { - ee := e.e - elemsep := e.esep // we previously did out-of-band if an extension was registered. // This is not necessary, as the natural kind is sufficient for ordering. @@ -912,13 +905,9 @@ func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []refl } sort.Sort(boolRvSlice(mksv)) for i := range mksv { - if elemsep { - ee.WriteMapElemKey() - } - ee.EncodeBool(mksv[i].v) - if elemsep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeBool(mksv[i].v) + e.mapElemValue() e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) } case reflect.String: @@ -930,89 +919,69 @@ func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []refl } sort.Sort(stringRvSlice(mksv)) for i := range mksv { - if elemsep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(mksv[i].v)) + e.e.EncodeStringBytesRaw(bytesView(mksv[i].v)) } else { - ee.EncodeStringEnc(cUTF8, mksv[i].v) - } - if elemsep { - ee.WriteMapElemValue() + e.e.EncodeStringEnc(cUTF8, mksv[i].v) } + e.mapElemValue() e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) } case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint, reflect.Uintptr: - mksv := make([]uintRv, len(mks)) + mksv := make([]uint64Rv, len(mks)) for i, k := range mks { v := &mksv[i] v.r = k v.v = k.Uint() } - sort.Sort(uintRvSlice(mksv)) + sort.Sort(uint64RvSlice(mksv)) for i := range mksv { - if elemsep { - ee.WriteMapElemKey() - } - ee.EncodeUint(mksv[i].v) - if elemsep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(mksv[i].v) + e.mapElemValue() e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) } case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - mksv := make([]intRv, len(mks)) + mksv := make([]int64Rv, len(mks)) for i, k := range mks { v := &mksv[i] v.r = k v.v = k.Int() } - sort.Sort(intRvSlice(mksv)) + sort.Sort(int64RvSlice(mksv)) for i := range mksv { - if elemsep { - ee.WriteMapElemKey() - } - ee.EncodeInt(mksv[i].v) - if elemsep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeInt(mksv[i].v) + e.mapElemValue() e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) } case reflect.Float32: - mksv := make([]floatRv, len(mks)) + mksv := make([]float64Rv, len(mks)) for i, k := range mks { v := &mksv[i] v.r = k v.v = k.Float() } - sort.Sort(floatRvSlice(mksv)) + sort.Sort(float64RvSlice(mksv)) for i := range mksv { - if elemsep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(mksv[i].v)) - if elemsep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeFloat32(float32(mksv[i].v)) + e.mapElemValue() e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) } case reflect.Float64: - mksv := make([]floatRv, len(mks)) + mksv := make([]float64Rv, len(mks)) for i, k := range mks { v := &mksv[i] v.r = k v.v = k.Float() } - sort.Sort(floatRvSlice(mksv)) + sort.Sort(float64RvSlice(mksv)) for i := range mksv { - if elemsep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(mksv[i].v) - if elemsep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeFloat64(mksv[i].v) + e.mapElemValue() e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) } case reflect.Struct: @@ -1025,13 +994,9 @@ func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []refl } sort.Sort(timeRvSlice(mksv)) for i := range mksv { - if elemsep { - ee.WriteMapElemKey() - } - ee.EncodeTime(mksv[i].v) - if elemsep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeTime(mksv[i].v) + e.mapElemValue() e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) } break @@ -1052,13 +1017,9 @@ func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []refl } sort.Sort(bytesRvSlice(mksbv)) for j := range mksbv { - if elemsep { - ee.WriteMapElemKey() - } + e.mapElemKey() e.asis(mksbv[j].v) - if elemsep { - ee.WriteMapElemValue() - } + e.mapElemValue() e.encodeValue(rv.MapIndex(mksbv[j].r), valFn, true) } } @@ -1067,18 +1028,20 @@ func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []refl // // -------------------------------------------------- type encWriterSwitch struct { + esep bool // whether it has elem separators + bytes bool // encoding to []byte + isas bool // whether e.as != nil + js bool // is json encoder? + be bool // is binary encoder? + + c containerState + // _ [3]byte // padding + // _ [2]uint64 // padding + // _ uint64 // padding // wi *ioEncWriter wb bytesEncAppender wf *bufioEncWriter // typ entryType - bytes bool // encoding to []byte - esep bool // whether it has elem separators - isas bool // whether e.as != nil - js bool // is json encoder? - be bool // is binary encoder? - _ [2]byte // padding - // _ [2]uint64 // padding - // _ uint64 // padding } func (z *encWriterSwitch) writeb(s []byte) { @@ -1088,6 +1051,13 @@ func (z *encWriterSwitch) writeb(s []byte) { z.wf.writeb(s) } } +func (z *encWriterSwitch) writeqstr(s string) { + if z.bytes { + z.wb.writeqstr(s) + } else { + z.wf.writeqstr(s) + } +} func (z *encWriterSwitch) writestr(s string) { if z.bytes { z.wb.writestr(s) @@ -1230,23 +1200,26 @@ type Encoder struct { // NOTE: Encoder shouldn't call it's write methods, // as the handler MAY need to do some coordination. - w *encWriterSwitch + // w *encWriterSwitch // bw *bufio.Writer as encDriverAsis - err error + jenc *jsonEncDriver + h *BasicHandle + hh Handle - h *BasicHandle - hh Handle - // ---- cpu cache line boundary? + 3 + // ---- cpu cache line boundary encWriterSwitch - ci set - - b [(5 * 8)]byte // for encoding chan or (non-addressable) [N]byte + err error + // ---- cpu cache line boundary // ---- writable fields during execution --- *try* to keep in sep cache line + ci set // holds set of addresses found during an encoding (if CheckCircularRef=true) + cidef [1]uintptr // default ci + + b [(4 * 8)]byte // for encoding chan byte, (non-addressable) [N]byte, etc // ---- cpu cache line boundary? // b [scratchByteArrayLen]byte @@ -1282,13 +1255,17 @@ func newEncoder(h Handle) *Encoder { runtime.SetFinalizer(e, (*Encoder).finalize) // xdebugf(">>>> new(Encoder) with finalizer") } - e.w = &e.encWriterSwitch + // e.w = &e.encWriterSwitch e.hh = h e.esep = h.hasElemSeparators() return e } +func (e *Encoder) w() *encWriterSwitch { + return &e.encWriterSwitch +} + func (e *Encoder) resetCommon() { // e.w = &e.encWriterSwitch if e.e == nil || e.hh.recreateEncDriver(e.e) { @@ -1296,9 +1273,21 @@ func (e *Encoder) resetCommon() { e.as, e.isas = e.e.(encDriverAsis) // e.cr, _ = e.e.(containerStateRecv) } + + if e.ci == nil { + e.ci = (set)(e.cidef[:0]) + } else { + e.ci = e.ci[:0] + } + e.be = e.hh.isBinary() + e.jenc = nil _, e.js = e.hh.(*JsonHandle) + if e.js { + e.jenc = e.e.(interface{ getJsonEncDriver() *jsonEncDriver }).getJsonEncDriver() + } e.e.reset() + e.c = 0 e.err = nil } @@ -1453,13 +1442,17 @@ func (e *Encoder) Encode(v interface{}) (err error) { defer func() { // if error occurred during encoding, return that error; // else if error occurred on end'ing (i.e. during flush), return that error. - err = e.w.endErr() + err = e.w().endErr() x := recover() if x == nil { - e.err = err + if e.err != err { + e.err = err + } } else { panicValToErr(e, x, &e.err) - err = e.err + if e.err != err { + err = e.err + } } }() } @@ -1482,7 +1475,7 @@ func (e *Encoder) mustEncode(v interface{}) { if e.wf == nil { e.encode(v) e.e.atEndOfEncode() - e.w.end() + e.w().end() return } @@ -1492,18 +1485,20 @@ func (e *Encoder) mustEncode(v interface{}) { e.wf.calls++ e.encode(v) - e.e.atEndOfEncode() - e.w.end() e.wf.calls-- - if !e.h.ExplicitRelease && e.wf.calls == 0 { - e.wf.release() + if e.wf.calls == 0 { + e.e.atEndOfEncode() + e.w().end() + if !e.h.ExplicitRelease { + e.wf.release() + } } } // func (e *Encoder) deferred(err1 *error) { -// e.w.end() +// e.w().end() // if recoverPanicToErr { // if x := recover(); x != nil { // panicValToErr(e, x, err1) @@ -1752,7 +1747,7 @@ func (e *Encoder) asis(v []byte) { if e.isas { e.as.EncodeAsis(v) } else { - e.w.writeb(v) + e.w().writeb(v) } } @@ -1768,6 +1763,53 @@ func (e *Encoder) wrapErr(v interface{}, err *error) { *err = encodeError{codecError{name: e.hh.Name(), err: v}} } +// ---- container tracker methods +// Note: We update the .c after calling the callback. +// This way, the callback can know what the last status was. + +func (e *Encoder) mapStart(length int) { + e.e.WriteMapStart(length) + e.c = containerMapStart +} + +func (e *Encoder) mapElemKey() { + if e.js { + e.jenc.WriteMapElemKey() + } + e.c = containerMapKey +} + +func (e *Encoder) mapElemValue() { + if e.js { + e.jenc.WriteMapElemValue() + } + e.c = containerMapValue +} + +func (e *Encoder) mapEnd() { + e.e.WriteMapEnd() + e.c = containerMapEnd + e.c = 0 +} + +func (e *Encoder) arrayStart(length int) { + e.e.WriteArrayStart(length) + e.c = containerArrayStart +} + +func (e *Encoder) arrayElem() { + if e.js { + e.jenc.WriteArrayElem() + } + e.c = containerArrayElem +} + +func (e *Encoder) arrayEnd() { + e.e.WriteArrayEnd() + e.c = 0 + e.c = containerArrayEnd +} + func encStructFieldKey(encName string, ee encDriver, w *encWriterSwitch, keyType valueType, encNameAsciiAlphaNum bool, js bool) { var m must @@ -1775,18 +1817,20 @@ func encStructFieldKey(encName string, ee encDriver, w *encWriterSwitch, // since keyType is typically valueTypeString, branch prediction is pretty good. if keyType == valueTypeString { if js && encNameAsciiAlphaNum { // keyType == valueTypeString + w.writeqstr(encName) + // ---- // w.writen1('"') // w.writestr(encName) // w.writen1('"') // ---- // w.writestr(`"` + encName + `"`) // ---- - // do concat myself, so it is faster than the generic string concat - b := make([]byte, len(encName)+2) - copy(b[1:], encName) - b[0] = '"' - b[len(b)-1] = '"' - w.writeb(b) + // // do concat myself, so it is faster than the generic string concat + // b := make([]byte, len(encName)+2) + // copy(b[1:], encName) + // b[0] = '"' + // b[len(b)-1] = '"' + // w.writeb(b) } else { // keyType == valueTypeString ee.EncodeStringEnc(cUTF8, encName) } diff --git a/backend/vendor/github.com/ugorji/go/codec/fast-path.generated.go b/backend/vendor/github.com/ugorji/go/codec/fast-path.generated.go index 9bc14bd6..cb630d78 100644 --- a/backend/vendor/github.com/ugorji/go/codec/fast-path.generated.go +++ b/backend/vendor/github.com/ugorji/go/codec/fast-path.generated.go @@ -10,7 +10,7 @@ package codec // Fast path functions try to create a fast path encode or decode implementation // for common maps and slices. // -// We define the functions and register then in this single file +// We define the functions and register them in this single file // so as not to pollute the encode.go and decode.go, and create a dependency in there. // This file can be omitted without causing a build failure. // @@ -18,9 +18,10 @@ package codec // - Many calls bypass reflection altogether // // Currently support -// - slice of all builtin types, -// - map of all builtin types to string or interface value -// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8) +// - slice of all builtin types (numeric, bool, string, []byte) +// - maps of builtin types to builtin or interface{} type, EXCEPT FOR +// keys of type uintptr, int8/16/32, uint16/32, float32/64, bool, interface{} +// AND values of type type int8/16/32, uint16/32 // This should provide adequate "typical" implementations. // // Note that fast track decode functions must handle values for which an address cannot be obtained. @@ -50,7 +51,7 @@ type fastpathE struct { decfn func(*Decoder, *codecFnInfo, reflect.Value) } -type fastpathA [271]fastpathE +type fastpathA [88]fastpathE func (x *fastpathA) index(rtid uintptr) int { // use binary search to grab the index (adapted from sort/search.go) @@ -96,6 +97,7 @@ func init() { fn([]interface{}(nil), (*Encoder).fastpathEncSliceIntfR, (*Decoder).fastpathDecSliceIntfR) fn([]string(nil), (*Encoder).fastpathEncSliceStringR, (*Decoder).fastpathDecSliceStringR) + fn([][]byte(nil), (*Encoder).fastpathEncSliceBytesR, (*Decoder).fastpathDecSliceBytesR) fn([]float32(nil), (*Encoder).fastpathEncSliceFloat32R, (*Decoder).fastpathDecSliceFloat32R) fn([]float64(nil), (*Encoder).fastpathEncSliceFloat64R, (*Decoder).fastpathDecSliceFloat64R) fn([]uint(nil), (*Encoder).fastpathEncSliceUintR, (*Decoder).fastpathDecSliceUintR) @@ -110,262 +112,78 @@ func init() { fn([]int64(nil), (*Encoder).fastpathEncSliceInt64R, (*Decoder).fastpathDecSliceInt64R) fn([]bool(nil), (*Encoder).fastpathEncSliceBoolR, (*Decoder).fastpathDecSliceBoolR) - fn(map[interface{}]interface{}(nil), (*Encoder).fastpathEncMapIntfIntfR, (*Decoder).fastpathDecMapIntfIntfR) - fn(map[interface{}]string(nil), (*Encoder).fastpathEncMapIntfStringR, (*Decoder).fastpathDecMapIntfStringR) - fn(map[interface{}]uint(nil), (*Encoder).fastpathEncMapIntfUintR, (*Decoder).fastpathDecMapIntfUintR) - fn(map[interface{}]uint8(nil), (*Encoder).fastpathEncMapIntfUint8R, (*Decoder).fastpathDecMapIntfUint8R) - fn(map[interface{}]uint16(nil), (*Encoder).fastpathEncMapIntfUint16R, (*Decoder).fastpathDecMapIntfUint16R) - fn(map[interface{}]uint32(nil), (*Encoder).fastpathEncMapIntfUint32R, (*Decoder).fastpathDecMapIntfUint32R) - fn(map[interface{}]uint64(nil), (*Encoder).fastpathEncMapIntfUint64R, (*Decoder).fastpathDecMapIntfUint64R) - fn(map[interface{}]uintptr(nil), (*Encoder).fastpathEncMapIntfUintptrR, (*Decoder).fastpathDecMapIntfUintptrR) - fn(map[interface{}]int(nil), (*Encoder).fastpathEncMapIntfIntR, (*Decoder).fastpathDecMapIntfIntR) - fn(map[interface{}]int8(nil), (*Encoder).fastpathEncMapIntfInt8R, (*Decoder).fastpathDecMapIntfInt8R) - fn(map[interface{}]int16(nil), (*Encoder).fastpathEncMapIntfInt16R, (*Decoder).fastpathDecMapIntfInt16R) - fn(map[interface{}]int32(nil), (*Encoder).fastpathEncMapIntfInt32R, (*Decoder).fastpathDecMapIntfInt32R) - fn(map[interface{}]int64(nil), (*Encoder).fastpathEncMapIntfInt64R, (*Decoder).fastpathDecMapIntfInt64R) - fn(map[interface{}]float32(nil), (*Encoder).fastpathEncMapIntfFloat32R, (*Decoder).fastpathDecMapIntfFloat32R) - fn(map[interface{}]float64(nil), (*Encoder).fastpathEncMapIntfFloat64R, (*Decoder).fastpathDecMapIntfFloat64R) - fn(map[interface{}]bool(nil), (*Encoder).fastpathEncMapIntfBoolR, (*Decoder).fastpathDecMapIntfBoolR) fn(map[string]interface{}(nil), (*Encoder).fastpathEncMapStringIntfR, (*Decoder).fastpathDecMapStringIntfR) fn(map[string]string(nil), (*Encoder).fastpathEncMapStringStringR, (*Decoder).fastpathDecMapStringStringR) + fn(map[string][]byte(nil), (*Encoder).fastpathEncMapStringBytesR, (*Decoder).fastpathDecMapStringBytesR) fn(map[string]uint(nil), (*Encoder).fastpathEncMapStringUintR, (*Decoder).fastpathDecMapStringUintR) fn(map[string]uint8(nil), (*Encoder).fastpathEncMapStringUint8R, (*Decoder).fastpathDecMapStringUint8R) - fn(map[string]uint16(nil), (*Encoder).fastpathEncMapStringUint16R, (*Decoder).fastpathDecMapStringUint16R) - fn(map[string]uint32(nil), (*Encoder).fastpathEncMapStringUint32R, (*Decoder).fastpathDecMapStringUint32R) fn(map[string]uint64(nil), (*Encoder).fastpathEncMapStringUint64R, (*Decoder).fastpathDecMapStringUint64R) fn(map[string]uintptr(nil), (*Encoder).fastpathEncMapStringUintptrR, (*Decoder).fastpathDecMapStringUintptrR) fn(map[string]int(nil), (*Encoder).fastpathEncMapStringIntR, (*Decoder).fastpathDecMapStringIntR) - fn(map[string]int8(nil), (*Encoder).fastpathEncMapStringInt8R, (*Decoder).fastpathDecMapStringInt8R) - fn(map[string]int16(nil), (*Encoder).fastpathEncMapStringInt16R, (*Decoder).fastpathDecMapStringInt16R) - fn(map[string]int32(nil), (*Encoder).fastpathEncMapStringInt32R, (*Decoder).fastpathDecMapStringInt32R) fn(map[string]int64(nil), (*Encoder).fastpathEncMapStringInt64R, (*Decoder).fastpathDecMapStringInt64R) fn(map[string]float32(nil), (*Encoder).fastpathEncMapStringFloat32R, (*Decoder).fastpathDecMapStringFloat32R) fn(map[string]float64(nil), (*Encoder).fastpathEncMapStringFloat64R, (*Decoder).fastpathDecMapStringFloat64R) fn(map[string]bool(nil), (*Encoder).fastpathEncMapStringBoolR, (*Decoder).fastpathDecMapStringBoolR) - fn(map[float32]interface{}(nil), (*Encoder).fastpathEncMapFloat32IntfR, (*Decoder).fastpathDecMapFloat32IntfR) - fn(map[float32]string(nil), (*Encoder).fastpathEncMapFloat32StringR, (*Decoder).fastpathDecMapFloat32StringR) - fn(map[float32]uint(nil), (*Encoder).fastpathEncMapFloat32UintR, (*Decoder).fastpathDecMapFloat32UintR) - fn(map[float32]uint8(nil), (*Encoder).fastpathEncMapFloat32Uint8R, (*Decoder).fastpathDecMapFloat32Uint8R) - fn(map[float32]uint16(nil), (*Encoder).fastpathEncMapFloat32Uint16R, (*Decoder).fastpathDecMapFloat32Uint16R) - fn(map[float32]uint32(nil), (*Encoder).fastpathEncMapFloat32Uint32R, (*Decoder).fastpathDecMapFloat32Uint32R) - fn(map[float32]uint64(nil), (*Encoder).fastpathEncMapFloat32Uint64R, (*Decoder).fastpathDecMapFloat32Uint64R) - fn(map[float32]uintptr(nil), (*Encoder).fastpathEncMapFloat32UintptrR, (*Decoder).fastpathDecMapFloat32UintptrR) - fn(map[float32]int(nil), (*Encoder).fastpathEncMapFloat32IntR, (*Decoder).fastpathDecMapFloat32IntR) - fn(map[float32]int8(nil), (*Encoder).fastpathEncMapFloat32Int8R, (*Decoder).fastpathDecMapFloat32Int8R) - fn(map[float32]int16(nil), (*Encoder).fastpathEncMapFloat32Int16R, (*Decoder).fastpathDecMapFloat32Int16R) - fn(map[float32]int32(nil), (*Encoder).fastpathEncMapFloat32Int32R, (*Decoder).fastpathDecMapFloat32Int32R) - fn(map[float32]int64(nil), (*Encoder).fastpathEncMapFloat32Int64R, (*Decoder).fastpathDecMapFloat32Int64R) - fn(map[float32]float32(nil), (*Encoder).fastpathEncMapFloat32Float32R, (*Decoder).fastpathDecMapFloat32Float32R) - fn(map[float32]float64(nil), (*Encoder).fastpathEncMapFloat32Float64R, (*Decoder).fastpathDecMapFloat32Float64R) - fn(map[float32]bool(nil), (*Encoder).fastpathEncMapFloat32BoolR, (*Decoder).fastpathDecMapFloat32BoolR) - fn(map[float64]interface{}(nil), (*Encoder).fastpathEncMapFloat64IntfR, (*Decoder).fastpathDecMapFloat64IntfR) - fn(map[float64]string(nil), (*Encoder).fastpathEncMapFloat64StringR, (*Decoder).fastpathDecMapFloat64StringR) - fn(map[float64]uint(nil), (*Encoder).fastpathEncMapFloat64UintR, (*Decoder).fastpathDecMapFloat64UintR) - fn(map[float64]uint8(nil), (*Encoder).fastpathEncMapFloat64Uint8R, (*Decoder).fastpathDecMapFloat64Uint8R) - fn(map[float64]uint16(nil), (*Encoder).fastpathEncMapFloat64Uint16R, (*Decoder).fastpathDecMapFloat64Uint16R) - fn(map[float64]uint32(nil), (*Encoder).fastpathEncMapFloat64Uint32R, (*Decoder).fastpathDecMapFloat64Uint32R) - fn(map[float64]uint64(nil), (*Encoder).fastpathEncMapFloat64Uint64R, (*Decoder).fastpathDecMapFloat64Uint64R) - fn(map[float64]uintptr(nil), (*Encoder).fastpathEncMapFloat64UintptrR, (*Decoder).fastpathDecMapFloat64UintptrR) - fn(map[float64]int(nil), (*Encoder).fastpathEncMapFloat64IntR, (*Decoder).fastpathDecMapFloat64IntR) - fn(map[float64]int8(nil), (*Encoder).fastpathEncMapFloat64Int8R, (*Decoder).fastpathDecMapFloat64Int8R) - fn(map[float64]int16(nil), (*Encoder).fastpathEncMapFloat64Int16R, (*Decoder).fastpathDecMapFloat64Int16R) - fn(map[float64]int32(nil), (*Encoder).fastpathEncMapFloat64Int32R, (*Decoder).fastpathDecMapFloat64Int32R) - fn(map[float64]int64(nil), (*Encoder).fastpathEncMapFloat64Int64R, (*Decoder).fastpathDecMapFloat64Int64R) - fn(map[float64]float32(nil), (*Encoder).fastpathEncMapFloat64Float32R, (*Decoder).fastpathDecMapFloat64Float32R) - fn(map[float64]float64(nil), (*Encoder).fastpathEncMapFloat64Float64R, (*Decoder).fastpathDecMapFloat64Float64R) - fn(map[float64]bool(nil), (*Encoder).fastpathEncMapFloat64BoolR, (*Decoder).fastpathDecMapFloat64BoolR) fn(map[uint]interface{}(nil), (*Encoder).fastpathEncMapUintIntfR, (*Decoder).fastpathDecMapUintIntfR) fn(map[uint]string(nil), (*Encoder).fastpathEncMapUintStringR, (*Decoder).fastpathDecMapUintStringR) + fn(map[uint][]byte(nil), (*Encoder).fastpathEncMapUintBytesR, (*Decoder).fastpathDecMapUintBytesR) fn(map[uint]uint(nil), (*Encoder).fastpathEncMapUintUintR, (*Decoder).fastpathDecMapUintUintR) fn(map[uint]uint8(nil), (*Encoder).fastpathEncMapUintUint8R, (*Decoder).fastpathDecMapUintUint8R) - fn(map[uint]uint16(nil), (*Encoder).fastpathEncMapUintUint16R, (*Decoder).fastpathDecMapUintUint16R) - fn(map[uint]uint32(nil), (*Encoder).fastpathEncMapUintUint32R, (*Decoder).fastpathDecMapUintUint32R) fn(map[uint]uint64(nil), (*Encoder).fastpathEncMapUintUint64R, (*Decoder).fastpathDecMapUintUint64R) fn(map[uint]uintptr(nil), (*Encoder).fastpathEncMapUintUintptrR, (*Decoder).fastpathDecMapUintUintptrR) fn(map[uint]int(nil), (*Encoder).fastpathEncMapUintIntR, (*Decoder).fastpathDecMapUintIntR) - fn(map[uint]int8(nil), (*Encoder).fastpathEncMapUintInt8R, (*Decoder).fastpathDecMapUintInt8R) - fn(map[uint]int16(nil), (*Encoder).fastpathEncMapUintInt16R, (*Decoder).fastpathDecMapUintInt16R) - fn(map[uint]int32(nil), (*Encoder).fastpathEncMapUintInt32R, (*Decoder).fastpathDecMapUintInt32R) fn(map[uint]int64(nil), (*Encoder).fastpathEncMapUintInt64R, (*Decoder).fastpathDecMapUintInt64R) fn(map[uint]float32(nil), (*Encoder).fastpathEncMapUintFloat32R, (*Decoder).fastpathDecMapUintFloat32R) fn(map[uint]float64(nil), (*Encoder).fastpathEncMapUintFloat64R, (*Decoder).fastpathDecMapUintFloat64R) fn(map[uint]bool(nil), (*Encoder).fastpathEncMapUintBoolR, (*Decoder).fastpathDecMapUintBoolR) fn(map[uint8]interface{}(nil), (*Encoder).fastpathEncMapUint8IntfR, (*Decoder).fastpathDecMapUint8IntfR) fn(map[uint8]string(nil), (*Encoder).fastpathEncMapUint8StringR, (*Decoder).fastpathDecMapUint8StringR) + fn(map[uint8][]byte(nil), (*Encoder).fastpathEncMapUint8BytesR, (*Decoder).fastpathDecMapUint8BytesR) fn(map[uint8]uint(nil), (*Encoder).fastpathEncMapUint8UintR, (*Decoder).fastpathDecMapUint8UintR) fn(map[uint8]uint8(nil), (*Encoder).fastpathEncMapUint8Uint8R, (*Decoder).fastpathDecMapUint8Uint8R) - fn(map[uint8]uint16(nil), (*Encoder).fastpathEncMapUint8Uint16R, (*Decoder).fastpathDecMapUint8Uint16R) - fn(map[uint8]uint32(nil), (*Encoder).fastpathEncMapUint8Uint32R, (*Decoder).fastpathDecMapUint8Uint32R) fn(map[uint8]uint64(nil), (*Encoder).fastpathEncMapUint8Uint64R, (*Decoder).fastpathDecMapUint8Uint64R) fn(map[uint8]uintptr(nil), (*Encoder).fastpathEncMapUint8UintptrR, (*Decoder).fastpathDecMapUint8UintptrR) fn(map[uint8]int(nil), (*Encoder).fastpathEncMapUint8IntR, (*Decoder).fastpathDecMapUint8IntR) - fn(map[uint8]int8(nil), (*Encoder).fastpathEncMapUint8Int8R, (*Decoder).fastpathDecMapUint8Int8R) - fn(map[uint8]int16(nil), (*Encoder).fastpathEncMapUint8Int16R, (*Decoder).fastpathDecMapUint8Int16R) - fn(map[uint8]int32(nil), (*Encoder).fastpathEncMapUint8Int32R, (*Decoder).fastpathDecMapUint8Int32R) fn(map[uint8]int64(nil), (*Encoder).fastpathEncMapUint8Int64R, (*Decoder).fastpathDecMapUint8Int64R) fn(map[uint8]float32(nil), (*Encoder).fastpathEncMapUint8Float32R, (*Decoder).fastpathDecMapUint8Float32R) fn(map[uint8]float64(nil), (*Encoder).fastpathEncMapUint8Float64R, (*Decoder).fastpathDecMapUint8Float64R) fn(map[uint8]bool(nil), (*Encoder).fastpathEncMapUint8BoolR, (*Decoder).fastpathDecMapUint8BoolR) - fn(map[uint16]interface{}(nil), (*Encoder).fastpathEncMapUint16IntfR, (*Decoder).fastpathDecMapUint16IntfR) - fn(map[uint16]string(nil), (*Encoder).fastpathEncMapUint16StringR, (*Decoder).fastpathDecMapUint16StringR) - fn(map[uint16]uint(nil), (*Encoder).fastpathEncMapUint16UintR, (*Decoder).fastpathDecMapUint16UintR) - fn(map[uint16]uint8(nil), (*Encoder).fastpathEncMapUint16Uint8R, (*Decoder).fastpathDecMapUint16Uint8R) - fn(map[uint16]uint16(nil), (*Encoder).fastpathEncMapUint16Uint16R, (*Decoder).fastpathDecMapUint16Uint16R) - fn(map[uint16]uint32(nil), (*Encoder).fastpathEncMapUint16Uint32R, (*Decoder).fastpathDecMapUint16Uint32R) - fn(map[uint16]uint64(nil), (*Encoder).fastpathEncMapUint16Uint64R, (*Decoder).fastpathDecMapUint16Uint64R) - fn(map[uint16]uintptr(nil), (*Encoder).fastpathEncMapUint16UintptrR, (*Decoder).fastpathDecMapUint16UintptrR) - fn(map[uint16]int(nil), (*Encoder).fastpathEncMapUint16IntR, (*Decoder).fastpathDecMapUint16IntR) - fn(map[uint16]int8(nil), (*Encoder).fastpathEncMapUint16Int8R, (*Decoder).fastpathDecMapUint16Int8R) - fn(map[uint16]int16(nil), (*Encoder).fastpathEncMapUint16Int16R, (*Decoder).fastpathDecMapUint16Int16R) - fn(map[uint16]int32(nil), (*Encoder).fastpathEncMapUint16Int32R, (*Decoder).fastpathDecMapUint16Int32R) - fn(map[uint16]int64(nil), (*Encoder).fastpathEncMapUint16Int64R, (*Decoder).fastpathDecMapUint16Int64R) - fn(map[uint16]float32(nil), (*Encoder).fastpathEncMapUint16Float32R, (*Decoder).fastpathDecMapUint16Float32R) - fn(map[uint16]float64(nil), (*Encoder).fastpathEncMapUint16Float64R, (*Decoder).fastpathDecMapUint16Float64R) - fn(map[uint16]bool(nil), (*Encoder).fastpathEncMapUint16BoolR, (*Decoder).fastpathDecMapUint16BoolR) - fn(map[uint32]interface{}(nil), (*Encoder).fastpathEncMapUint32IntfR, (*Decoder).fastpathDecMapUint32IntfR) - fn(map[uint32]string(nil), (*Encoder).fastpathEncMapUint32StringR, (*Decoder).fastpathDecMapUint32StringR) - fn(map[uint32]uint(nil), (*Encoder).fastpathEncMapUint32UintR, (*Decoder).fastpathDecMapUint32UintR) - fn(map[uint32]uint8(nil), (*Encoder).fastpathEncMapUint32Uint8R, (*Decoder).fastpathDecMapUint32Uint8R) - fn(map[uint32]uint16(nil), (*Encoder).fastpathEncMapUint32Uint16R, (*Decoder).fastpathDecMapUint32Uint16R) - fn(map[uint32]uint32(nil), (*Encoder).fastpathEncMapUint32Uint32R, (*Decoder).fastpathDecMapUint32Uint32R) - fn(map[uint32]uint64(nil), (*Encoder).fastpathEncMapUint32Uint64R, (*Decoder).fastpathDecMapUint32Uint64R) - fn(map[uint32]uintptr(nil), (*Encoder).fastpathEncMapUint32UintptrR, (*Decoder).fastpathDecMapUint32UintptrR) - fn(map[uint32]int(nil), (*Encoder).fastpathEncMapUint32IntR, (*Decoder).fastpathDecMapUint32IntR) - fn(map[uint32]int8(nil), (*Encoder).fastpathEncMapUint32Int8R, (*Decoder).fastpathDecMapUint32Int8R) - fn(map[uint32]int16(nil), (*Encoder).fastpathEncMapUint32Int16R, (*Decoder).fastpathDecMapUint32Int16R) - fn(map[uint32]int32(nil), (*Encoder).fastpathEncMapUint32Int32R, (*Decoder).fastpathDecMapUint32Int32R) - fn(map[uint32]int64(nil), (*Encoder).fastpathEncMapUint32Int64R, (*Decoder).fastpathDecMapUint32Int64R) - fn(map[uint32]float32(nil), (*Encoder).fastpathEncMapUint32Float32R, (*Decoder).fastpathDecMapUint32Float32R) - fn(map[uint32]float64(nil), (*Encoder).fastpathEncMapUint32Float64R, (*Decoder).fastpathDecMapUint32Float64R) - fn(map[uint32]bool(nil), (*Encoder).fastpathEncMapUint32BoolR, (*Decoder).fastpathDecMapUint32BoolR) fn(map[uint64]interface{}(nil), (*Encoder).fastpathEncMapUint64IntfR, (*Decoder).fastpathDecMapUint64IntfR) fn(map[uint64]string(nil), (*Encoder).fastpathEncMapUint64StringR, (*Decoder).fastpathDecMapUint64StringR) + fn(map[uint64][]byte(nil), (*Encoder).fastpathEncMapUint64BytesR, (*Decoder).fastpathDecMapUint64BytesR) fn(map[uint64]uint(nil), (*Encoder).fastpathEncMapUint64UintR, (*Decoder).fastpathDecMapUint64UintR) fn(map[uint64]uint8(nil), (*Encoder).fastpathEncMapUint64Uint8R, (*Decoder).fastpathDecMapUint64Uint8R) - fn(map[uint64]uint16(nil), (*Encoder).fastpathEncMapUint64Uint16R, (*Decoder).fastpathDecMapUint64Uint16R) - fn(map[uint64]uint32(nil), (*Encoder).fastpathEncMapUint64Uint32R, (*Decoder).fastpathDecMapUint64Uint32R) fn(map[uint64]uint64(nil), (*Encoder).fastpathEncMapUint64Uint64R, (*Decoder).fastpathDecMapUint64Uint64R) fn(map[uint64]uintptr(nil), (*Encoder).fastpathEncMapUint64UintptrR, (*Decoder).fastpathDecMapUint64UintptrR) fn(map[uint64]int(nil), (*Encoder).fastpathEncMapUint64IntR, (*Decoder).fastpathDecMapUint64IntR) - fn(map[uint64]int8(nil), (*Encoder).fastpathEncMapUint64Int8R, (*Decoder).fastpathDecMapUint64Int8R) - fn(map[uint64]int16(nil), (*Encoder).fastpathEncMapUint64Int16R, (*Decoder).fastpathDecMapUint64Int16R) - fn(map[uint64]int32(nil), (*Encoder).fastpathEncMapUint64Int32R, (*Decoder).fastpathDecMapUint64Int32R) fn(map[uint64]int64(nil), (*Encoder).fastpathEncMapUint64Int64R, (*Decoder).fastpathDecMapUint64Int64R) fn(map[uint64]float32(nil), (*Encoder).fastpathEncMapUint64Float32R, (*Decoder).fastpathDecMapUint64Float32R) fn(map[uint64]float64(nil), (*Encoder).fastpathEncMapUint64Float64R, (*Decoder).fastpathDecMapUint64Float64R) fn(map[uint64]bool(nil), (*Encoder).fastpathEncMapUint64BoolR, (*Decoder).fastpathDecMapUint64BoolR) - fn(map[uintptr]interface{}(nil), (*Encoder).fastpathEncMapUintptrIntfR, (*Decoder).fastpathDecMapUintptrIntfR) - fn(map[uintptr]string(nil), (*Encoder).fastpathEncMapUintptrStringR, (*Decoder).fastpathDecMapUintptrStringR) - fn(map[uintptr]uint(nil), (*Encoder).fastpathEncMapUintptrUintR, (*Decoder).fastpathDecMapUintptrUintR) - fn(map[uintptr]uint8(nil), (*Encoder).fastpathEncMapUintptrUint8R, (*Decoder).fastpathDecMapUintptrUint8R) - fn(map[uintptr]uint16(nil), (*Encoder).fastpathEncMapUintptrUint16R, (*Decoder).fastpathDecMapUintptrUint16R) - fn(map[uintptr]uint32(nil), (*Encoder).fastpathEncMapUintptrUint32R, (*Decoder).fastpathDecMapUintptrUint32R) - fn(map[uintptr]uint64(nil), (*Encoder).fastpathEncMapUintptrUint64R, (*Decoder).fastpathDecMapUintptrUint64R) - fn(map[uintptr]uintptr(nil), (*Encoder).fastpathEncMapUintptrUintptrR, (*Decoder).fastpathDecMapUintptrUintptrR) - fn(map[uintptr]int(nil), (*Encoder).fastpathEncMapUintptrIntR, (*Decoder).fastpathDecMapUintptrIntR) - fn(map[uintptr]int8(nil), (*Encoder).fastpathEncMapUintptrInt8R, (*Decoder).fastpathDecMapUintptrInt8R) - fn(map[uintptr]int16(nil), (*Encoder).fastpathEncMapUintptrInt16R, (*Decoder).fastpathDecMapUintptrInt16R) - fn(map[uintptr]int32(nil), (*Encoder).fastpathEncMapUintptrInt32R, (*Decoder).fastpathDecMapUintptrInt32R) - fn(map[uintptr]int64(nil), (*Encoder).fastpathEncMapUintptrInt64R, (*Decoder).fastpathDecMapUintptrInt64R) - fn(map[uintptr]float32(nil), (*Encoder).fastpathEncMapUintptrFloat32R, (*Decoder).fastpathDecMapUintptrFloat32R) - fn(map[uintptr]float64(nil), (*Encoder).fastpathEncMapUintptrFloat64R, (*Decoder).fastpathDecMapUintptrFloat64R) - fn(map[uintptr]bool(nil), (*Encoder).fastpathEncMapUintptrBoolR, (*Decoder).fastpathDecMapUintptrBoolR) fn(map[int]interface{}(nil), (*Encoder).fastpathEncMapIntIntfR, (*Decoder).fastpathDecMapIntIntfR) fn(map[int]string(nil), (*Encoder).fastpathEncMapIntStringR, (*Decoder).fastpathDecMapIntStringR) + fn(map[int][]byte(nil), (*Encoder).fastpathEncMapIntBytesR, (*Decoder).fastpathDecMapIntBytesR) fn(map[int]uint(nil), (*Encoder).fastpathEncMapIntUintR, (*Decoder).fastpathDecMapIntUintR) fn(map[int]uint8(nil), (*Encoder).fastpathEncMapIntUint8R, (*Decoder).fastpathDecMapIntUint8R) - fn(map[int]uint16(nil), (*Encoder).fastpathEncMapIntUint16R, (*Decoder).fastpathDecMapIntUint16R) - fn(map[int]uint32(nil), (*Encoder).fastpathEncMapIntUint32R, (*Decoder).fastpathDecMapIntUint32R) fn(map[int]uint64(nil), (*Encoder).fastpathEncMapIntUint64R, (*Decoder).fastpathDecMapIntUint64R) fn(map[int]uintptr(nil), (*Encoder).fastpathEncMapIntUintptrR, (*Decoder).fastpathDecMapIntUintptrR) fn(map[int]int(nil), (*Encoder).fastpathEncMapIntIntR, (*Decoder).fastpathDecMapIntIntR) - fn(map[int]int8(nil), (*Encoder).fastpathEncMapIntInt8R, (*Decoder).fastpathDecMapIntInt8R) - fn(map[int]int16(nil), (*Encoder).fastpathEncMapIntInt16R, (*Decoder).fastpathDecMapIntInt16R) - fn(map[int]int32(nil), (*Encoder).fastpathEncMapIntInt32R, (*Decoder).fastpathDecMapIntInt32R) fn(map[int]int64(nil), (*Encoder).fastpathEncMapIntInt64R, (*Decoder).fastpathDecMapIntInt64R) fn(map[int]float32(nil), (*Encoder).fastpathEncMapIntFloat32R, (*Decoder).fastpathDecMapIntFloat32R) fn(map[int]float64(nil), (*Encoder).fastpathEncMapIntFloat64R, (*Decoder).fastpathDecMapIntFloat64R) fn(map[int]bool(nil), (*Encoder).fastpathEncMapIntBoolR, (*Decoder).fastpathDecMapIntBoolR) - fn(map[int8]interface{}(nil), (*Encoder).fastpathEncMapInt8IntfR, (*Decoder).fastpathDecMapInt8IntfR) - fn(map[int8]string(nil), (*Encoder).fastpathEncMapInt8StringR, (*Decoder).fastpathDecMapInt8StringR) - fn(map[int8]uint(nil), (*Encoder).fastpathEncMapInt8UintR, (*Decoder).fastpathDecMapInt8UintR) - fn(map[int8]uint8(nil), (*Encoder).fastpathEncMapInt8Uint8R, (*Decoder).fastpathDecMapInt8Uint8R) - fn(map[int8]uint16(nil), (*Encoder).fastpathEncMapInt8Uint16R, (*Decoder).fastpathDecMapInt8Uint16R) - fn(map[int8]uint32(nil), (*Encoder).fastpathEncMapInt8Uint32R, (*Decoder).fastpathDecMapInt8Uint32R) - fn(map[int8]uint64(nil), (*Encoder).fastpathEncMapInt8Uint64R, (*Decoder).fastpathDecMapInt8Uint64R) - fn(map[int8]uintptr(nil), (*Encoder).fastpathEncMapInt8UintptrR, (*Decoder).fastpathDecMapInt8UintptrR) - fn(map[int8]int(nil), (*Encoder).fastpathEncMapInt8IntR, (*Decoder).fastpathDecMapInt8IntR) - fn(map[int8]int8(nil), (*Encoder).fastpathEncMapInt8Int8R, (*Decoder).fastpathDecMapInt8Int8R) - fn(map[int8]int16(nil), (*Encoder).fastpathEncMapInt8Int16R, (*Decoder).fastpathDecMapInt8Int16R) - fn(map[int8]int32(nil), (*Encoder).fastpathEncMapInt8Int32R, (*Decoder).fastpathDecMapInt8Int32R) - fn(map[int8]int64(nil), (*Encoder).fastpathEncMapInt8Int64R, (*Decoder).fastpathDecMapInt8Int64R) - fn(map[int8]float32(nil), (*Encoder).fastpathEncMapInt8Float32R, (*Decoder).fastpathDecMapInt8Float32R) - fn(map[int8]float64(nil), (*Encoder).fastpathEncMapInt8Float64R, (*Decoder).fastpathDecMapInt8Float64R) - fn(map[int8]bool(nil), (*Encoder).fastpathEncMapInt8BoolR, (*Decoder).fastpathDecMapInt8BoolR) - fn(map[int16]interface{}(nil), (*Encoder).fastpathEncMapInt16IntfR, (*Decoder).fastpathDecMapInt16IntfR) - fn(map[int16]string(nil), (*Encoder).fastpathEncMapInt16StringR, (*Decoder).fastpathDecMapInt16StringR) - fn(map[int16]uint(nil), (*Encoder).fastpathEncMapInt16UintR, (*Decoder).fastpathDecMapInt16UintR) - fn(map[int16]uint8(nil), (*Encoder).fastpathEncMapInt16Uint8R, (*Decoder).fastpathDecMapInt16Uint8R) - fn(map[int16]uint16(nil), (*Encoder).fastpathEncMapInt16Uint16R, (*Decoder).fastpathDecMapInt16Uint16R) - fn(map[int16]uint32(nil), (*Encoder).fastpathEncMapInt16Uint32R, (*Decoder).fastpathDecMapInt16Uint32R) - fn(map[int16]uint64(nil), (*Encoder).fastpathEncMapInt16Uint64R, (*Decoder).fastpathDecMapInt16Uint64R) - fn(map[int16]uintptr(nil), (*Encoder).fastpathEncMapInt16UintptrR, (*Decoder).fastpathDecMapInt16UintptrR) - fn(map[int16]int(nil), (*Encoder).fastpathEncMapInt16IntR, (*Decoder).fastpathDecMapInt16IntR) - fn(map[int16]int8(nil), (*Encoder).fastpathEncMapInt16Int8R, (*Decoder).fastpathDecMapInt16Int8R) - fn(map[int16]int16(nil), (*Encoder).fastpathEncMapInt16Int16R, (*Decoder).fastpathDecMapInt16Int16R) - fn(map[int16]int32(nil), (*Encoder).fastpathEncMapInt16Int32R, (*Decoder).fastpathDecMapInt16Int32R) - fn(map[int16]int64(nil), (*Encoder).fastpathEncMapInt16Int64R, (*Decoder).fastpathDecMapInt16Int64R) - fn(map[int16]float32(nil), (*Encoder).fastpathEncMapInt16Float32R, (*Decoder).fastpathDecMapInt16Float32R) - fn(map[int16]float64(nil), (*Encoder).fastpathEncMapInt16Float64R, (*Decoder).fastpathDecMapInt16Float64R) - fn(map[int16]bool(nil), (*Encoder).fastpathEncMapInt16BoolR, (*Decoder).fastpathDecMapInt16BoolR) - fn(map[int32]interface{}(nil), (*Encoder).fastpathEncMapInt32IntfR, (*Decoder).fastpathDecMapInt32IntfR) - fn(map[int32]string(nil), (*Encoder).fastpathEncMapInt32StringR, (*Decoder).fastpathDecMapInt32StringR) - fn(map[int32]uint(nil), (*Encoder).fastpathEncMapInt32UintR, (*Decoder).fastpathDecMapInt32UintR) - fn(map[int32]uint8(nil), (*Encoder).fastpathEncMapInt32Uint8R, (*Decoder).fastpathDecMapInt32Uint8R) - fn(map[int32]uint16(nil), (*Encoder).fastpathEncMapInt32Uint16R, (*Decoder).fastpathDecMapInt32Uint16R) - fn(map[int32]uint32(nil), (*Encoder).fastpathEncMapInt32Uint32R, (*Decoder).fastpathDecMapInt32Uint32R) - fn(map[int32]uint64(nil), (*Encoder).fastpathEncMapInt32Uint64R, (*Decoder).fastpathDecMapInt32Uint64R) - fn(map[int32]uintptr(nil), (*Encoder).fastpathEncMapInt32UintptrR, (*Decoder).fastpathDecMapInt32UintptrR) - fn(map[int32]int(nil), (*Encoder).fastpathEncMapInt32IntR, (*Decoder).fastpathDecMapInt32IntR) - fn(map[int32]int8(nil), (*Encoder).fastpathEncMapInt32Int8R, (*Decoder).fastpathDecMapInt32Int8R) - fn(map[int32]int16(nil), (*Encoder).fastpathEncMapInt32Int16R, (*Decoder).fastpathDecMapInt32Int16R) - fn(map[int32]int32(nil), (*Encoder).fastpathEncMapInt32Int32R, (*Decoder).fastpathDecMapInt32Int32R) - fn(map[int32]int64(nil), (*Encoder).fastpathEncMapInt32Int64R, (*Decoder).fastpathDecMapInt32Int64R) - fn(map[int32]float32(nil), (*Encoder).fastpathEncMapInt32Float32R, (*Decoder).fastpathDecMapInt32Float32R) - fn(map[int32]float64(nil), (*Encoder).fastpathEncMapInt32Float64R, (*Decoder).fastpathDecMapInt32Float64R) - fn(map[int32]bool(nil), (*Encoder).fastpathEncMapInt32BoolR, (*Decoder).fastpathDecMapInt32BoolR) fn(map[int64]interface{}(nil), (*Encoder).fastpathEncMapInt64IntfR, (*Decoder).fastpathDecMapInt64IntfR) fn(map[int64]string(nil), (*Encoder).fastpathEncMapInt64StringR, (*Decoder).fastpathDecMapInt64StringR) + fn(map[int64][]byte(nil), (*Encoder).fastpathEncMapInt64BytesR, (*Decoder).fastpathDecMapInt64BytesR) fn(map[int64]uint(nil), (*Encoder).fastpathEncMapInt64UintR, (*Decoder).fastpathDecMapInt64UintR) fn(map[int64]uint8(nil), (*Encoder).fastpathEncMapInt64Uint8R, (*Decoder).fastpathDecMapInt64Uint8R) - fn(map[int64]uint16(nil), (*Encoder).fastpathEncMapInt64Uint16R, (*Decoder).fastpathDecMapInt64Uint16R) - fn(map[int64]uint32(nil), (*Encoder).fastpathEncMapInt64Uint32R, (*Decoder).fastpathDecMapInt64Uint32R) fn(map[int64]uint64(nil), (*Encoder).fastpathEncMapInt64Uint64R, (*Decoder).fastpathDecMapInt64Uint64R) fn(map[int64]uintptr(nil), (*Encoder).fastpathEncMapInt64UintptrR, (*Decoder).fastpathDecMapInt64UintptrR) fn(map[int64]int(nil), (*Encoder).fastpathEncMapInt64IntR, (*Decoder).fastpathDecMapInt64IntR) - fn(map[int64]int8(nil), (*Encoder).fastpathEncMapInt64Int8R, (*Decoder).fastpathDecMapInt64Int8R) - fn(map[int64]int16(nil), (*Encoder).fastpathEncMapInt64Int16R, (*Decoder).fastpathDecMapInt64Int16R) - fn(map[int64]int32(nil), (*Encoder).fastpathEncMapInt64Int32R, (*Decoder).fastpathDecMapInt64Int32R) fn(map[int64]int64(nil), (*Encoder).fastpathEncMapInt64Int64R, (*Decoder).fastpathDecMapInt64Int64R) fn(map[int64]float32(nil), (*Encoder).fastpathEncMapInt64Float32R, (*Decoder).fastpathDecMapInt64Float32R) fn(map[int64]float64(nil), (*Encoder).fastpathEncMapInt64Float64R, (*Decoder).fastpathDecMapInt64Float64R) fn(map[int64]bool(nil), (*Encoder).fastpathEncMapInt64BoolR, (*Decoder).fastpathDecMapInt64BoolR) - fn(map[bool]interface{}(nil), (*Encoder).fastpathEncMapBoolIntfR, (*Decoder).fastpathDecMapBoolIntfR) - fn(map[bool]string(nil), (*Encoder).fastpathEncMapBoolStringR, (*Decoder).fastpathDecMapBoolStringR) - fn(map[bool]uint(nil), (*Encoder).fastpathEncMapBoolUintR, (*Decoder).fastpathDecMapBoolUintR) - fn(map[bool]uint8(nil), (*Encoder).fastpathEncMapBoolUint8R, (*Decoder).fastpathDecMapBoolUint8R) - fn(map[bool]uint16(nil), (*Encoder).fastpathEncMapBoolUint16R, (*Decoder).fastpathDecMapBoolUint16R) - fn(map[bool]uint32(nil), (*Encoder).fastpathEncMapBoolUint32R, (*Decoder).fastpathDecMapBoolUint32R) - fn(map[bool]uint64(nil), (*Encoder).fastpathEncMapBoolUint64R, (*Decoder).fastpathDecMapBoolUint64R) - fn(map[bool]uintptr(nil), (*Encoder).fastpathEncMapBoolUintptrR, (*Decoder).fastpathDecMapBoolUintptrR) - fn(map[bool]int(nil), (*Encoder).fastpathEncMapBoolIntR, (*Decoder).fastpathDecMapBoolIntR) - fn(map[bool]int8(nil), (*Encoder).fastpathEncMapBoolInt8R, (*Decoder).fastpathDecMapBoolInt8R) - fn(map[bool]int16(nil), (*Encoder).fastpathEncMapBoolInt16R, (*Decoder).fastpathDecMapBoolInt16R) - fn(map[bool]int32(nil), (*Encoder).fastpathEncMapBoolInt32R, (*Decoder).fastpathDecMapBoolInt32R) - fn(map[bool]int64(nil), (*Encoder).fastpathEncMapBoolInt64R, (*Decoder).fastpathDecMapBoolInt64R) - fn(map[bool]float32(nil), (*Encoder).fastpathEncMapBoolFloat32R, (*Decoder).fastpathDecMapBoolFloat32R) - fn(map[bool]float64(nil), (*Encoder).fastpathEncMapBoolFloat64R, (*Decoder).fastpathDecMapBoolFloat64R) - fn(map[bool]bool(nil), (*Encoder).fastpathEncMapBoolBoolR, (*Decoder).fastpathDecMapBoolBoolR) sort.Sort(fastpathAslice(fastpathAV[:])) } @@ -384,6 +202,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceStringV(v, e) case *[]string: fastpathTV.EncSliceStringV(*v, e) + case [][]byte: + fastpathTV.EncSliceBytesV(v, e) + case *[][]byte: + fastpathTV.EncSliceBytesV(*v, e) case []float32: fastpathTV.EncSliceFloat32V(v, e) case *[]float32: @@ -437,70 +259,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { case *[]bool: fastpathTV.EncSliceBoolV(*v, e) - case map[interface{}]interface{}: - fastpathTV.EncMapIntfIntfV(v, e) - case *map[interface{}]interface{}: - fastpathTV.EncMapIntfIntfV(*v, e) - case map[interface{}]string: - fastpathTV.EncMapIntfStringV(v, e) - case *map[interface{}]string: - fastpathTV.EncMapIntfStringV(*v, e) - case map[interface{}]uint: - fastpathTV.EncMapIntfUintV(v, e) - case *map[interface{}]uint: - fastpathTV.EncMapIntfUintV(*v, e) - case map[interface{}]uint8: - fastpathTV.EncMapIntfUint8V(v, e) - case *map[interface{}]uint8: - fastpathTV.EncMapIntfUint8V(*v, e) - case map[interface{}]uint16: - fastpathTV.EncMapIntfUint16V(v, e) - case *map[interface{}]uint16: - fastpathTV.EncMapIntfUint16V(*v, e) - case map[interface{}]uint32: - fastpathTV.EncMapIntfUint32V(v, e) - case *map[interface{}]uint32: - fastpathTV.EncMapIntfUint32V(*v, e) - case map[interface{}]uint64: - fastpathTV.EncMapIntfUint64V(v, e) - case *map[interface{}]uint64: - fastpathTV.EncMapIntfUint64V(*v, e) - case map[interface{}]uintptr: - fastpathTV.EncMapIntfUintptrV(v, e) - case *map[interface{}]uintptr: - fastpathTV.EncMapIntfUintptrV(*v, e) - case map[interface{}]int: - fastpathTV.EncMapIntfIntV(v, e) - case *map[interface{}]int: - fastpathTV.EncMapIntfIntV(*v, e) - case map[interface{}]int8: - fastpathTV.EncMapIntfInt8V(v, e) - case *map[interface{}]int8: - fastpathTV.EncMapIntfInt8V(*v, e) - case map[interface{}]int16: - fastpathTV.EncMapIntfInt16V(v, e) - case *map[interface{}]int16: - fastpathTV.EncMapIntfInt16V(*v, e) - case map[interface{}]int32: - fastpathTV.EncMapIntfInt32V(v, e) - case *map[interface{}]int32: - fastpathTV.EncMapIntfInt32V(*v, e) - case map[interface{}]int64: - fastpathTV.EncMapIntfInt64V(v, e) - case *map[interface{}]int64: - fastpathTV.EncMapIntfInt64V(*v, e) - case map[interface{}]float32: - fastpathTV.EncMapIntfFloat32V(v, e) - case *map[interface{}]float32: - fastpathTV.EncMapIntfFloat32V(*v, e) - case map[interface{}]float64: - fastpathTV.EncMapIntfFloat64V(v, e) - case *map[interface{}]float64: - fastpathTV.EncMapIntfFloat64V(*v, e) - case map[interface{}]bool: - fastpathTV.EncMapIntfBoolV(v, e) - case *map[interface{}]bool: - fastpathTV.EncMapIntfBoolV(*v, e) case map[string]interface{}: fastpathTV.EncMapStringIntfV(v, e) case *map[string]interface{}: @@ -509,6 +267,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapStringStringV(v, e) case *map[string]string: fastpathTV.EncMapStringStringV(*v, e) + case map[string][]byte: + fastpathTV.EncMapStringBytesV(v, e) + case *map[string][]byte: + fastpathTV.EncMapStringBytesV(*v, e) case map[string]uint: fastpathTV.EncMapStringUintV(v, e) case *map[string]uint: @@ -517,14 +279,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapStringUint8V(v, e) case *map[string]uint8: fastpathTV.EncMapStringUint8V(*v, e) - case map[string]uint16: - fastpathTV.EncMapStringUint16V(v, e) - case *map[string]uint16: - fastpathTV.EncMapStringUint16V(*v, e) - case map[string]uint32: - fastpathTV.EncMapStringUint32V(v, e) - case *map[string]uint32: - fastpathTV.EncMapStringUint32V(*v, e) case map[string]uint64: fastpathTV.EncMapStringUint64V(v, e) case *map[string]uint64: @@ -537,18 +291,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapStringIntV(v, e) case *map[string]int: fastpathTV.EncMapStringIntV(*v, e) - case map[string]int8: - fastpathTV.EncMapStringInt8V(v, e) - case *map[string]int8: - fastpathTV.EncMapStringInt8V(*v, e) - case map[string]int16: - fastpathTV.EncMapStringInt16V(v, e) - case *map[string]int16: - fastpathTV.EncMapStringInt16V(*v, e) - case map[string]int32: - fastpathTV.EncMapStringInt32V(v, e) - case *map[string]int32: - fastpathTV.EncMapStringInt32V(*v, e) case map[string]int64: fastpathTV.EncMapStringInt64V(v, e) case *map[string]int64: @@ -565,134 +307,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapStringBoolV(v, e) case *map[string]bool: fastpathTV.EncMapStringBoolV(*v, e) - case map[float32]interface{}: - fastpathTV.EncMapFloat32IntfV(v, e) - case *map[float32]interface{}: - fastpathTV.EncMapFloat32IntfV(*v, e) - case map[float32]string: - fastpathTV.EncMapFloat32StringV(v, e) - case *map[float32]string: - fastpathTV.EncMapFloat32StringV(*v, e) - case map[float32]uint: - fastpathTV.EncMapFloat32UintV(v, e) - case *map[float32]uint: - fastpathTV.EncMapFloat32UintV(*v, e) - case map[float32]uint8: - fastpathTV.EncMapFloat32Uint8V(v, e) - case *map[float32]uint8: - fastpathTV.EncMapFloat32Uint8V(*v, e) - case map[float32]uint16: - fastpathTV.EncMapFloat32Uint16V(v, e) - case *map[float32]uint16: - fastpathTV.EncMapFloat32Uint16V(*v, e) - case map[float32]uint32: - fastpathTV.EncMapFloat32Uint32V(v, e) - case *map[float32]uint32: - fastpathTV.EncMapFloat32Uint32V(*v, e) - case map[float32]uint64: - fastpathTV.EncMapFloat32Uint64V(v, e) - case *map[float32]uint64: - fastpathTV.EncMapFloat32Uint64V(*v, e) - case map[float32]uintptr: - fastpathTV.EncMapFloat32UintptrV(v, e) - case *map[float32]uintptr: - fastpathTV.EncMapFloat32UintptrV(*v, e) - case map[float32]int: - fastpathTV.EncMapFloat32IntV(v, e) - case *map[float32]int: - fastpathTV.EncMapFloat32IntV(*v, e) - case map[float32]int8: - fastpathTV.EncMapFloat32Int8V(v, e) - case *map[float32]int8: - fastpathTV.EncMapFloat32Int8V(*v, e) - case map[float32]int16: - fastpathTV.EncMapFloat32Int16V(v, e) - case *map[float32]int16: - fastpathTV.EncMapFloat32Int16V(*v, e) - case map[float32]int32: - fastpathTV.EncMapFloat32Int32V(v, e) - case *map[float32]int32: - fastpathTV.EncMapFloat32Int32V(*v, e) - case map[float32]int64: - fastpathTV.EncMapFloat32Int64V(v, e) - case *map[float32]int64: - fastpathTV.EncMapFloat32Int64V(*v, e) - case map[float32]float32: - fastpathTV.EncMapFloat32Float32V(v, e) - case *map[float32]float32: - fastpathTV.EncMapFloat32Float32V(*v, e) - case map[float32]float64: - fastpathTV.EncMapFloat32Float64V(v, e) - case *map[float32]float64: - fastpathTV.EncMapFloat32Float64V(*v, e) - case map[float32]bool: - fastpathTV.EncMapFloat32BoolV(v, e) - case *map[float32]bool: - fastpathTV.EncMapFloat32BoolV(*v, e) - case map[float64]interface{}: - fastpathTV.EncMapFloat64IntfV(v, e) - case *map[float64]interface{}: - fastpathTV.EncMapFloat64IntfV(*v, e) - case map[float64]string: - fastpathTV.EncMapFloat64StringV(v, e) - case *map[float64]string: - fastpathTV.EncMapFloat64StringV(*v, e) - case map[float64]uint: - fastpathTV.EncMapFloat64UintV(v, e) - case *map[float64]uint: - fastpathTV.EncMapFloat64UintV(*v, e) - case map[float64]uint8: - fastpathTV.EncMapFloat64Uint8V(v, e) - case *map[float64]uint8: - fastpathTV.EncMapFloat64Uint8V(*v, e) - case map[float64]uint16: - fastpathTV.EncMapFloat64Uint16V(v, e) - case *map[float64]uint16: - fastpathTV.EncMapFloat64Uint16V(*v, e) - case map[float64]uint32: - fastpathTV.EncMapFloat64Uint32V(v, e) - case *map[float64]uint32: - fastpathTV.EncMapFloat64Uint32V(*v, e) - case map[float64]uint64: - fastpathTV.EncMapFloat64Uint64V(v, e) - case *map[float64]uint64: - fastpathTV.EncMapFloat64Uint64V(*v, e) - case map[float64]uintptr: - fastpathTV.EncMapFloat64UintptrV(v, e) - case *map[float64]uintptr: - fastpathTV.EncMapFloat64UintptrV(*v, e) - case map[float64]int: - fastpathTV.EncMapFloat64IntV(v, e) - case *map[float64]int: - fastpathTV.EncMapFloat64IntV(*v, e) - case map[float64]int8: - fastpathTV.EncMapFloat64Int8V(v, e) - case *map[float64]int8: - fastpathTV.EncMapFloat64Int8V(*v, e) - case map[float64]int16: - fastpathTV.EncMapFloat64Int16V(v, e) - case *map[float64]int16: - fastpathTV.EncMapFloat64Int16V(*v, e) - case map[float64]int32: - fastpathTV.EncMapFloat64Int32V(v, e) - case *map[float64]int32: - fastpathTV.EncMapFloat64Int32V(*v, e) - case map[float64]int64: - fastpathTV.EncMapFloat64Int64V(v, e) - case *map[float64]int64: - fastpathTV.EncMapFloat64Int64V(*v, e) - case map[float64]float32: - fastpathTV.EncMapFloat64Float32V(v, e) - case *map[float64]float32: - fastpathTV.EncMapFloat64Float32V(*v, e) - case map[float64]float64: - fastpathTV.EncMapFloat64Float64V(v, e) - case *map[float64]float64: - fastpathTV.EncMapFloat64Float64V(*v, e) - case map[float64]bool: - fastpathTV.EncMapFloat64BoolV(v, e) - case *map[float64]bool: - fastpathTV.EncMapFloat64BoolV(*v, e) case map[uint]interface{}: fastpathTV.EncMapUintIntfV(v, e) case *map[uint]interface{}: @@ -701,6 +315,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapUintStringV(v, e) case *map[uint]string: fastpathTV.EncMapUintStringV(*v, e) + case map[uint][]byte: + fastpathTV.EncMapUintBytesV(v, e) + case *map[uint][]byte: + fastpathTV.EncMapUintBytesV(*v, e) case map[uint]uint: fastpathTV.EncMapUintUintV(v, e) case *map[uint]uint: @@ -709,14 +327,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapUintUint8V(v, e) case *map[uint]uint8: fastpathTV.EncMapUintUint8V(*v, e) - case map[uint]uint16: - fastpathTV.EncMapUintUint16V(v, e) - case *map[uint]uint16: - fastpathTV.EncMapUintUint16V(*v, e) - case map[uint]uint32: - fastpathTV.EncMapUintUint32V(v, e) - case *map[uint]uint32: - fastpathTV.EncMapUintUint32V(*v, e) case map[uint]uint64: fastpathTV.EncMapUintUint64V(v, e) case *map[uint]uint64: @@ -729,18 +339,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapUintIntV(v, e) case *map[uint]int: fastpathTV.EncMapUintIntV(*v, e) - case map[uint]int8: - fastpathTV.EncMapUintInt8V(v, e) - case *map[uint]int8: - fastpathTV.EncMapUintInt8V(*v, e) - case map[uint]int16: - fastpathTV.EncMapUintInt16V(v, e) - case *map[uint]int16: - fastpathTV.EncMapUintInt16V(*v, e) - case map[uint]int32: - fastpathTV.EncMapUintInt32V(v, e) - case *map[uint]int32: - fastpathTV.EncMapUintInt32V(*v, e) case map[uint]int64: fastpathTV.EncMapUintInt64V(v, e) case *map[uint]int64: @@ -765,6 +363,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapUint8StringV(v, e) case *map[uint8]string: fastpathTV.EncMapUint8StringV(*v, e) + case map[uint8][]byte: + fastpathTV.EncMapUint8BytesV(v, e) + case *map[uint8][]byte: + fastpathTV.EncMapUint8BytesV(*v, e) case map[uint8]uint: fastpathTV.EncMapUint8UintV(v, e) case *map[uint8]uint: @@ -773,14 +375,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapUint8Uint8V(v, e) case *map[uint8]uint8: fastpathTV.EncMapUint8Uint8V(*v, e) - case map[uint8]uint16: - fastpathTV.EncMapUint8Uint16V(v, e) - case *map[uint8]uint16: - fastpathTV.EncMapUint8Uint16V(*v, e) - case map[uint8]uint32: - fastpathTV.EncMapUint8Uint32V(v, e) - case *map[uint8]uint32: - fastpathTV.EncMapUint8Uint32V(*v, e) case map[uint8]uint64: fastpathTV.EncMapUint8Uint64V(v, e) case *map[uint8]uint64: @@ -793,18 +387,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapUint8IntV(v, e) case *map[uint8]int: fastpathTV.EncMapUint8IntV(*v, e) - case map[uint8]int8: - fastpathTV.EncMapUint8Int8V(v, e) - case *map[uint8]int8: - fastpathTV.EncMapUint8Int8V(*v, e) - case map[uint8]int16: - fastpathTV.EncMapUint8Int16V(v, e) - case *map[uint8]int16: - fastpathTV.EncMapUint8Int16V(*v, e) - case map[uint8]int32: - fastpathTV.EncMapUint8Int32V(v, e) - case *map[uint8]int32: - fastpathTV.EncMapUint8Int32V(*v, e) case map[uint8]int64: fastpathTV.EncMapUint8Int64V(v, e) case *map[uint8]int64: @@ -821,134 +403,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapUint8BoolV(v, e) case *map[uint8]bool: fastpathTV.EncMapUint8BoolV(*v, e) - case map[uint16]interface{}: - fastpathTV.EncMapUint16IntfV(v, e) - case *map[uint16]interface{}: - fastpathTV.EncMapUint16IntfV(*v, e) - case map[uint16]string: - fastpathTV.EncMapUint16StringV(v, e) - case *map[uint16]string: - fastpathTV.EncMapUint16StringV(*v, e) - case map[uint16]uint: - fastpathTV.EncMapUint16UintV(v, e) - case *map[uint16]uint: - fastpathTV.EncMapUint16UintV(*v, e) - case map[uint16]uint8: - fastpathTV.EncMapUint16Uint8V(v, e) - case *map[uint16]uint8: - fastpathTV.EncMapUint16Uint8V(*v, e) - case map[uint16]uint16: - fastpathTV.EncMapUint16Uint16V(v, e) - case *map[uint16]uint16: - fastpathTV.EncMapUint16Uint16V(*v, e) - case map[uint16]uint32: - fastpathTV.EncMapUint16Uint32V(v, e) - case *map[uint16]uint32: - fastpathTV.EncMapUint16Uint32V(*v, e) - case map[uint16]uint64: - fastpathTV.EncMapUint16Uint64V(v, e) - case *map[uint16]uint64: - fastpathTV.EncMapUint16Uint64V(*v, e) - case map[uint16]uintptr: - fastpathTV.EncMapUint16UintptrV(v, e) - case *map[uint16]uintptr: - fastpathTV.EncMapUint16UintptrV(*v, e) - case map[uint16]int: - fastpathTV.EncMapUint16IntV(v, e) - case *map[uint16]int: - fastpathTV.EncMapUint16IntV(*v, e) - case map[uint16]int8: - fastpathTV.EncMapUint16Int8V(v, e) - case *map[uint16]int8: - fastpathTV.EncMapUint16Int8V(*v, e) - case map[uint16]int16: - fastpathTV.EncMapUint16Int16V(v, e) - case *map[uint16]int16: - fastpathTV.EncMapUint16Int16V(*v, e) - case map[uint16]int32: - fastpathTV.EncMapUint16Int32V(v, e) - case *map[uint16]int32: - fastpathTV.EncMapUint16Int32V(*v, e) - case map[uint16]int64: - fastpathTV.EncMapUint16Int64V(v, e) - case *map[uint16]int64: - fastpathTV.EncMapUint16Int64V(*v, e) - case map[uint16]float32: - fastpathTV.EncMapUint16Float32V(v, e) - case *map[uint16]float32: - fastpathTV.EncMapUint16Float32V(*v, e) - case map[uint16]float64: - fastpathTV.EncMapUint16Float64V(v, e) - case *map[uint16]float64: - fastpathTV.EncMapUint16Float64V(*v, e) - case map[uint16]bool: - fastpathTV.EncMapUint16BoolV(v, e) - case *map[uint16]bool: - fastpathTV.EncMapUint16BoolV(*v, e) - case map[uint32]interface{}: - fastpathTV.EncMapUint32IntfV(v, e) - case *map[uint32]interface{}: - fastpathTV.EncMapUint32IntfV(*v, e) - case map[uint32]string: - fastpathTV.EncMapUint32StringV(v, e) - case *map[uint32]string: - fastpathTV.EncMapUint32StringV(*v, e) - case map[uint32]uint: - fastpathTV.EncMapUint32UintV(v, e) - case *map[uint32]uint: - fastpathTV.EncMapUint32UintV(*v, e) - case map[uint32]uint8: - fastpathTV.EncMapUint32Uint8V(v, e) - case *map[uint32]uint8: - fastpathTV.EncMapUint32Uint8V(*v, e) - case map[uint32]uint16: - fastpathTV.EncMapUint32Uint16V(v, e) - case *map[uint32]uint16: - fastpathTV.EncMapUint32Uint16V(*v, e) - case map[uint32]uint32: - fastpathTV.EncMapUint32Uint32V(v, e) - case *map[uint32]uint32: - fastpathTV.EncMapUint32Uint32V(*v, e) - case map[uint32]uint64: - fastpathTV.EncMapUint32Uint64V(v, e) - case *map[uint32]uint64: - fastpathTV.EncMapUint32Uint64V(*v, e) - case map[uint32]uintptr: - fastpathTV.EncMapUint32UintptrV(v, e) - case *map[uint32]uintptr: - fastpathTV.EncMapUint32UintptrV(*v, e) - case map[uint32]int: - fastpathTV.EncMapUint32IntV(v, e) - case *map[uint32]int: - fastpathTV.EncMapUint32IntV(*v, e) - case map[uint32]int8: - fastpathTV.EncMapUint32Int8V(v, e) - case *map[uint32]int8: - fastpathTV.EncMapUint32Int8V(*v, e) - case map[uint32]int16: - fastpathTV.EncMapUint32Int16V(v, e) - case *map[uint32]int16: - fastpathTV.EncMapUint32Int16V(*v, e) - case map[uint32]int32: - fastpathTV.EncMapUint32Int32V(v, e) - case *map[uint32]int32: - fastpathTV.EncMapUint32Int32V(*v, e) - case map[uint32]int64: - fastpathTV.EncMapUint32Int64V(v, e) - case *map[uint32]int64: - fastpathTV.EncMapUint32Int64V(*v, e) - case map[uint32]float32: - fastpathTV.EncMapUint32Float32V(v, e) - case *map[uint32]float32: - fastpathTV.EncMapUint32Float32V(*v, e) - case map[uint32]float64: - fastpathTV.EncMapUint32Float64V(v, e) - case *map[uint32]float64: - fastpathTV.EncMapUint32Float64V(*v, e) - case map[uint32]bool: - fastpathTV.EncMapUint32BoolV(v, e) - case *map[uint32]bool: - fastpathTV.EncMapUint32BoolV(*v, e) case map[uint64]interface{}: fastpathTV.EncMapUint64IntfV(v, e) case *map[uint64]interface{}: @@ -957,6 +411,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapUint64StringV(v, e) case *map[uint64]string: fastpathTV.EncMapUint64StringV(*v, e) + case map[uint64][]byte: + fastpathTV.EncMapUint64BytesV(v, e) + case *map[uint64][]byte: + fastpathTV.EncMapUint64BytesV(*v, e) case map[uint64]uint: fastpathTV.EncMapUint64UintV(v, e) case *map[uint64]uint: @@ -965,14 +423,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapUint64Uint8V(v, e) case *map[uint64]uint8: fastpathTV.EncMapUint64Uint8V(*v, e) - case map[uint64]uint16: - fastpathTV.EncMapUint64Uint16V(v, e) - case *map[uint64]uint16: - fastpathTV.EncMapUint64Uint16V(*v, e) - case map[uint64]uint32: - fastpathTV.EncMapUint64Uint32V(v, e) - case *map[uint64]uint32: - fastpathTV.EncMapUint64Uint32V(*v, e) case map[uint64]uint64: fastpathTV.EncMapUint64Uint64V(v, e) case *map[uint64]uint64: @@ -985,18 +435,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapUint64IntV(v, e) case *map[uint64]int: fastpathTV.EncMapUint64IntV(*v, e) - case map[uint64]int8: - fastpathTV.EncMapUint64Int8V(v, e) - case *map[uint64]int8: - fastpathTV.EncMapUint64Int8V(*v, e) - case map[uint64]int16: - fastpathTV.EncMapUint64Int16V(v, e) - case *map[uint64]int16: - fastpathTV.EncMapUint64Int16V(*v, e) - case map[uint64]int32: - fastpathTV.EncMapUint64Int32V(v, e) - case *map[uint64]int32: - fastpathTV.EncMapUint64Int32V(*v, e) case map[uint64]int64: fastpathTV.EncMapUint64Int64V(v, e) case *map[uint64]int64: @@ -1013,70 +451,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapUint64BoolV(v, e) case *map[uint64]bool: fastpathTV.EncMapUint64BoolV(*v, e) - case map[uintptr]interface{}: - fastpathTV.EncMapUintptrIntfV(v, e) - case *map[uintptr]interface{}: - fastpathTV.EncMapUintptrIntfV(*v, e) - case map[uintptr]string: - fastpathTV.EncMapUintptrStringV(v, e) - case *map[uintptr]string: - fastpathTV.EncMapUintptrStringV(*v, e) - case map[uintptr]uint: - fastpathTV.EncMapUintptrUintV(v, e) - case *map[uintptr]uint: - fastpathTV.EncMapUintptrUintV(*v, e) - case map[uintptr]uint8: - fastpathTV.EncMapUintptrUint8V(v, e) - case *map[uintptr]uint8: - fastpathTV.EncMapUintptrUint8V(*v, e) - case map[uintptr]uint16: - fastpathTV.EncMapUintptrUint16V(v, e) - case *map[uintptr]uint16: - fastpathTV.EncMapUintptrUint16V(*v, e) - case map[uintptr]uint32: - fastpathTV.EncMapUintptrUint32V(v, e) - case *map[uintptr]uint32: - fastpathTV.EncMapUintptrUint32V(*v, e) - case map[uintptr]uint64: - fastpathTV.EncMapUintptrUint64V(v, e) - case *map[uintptr]uint64: - fastpathTV.EncMapUintptrUint64V(*v, e) - case map[uintptr]uintptr: - fastpathTV.EncMapUintptrUintptrV(v, e) - case *map[uintptr]uintptr: - fastpathTV.EncMapUintptrUintptrV(*v, e) - case map[uintptr]int: - fastpathTV.EncMapUintptrIntV(v, e) - case *map[uintptr]int: - fastpathTV.EncMapUintptrIntV(*v, e) - case map[uintptr]int8: - fastpathTV.EncMapUintptrInt8V(v, e) - case *map[uintptr]int8: - fastpathTV.EncMapUintptrInt8V(*v, e) - case map[uintptr]int16: - fastpathTV.EncMapUintptrInt16V(v, e) - case *map[uintptr]int16: - fastpathTV.EncMapUintptrInt16V(*v, e) - case map[uintptr]int32: - fastpathTV.EncMapUintptrInt32V(v, e) - case *map[uintptr]int32: - fastpathTV.EncMapUintptrInt32V(*v, e) - case map[uintptr]int64: - fastpathTV.EncMapUintptrInt64V(v, e) - case *map[uintptr]int64: - fastpathTV.EncMapUintptrInt64V(*v, e) - case map[uintptr]float32: - fastpathTV.EncMapUintptrFloat32V(v, e) - case *map[uintptr]float32: - fastpathTV.EncMapUintptrFloat32V(*v, e) - case map[uintptr]float64: - fastpathTV.EncMapUintptrFloat64V(v, e) - case *map[uintptr]float64: - fastpathTV.EncMapUintptrFloat64V(*v, e) - case map[uintptr]bool: - fastpathTV.EncMapUintptrBoolV(v, e) - case *map[uintptr]bool: - fastpathTV.EncMapUintptrBoolV(*v, e) case map[int]interface{}: fastpathTV.EncMapIntIntfV(v, e) case *map[int]interface{}: @@ -1085,6 +459,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapIntStringV(v, e) case *map[int]string: fastpathTV.EncMapIntStringV(*v, e) + case map[int][]byte: + fastpathTV.EncMapIntBytesV(v, e) + case *map[int][]byte: + fastpathTV.EncMapIntBytesV(*v, e) case map[int]uint: fastpathTV.EncMapIntUintV(v, e) case *map[int]uint: @@ -1093,14 +471,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapIntUint8V(v, e) case *map[int]uint8: fastpathTV.EncMapIntUint8V(*v, e) - case map[int]uint16: - fastpathTV.EncMapIntUint16V(v, e) - case *map[int]uint16: - fastpathTV.EncMapIntUint16V(*v, e) - case map[int]uint32: - fastpathTV.EncMapIntUint32V(v, e) - case *map[int]uint32: - fastpathTV.EncMapIntUint32V(*v, e) case map[int]uint64: fastpathTV.EncMapIntUint64V(v, e) case *map[int]uint64: @@ -1113,18 +483,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapIntIntV(v, e) case *map[int]int: fastpathTV.EncMapIntIntV(*v, e) - case map[int]int8: - fastpathTV.EncMapIntInt8V(v, e) - case *map[int]int8: - fastpathTV.EncMapIntInt8V(*v, e) - case map[int]int16: - fastpathTV.EncMapIntInt16V(v, e) - case *map[int]int16: - fastpathTV.EncMapIntInt16V(*v, e) - case map[int]int32: - fastpathTV.EncMapIntInt32V(v, e) - case *map[int]int32: - fastpathTV.EncMapIntInt32V(*v, e) case map[int]int64: fastpathTV.EncMapIntInt64V(v, e) case *map[int]int64: @@ -1141,198 +499,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapIntBoolV(v, e) case *map[int]bool: fastpathTV.EncMapIntBoolV(*v, e) - case map[int8]interface{}: - fastpathTV.EncMapInt8IntfV(v, e) - case *map[int8]interface{}: - fastpathTV.EncMapInt8IntfV(*v, e) - case map[int8]string: - fastpathTV.EncMapInt8StringV(v, e) - case *map[int8]string: - fastpathTV.EncMapInt8StringV(*v, e) - case map[int8]uint: - fastpathTV.EncMapInt8UintV(v, e) - case *map[int8]uint: - fastpathTV.EncMapInt8UintV(*v, e) - case map[int8]uint8: - fastpathTV.EncMapInt8Uint8V(v, e) - case *map[int8]uint8: - fastpathTV.EncMapInt8Uint8V(*v, e) - case map[int8]uint16: - fastpathTV.EncMapInt8Uint16V(v, e) - case *map[int8]uint16: - fastpathTV.EncMapInt8Uint16V(*v, e) - case map[int8]uint32: - fastpathTV.EncMapInt8Uint32V(v, e) - case *map[int8]uint32: - fastpathTV.EncMapInt8Uint32V(*v, e) - case map[int8]uint64: - fastpathTV.EncMapInt8Uint64V(v, e) - case *map[int8]uint64: - fastpathTV.EncMapInt8Uint64V(*v, e) - case map[int8]uintptr: - fastpathTV.EncMapInt8UintptrV(v, e) - case *map[int8]uintptr: - fastpathTV.EncMapInt8UintptrV(*v, e) - case map[int8]int: - fastpathTV.EncMapInt8IntV(v, e) - case *map[int8]int: - fastpathTV.EncMapInt8IntV(*v, e) - case map[int8]int8: - fastpathTV.EncMapInt8Int8V(v, e) - case *map[int8]int8: - fastpathTV.EncMapInt8Int8V(*v, e) - case map[int8]int16: - fastpathTV.EncMapInt8Int16V(v, e) - case *map[int8]int16: - fastpathTV.EncMapInt8Int16V(*v, e) - case map[int8]int32: - fastpathTV.EncMapInt8Int32V(v, e) - case *map[int8]int32: - fastpathTV.EncMapInt8Int32V(*v, e) - case map[int8]int64: - fastpathTV.EncMapInt8Int64V(v, e) - case *map[int8]int64: - fastpathTV.EncMapInt8Int64V(*v, e) - case map[int8]float32: - fastpathTV.EncMapInt8Float32V(v, e) - case *map[int8]float32: - fastpathTV.EncMapInt8Float32V(*v, e) - case map[int8]float64: - fastpathTV.EncMapInt8Float64V(v, e) - case *map[int8]float64: - fastpathTV.EncMapInt8Float64V(*v, e) - case map[int8]bool: - fastpathTV.EncMapInt8BoolV(v, e) - case *map[int8]bool: - fastpathTV.EncMapInt8BoolV(*v, e) - case map[int16]interface{}: - fastpathTV.EncMapInt16IntfV(v, e) - case *map[int16]interface{}: - fastpathTV.EncMapInt16IntfV(*v, e) - case map[int16]string: - fastpathTV.EncMapInt16StringV(v, e) - case *map[int16]string: - fastpathTV.EncMapInt16StringV(*v, e) - case map[int16]uint: - fastpathTV.EncMapInt16UintV(v, e) - case *map[int16]uint: - fastpathTV.EncMapInt16UintV(*v, e) - case map[int16]uint8: - fastpathTV.EncMapInt16Uint8V(v, e) - case *map[int16]uint8: - fastpathTV.EncMapInt16Uint8V(*v, e) - case map[int16]uint16: - fastpathTV.EncMapInt16Uint16V(v, e) - case *map[int16]uint16: - fastpathTV.EncMapInt16Uint16V(*v, e) - case map[int16]uint32: - fastpathTV.EncMapInt16Uint32V(v, e) - case *map[int16]uint32: - fastpathTV.EncMapInt16Uint32V(*v, e) - case map[int16]uint64: - fastpathTV.EncMapInt16Uint64V(v, e) - case *map[int16]uint64: - fastpathTV.EncMapInt16Uint64V(*v, e) - case map[int16]uintptr: - fastpathTV.EncMapInt16UintptrV(v, e) - case *map[int16]uintptr: - fastpathTV.EncMapInt16UintptrV(*v, e) - case map[int16]int: - fastpathTV.EncMapInt16IntV(v, e) - case *map[int16]int: - fastpathTV.EncMapInt16IntV(*v, e) - case map[int16]int8: - fastpathTV.EncMapInt16Int8V(v, e) - case *map[int16]int8: - fastpathTV.EncMapInt16Int8V(*v, e) - case map[int16]int16: - fastpathTV.EncMapInt16Int16V(v, e) - case *map[int16]int16: - fastpathTV.EncMapInt16Int16V(*v, e) - case map[int16]int32: - fastpathTV.EncMapInt16Int32V(v, e) - case *map[int16]int32: - fastpathTV.EncMapInt16Int32V(*v, e) - case map[int16]int64: - fastpathTV.EncMapInt16Int64V(v, e) - case *map[int16]int64: - fastpathTV.EncMapInt16Int64V(*v, e) - case map[int16]float32: - fastpathTV.EncMapInt16Float32V(v, e) - case *map[int16]float32: - fastpathTV.EncMapInt16Float32V(*v, e) - case map[int16]float64: - fastpathTV.EncMapInt16Float64V(v, e) - case *map[int16]float64: - fastpathTV.EncMapInt16Float64V(*v, e) - case map[int16]bool: - fastpathTV.EncMapInt16BoolV(v, e) - case *map[int16]bool: - fastpathTV.EncMapInt16BoolV(*v, e) - case map[int32]interface{}: - fastpathTV.EncMapInt32IntfV(v, e) - case *map[int32]interface{}: - fastpathTV.EncMapInt32IntfV(*v, e) - case map[int32]string: - fastpathTV.EncMapInt32StringV(v, e) - case *map[int32]string: - fastpathTV.EncMapInt32StringV(*v, e) - case map[int32]uint: - fastpathTV.EncMapInt32UintV(v, e) - case *map[int32]uint: - fastpathTV.EncMapInt32UintV(*v, e) - case map[int32]uint8: - fastpathTV.EncMapInt32Uint8V(v, e) - case *map[int32]uint8: - fastpathTV.EncMapInt32Uint8V(*v, e) - case map[int32]uint16: - fastpathTV.EncMapInt32Uint16V(v, e) - case *map[int32]uint16: - fastpathTV.EncMapInt32Uint16V(*v, e) - case map[int32]uint32: - fastpathTV.EncMapInt32Uint32V(v, e) - case *map[int32]uint32: - fastpathTV.EncMapInt32Uint32V(*v, e) - case map[int32]uint64: - fastpathTV.EncMapInt32Uint64V(v, e) - case *map[int32]uint64: - fastpathTV.EncMapInt32Uint64V(*v, e) - case map[int32]uintptr: - fastpathTV.EncMapInt32UintptrV(v, e) - case *map[int32]uintptr: - fastpathTV.EncMapInt32UintptrV(*v, e) - case map[int32]int: - fastpathTV.EncMapInt32IntV(v, e) - case *map[int32]int: - fastpathTV.EncMapInt32IntV(*v, e) - case map[int32]int8: - fastpathTV.EncMapInt32Int8V(v, e) - case *map[int32]int8: - fastpathTV.EncMapInt32Int8V(*v, e) - case map[int32]int16: - fastpathTV.EncMapInt32Int16V(v, e) - case *map[int32]int16: - fastpathTV.EncMapInt32Int16V(*v, e) - case map[int32]int32: - fastpathTV.EncMapInt32Int32V(v, e) - case *map[int32]int32: - fastpathTV.EncMapInt32Int32V(*v, e) - case map[int32]int64: - fastpathTV.EncMapInt32Int64V(v, e) - case *map[int32]int64: - fastpathTV.EncMapInt32Int64V(*v, e) - case map[int32]float32: - fastpathTV.EncMapInt32Float32V(v, e) - case *map[int32]float32: - fastpathTV.EncMapInt32Float32V(*v, e) - case map[int32]float64: - fastpathTV.EncMapInt32Float64V(v, e) - case *map[int32]float64: - fastpathTV.EncMapInt32Float64V(*v, e) - case map[int32]bool: - fastpathTV.EncMapInt32BoolV(v, e) - case *map[int32]bool: - fastpathTV.EncMapInt32BoolV(*v, e) case map[int64]interface{}: fastpathTV.EncMapInt64IntfV(v, e) case *map[int64]interface{}: @@ -1341,6 +507,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapInt64StringV(v, e) case *map[int64]string: fastpathTV.EncMapInt64StringV(*v, e) + case map[int64][]byte: + fastpathTV.EncMapInt64BytesV(v, e) + case *map[int64][]byte: + fastpathTV.EncMapInt64BytesV(*v, e) case map[int64]uint: fastpathTV.EncMapInt64UintV(v, e) case *map[int64]uint: @@ -1349,14 +519,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapInt64Uint8V(v, e) case *map[int64]uint8: fastpathTV.EncMapInt64Uint8V(*v, e) - case map[int64]uint16: - fastpathTV.EncMapInt64Uint16V(v, e) - case *map[int64]uint16: - fastpathTV.EncMapInt64Uint16V(*v, e) - case map[int64]uint32: - fastpathTV.EncMapInt64Uint32V(v, e) - case *map[int64]uint32: - fastpathTV.EncMapInt64Uint32V(*v, e) case map[int64]uint64: fastpathTV.EncMapInt64Uint64V(v, e) case *map[int64]uint64: @@ -1369,18 +531,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapInt64IntV(v, e) case *map[int64]int: fastpathTV.EncMapInt64IntV(*v, e) - case map[int64]int8: - fastpathTV.EncMapInt64Int8V(v, e) - case *map[int64]int8: - fastpathTV.EncMapInt64Int8V(*v, e) - case map[int64]int16: - fastpathTV.EncMapInt64Int16V(v, e) - case *map[int64]int16: - fastpathTV.EncMapInt64Int16V(*v, e) - case map[int64]int32: - fastpathTV.EncMapInt64Int32V(v, e) - case *map[int64]int32: - fastpathTV.EncMapInt64Int32V(*v, e) case map[int64]int64: fastpathTV.EncMapInt64Int64V(v, e) case *map[int64]int64: @@ -1397,70 +547,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapInt64BoolV(v, e) case *map[int64]bool: fastpathTV.EncMapInt64BoolV(*v, e) - case map[bool]interface{}: - fastpathTV.EncMapBoolIntfV(v, e) - case *map[bool]interface{}: - fastpathTV.EncMapBoolIntfV(*v, e) - case map[bool]string: - fastpathTV.EncMapBoolStringV(v, e) - case *map[bool]string: - fastpathTV.EncMapBoolStringV(*v, e) - case map[bool]uint: - fastpathTV.EncMapBoolUintV(v, e) - case *map[bool]uint: - fastpathTV.EncMapBoolUintV(*v, e) - case map[bool]uint8: - fastpathTV.EncMapBoolUint8V(v, e) - case *map[bool]uint8: - fastpathTV.EncMapBoolUint8V(*v, e) - case map[bool]uint16: - fastpathTV.EncMapBoolUint16V(v, e) - case *map[bool]uint16: - fastpathTV.EncMapBoolUint16V(*v, e) - case map[bool]uint32: - fastpathTV.EncMapBoolUint32V(v, e) - case *map[bool]uint32: - fastpathTV.EncMapBoolUint32V(*v, e) - case map[bool]uint64: - fastpathTV.EncMapBoolUint64V(v, e) - case *map[bool]uint64: - fastpathTV.EncMapBoolUint64V(*v, e) - case map[bool]uintptr: - fastpathTV.EncMapBoolUintptrV(v, e) - case *map[bool]uintptr: - fastpathTV.EncMapBoolUintptrV(*v, e) - case map[bool]int: - fastpathTV.EncMapBoolIntV(v, e) - case *map[bool]int: - fastpathTV.EncMapBoolIntV(*v, e) - case map[bool]int8: - fastpathTV.EncMapBoolInt8V(v, e) - case *map[bool]int8: - fastpathTV.EncMapBoolInt8V(*v, e) - case map[bool]int16: - fastpathTV.EncMapBoolInt16V(v, e) - case *map[bool]int16: - fastpathTV.EncMapBoolInt16V(*v, e) - case map[bool]int32: - fastpathTV.EncMapBoolInt32V(v, e) - case *map[bool]int32: - fastpathTV.EncMapBoolInt32V(*v, e) - case map[bool]int64: - fastpathTV.EncMapBoolInt64V(v, e) - case *map[bool]int64: - fastpathTV.EncMapBoolInt64V(*v, e) - case map[bool]float32: - fastpathTV.EncMapBoolFloat32V(v, e) - case *map[bool]float32: - fastpathTV.EncMapBoolFloat32V(*v, e) - case map[bool]float64: - fastpathTV.EncMapBoolFloat64V(v, e) - case *map[bool]float64: - fastpathTV.EncMapBoolFloat64V(*v, e) - case map[bool]bool: - fastpathTV.EncMapBoolBoolV(v, e) - case *map[bool]bool: - fastpathTV.EncMapBoolBoolV(*v, e) default: _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 @@ -1478,39 +564,35 @@ func (e *Encoder) fastpathEncSliceIntfR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceIntfV(rv2i(rv).([]interface{}), e) } } -func (_ fastpathT) EncSliceIntfV(v []interface{}, e *Encoder) { +func (fastpathT) EncSliceIntfV(v []interface{}, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - e.encode(v2) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.encode(v[j]) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceIntfV(v []interface{}, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceIntfV(v []interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.encode(v[j]) } - e.encode(v2) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceStringR(f *codecFnInfo, rv reflect.Value) { @@ -1520,47 +602,81 @@ func (e *Encoder) fastpathEncSliceStringR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceStringV(rv2i(rv).([]string), e) } } -func (_ fastpathT) EncSliceStringV(v []string, e *Encoder) { +func (fastpathT) EncSliceStringV(v []string, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) + e.e.EncodeStringBytesRaw(bytesView(v[j])) } else { - ee.EncodeStringEnc(cUTF8, v2) + e.e.EncodeStringEnc(cUTF8, v[j]) } } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceStringV(v []string, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceStringV(v []string, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() + } + if e.h.StringToRaw { + e.e.EncodeStringBytesRaw(bytesView(v[j])) + } else { + e.e.EncodeStringEnc(cUTF8, v[j]) } } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) - } else { - ee.EncodeStringEnc(cUTF8, v2) - } + e.mapEnd() + } +} + +func (e *Encoder) fastpathEncSliceBytesR(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceBytesV(rv2i(rv).([][]byte), e) + } else { + fastpathTV.EncSliceBytesV(rv2i(rv).([][]byte), e) + } +} +func (fastpathT) EncSliceBytesV(v [][]byte, e *Encoder) { + if v == nil { + e.e.EncodeNil() + return + } + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeStringBytesRaw(v[j]) + } + e.arrayEnd() +} +func (fastpathT) EncAsMapSliceBytesV(v [][]byte, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { + e.errorf(fastpathMapBySliceErrMsg, len(v)) + } else { + e.mapStart(len(v) / 2) + for j := range v { + if j%2 == 0 { + e.mapElemKey() + } else { + e.mapElemValue() + } + e.e.EncodeStringBytesRaw(v[j]) + } + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceFloat32R(f *codecFnInfo, rv reflect.Value) { @@ -1570,39 +686,35 @@ func (e *Encoder) fastpathEncSliceFloat32R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceFloat32V(rv2i(rv).([]float32), e) } } -func (_ fastpathT) EncSliceFloat32V(v []float32, e *Encoder) { +func (fastpathT) EncSliceFloat32V(v []float32, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - ee.EncodeFloat32(v2) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeFloat32(v[j]) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceFloat32V(v []float32, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceFloat32V(v []float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.e.EncodeFloat32(v[j]) } - ee.EncodeFloat32(v2) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceFloat64R(f *codecFnInfo, rv reflect.Value) { @@ -1612,39 +724,35 @@ func (e *Encoder) fastpathEncSliceFloat64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceFloat64V(rv2i(rv).([]float64), e) } } -func (_ fastpathT) EncSliceFloat64V(v []float64, e *Encoder) { +func (fastpathT) EncSliceFloat64V(v []float64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - ee.EncodeFloat64(v2) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeFloat64(v[j]) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceFloat64V(v []float64, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceFloat64V(v []float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.e.EncodeFloat64(v[j]) } - ee.EncodeFloat64(v2) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceUintR(f *codecFnInfo, rv reflect.Value) { @@ -1654,39 +762,35 @@ func (e *Encoder) fastpathEncSliceUintR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceUintV(rv2i(rv).([]uint), e) } } -func (_ fastpathT) EncSliceUintV(v []uint, e *Encoder) { +func (fastpathT) EncSliceUintV(v []uint, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - ee.EncodeUint(uint64(v2)) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeUint(uint64(v[j])) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceUintV(v []uint, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceUintV(v []uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.e.EncodeUint(uint64(v[j])) } - ee.EncodeUint(uint64(v2)) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceUint8R(f *codecFnInfo, rv reflect.Value) { @@ -1696,39 +800,35 @@ func (e *Encoder) fastpathEncSliceUint8R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceUint8V(rv2i(rv).([]uint8), e) } } -func (_ fastpathT) EncSliceUint8V(v []uint8, e *Encoder) { +func (fastpathT) EncSliceUint8V(v []uint8, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - ee.EncodeUint(uint64(v2)) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeUint(uint64(v[j])) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceUint8V(v []uint8, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceUint8V(v []uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.e.EncodeUint(uint64(v[j])) } - ee.EncodeUint(uint64(v2)) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceUint16R(f *codecFnInfo, rv reflect.Value) { @@ -1738,39 +838,35 @@ func (e *Encoder) fastpathEncSliceUint16R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceUint16V(rv2i(rv).([]uint16), e) } } -func (_ fastpathT) EncSliceUint16V(v []uint16, e *Encoder) { +func (fastpathT) EncSliceUint16V(v []uint16, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - ee.EncodeUint(uint64(v2)) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeUint(uint64(v[j])) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceUint16V(v []uint16, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceUint16V(v []uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.e.EncodeUint(uint64(v[j])) } - ee.EncodeUint(uint64(v2)) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceUint32R(f *codecFnInfo, rv reflect.Value) { @@ -1780,39 +876,35 @@ func (e *Encoder) fastpathEncSliceUint32R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceUint32V(rv2i(rv).([]uint32), e) } } -func (_ fastpathT) EncSliceUint32V(v []uint32, e *Encoder) { +func (fastpathT) EncSliceUint32V(v []uint32, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - ee.EncodeUint(uint64(v2)) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeUint(uint64(v[j])) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceUint32V(v []uint32, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceUint32V(v []uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.e.EncodeUint(uint64(v[j])) } - ee.EncodeUint(uint64(v2)) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceUint64R(f *codecFnInfo, rv reflect.Value) { @@ -1822,39 +914,35 @@ func (e *Encoder) fastpathEncSliceUint64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceUint64V(rv2i(rv).([]uint64), e) } } -func (_ fastpathT) EncSliceUint64V(v []uint64, e *Encoder) { +func (fastpathT) EncSliceUint64V(v []uint64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - ee.EncodeUint(uint64(v2)) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeUint(v[j]) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceUint64V(v []uint64, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceUint64V(v []uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.e.EncodeUint(v[j]) } - ee.EncodeUint(uint64(v2)) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceUintptrR(f *codecFnInfo, rv reflect.Value) { @@ -1864,39 +952,35 @@ func (e *Encoder) fastpathEncSliceUintptrR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceUintptrV(rv2i(rv).([]uintptr), e) } } -func (_ fastpathT) EncSliceUintptrV(v []uintptr, e *Encoder) { +func (fastpathT) EncSliceUintptrV(v []uintptr, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - e.encode(v2) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.encode(v[j]) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceUintptrV(v []uintptr, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceUintptrV(v []uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.encode(v[j]) } - e.encode(v2) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceIntR(f *codecFnInfo, rv reflect.Value) { @@ -1906,39 +990,35 @@ func (e *Encoder) fastpathEncSliceIntR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceIntV(rv2i(rv).([]int), e) } } -func (_ fastpathT) EncSliceIntV(v []int, e *Encoder) { +func (fastpathT) EncSliceIntV(v []int, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - ee.EncodeInt(int64(v2)) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeInt(int64(v[j])) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceIntV(v []int, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceIntV(v []int, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.e.EncodeInt(int64(v[j])) } - ee.EncodeInt(int64(v2)) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceInt8R(f *codecFnInfo, rv reflect.Value) { @@ -1948,39 +1028,35 @@ func (e *Encoder) fastpathEncSliceInt8R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceInt8V(rv2i(rv).([]int8), e) } } -func (_ fastpathT) EncSliceInt8V(v []int8, e *Encoder) { +func (fastpathT) EncSliceInt8V(v []int8, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - ee.EncodeInt(int64(v2)) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeInt(int64(v[j])) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceInt8V(v []int8, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceInt8V(v []int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.e.EncodeInt(int64(v[j])) } - ee.EncodeInt(int64(v2)) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceInt16R(f *codecFnInfo, rv reflect.Value) { @@ -1990,39 +1066,35 @@ func (e *Encoder) fastpathEncSliceInt16R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceInt16V(rv2i(rv).([]int16), e) } } -func (_ fastpathT) EncSliceInt16V(v []int16, e *Encoder) { +func (fastpathT) EncSliceInt16V(v []int16, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - ee.EncodeInt(int64(v2)) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeInt(int64(v[j])) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceInt16V(v []int16, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceInt16V(v []int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.e.EncodeInt(int64(v[j])) } - ee.EncodeInt(int64(v2)) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceInt32R(f *codecFnInfo, rv reflect.Value) { @@ -2032,39 +1104,35 @@ func (e *Encoder) fastpathEncSliceInt32R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceInt32V(rv2i(rv).([]int32), e) } } -func (_ fastpathT) EncSliceInt32V(v []int32, e *Encoder) { +func (fastpathT) EncSliceInt32V(v []int32, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - ee.EncodeInt(int64(v2)) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeInt(int64(v[j])) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceInt32V(v []int32, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceInt32V(v []int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.e.EncodeInt(int64(v[j])) } - ee.EncodeInt(int64(v2)) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceInt64R(f *codecFnInfo, rv reflect.Value) { @@ -2074,39 +1142,35 @@ func (e *Encoder) fastpathEncSliceInt64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceInt64V(rv2i(rv).([]int64), e) } } -func (_ fastpathT) EncSliceInt64V(v []int64, e *Encoder) { +func (fastpathT) EncSliceInt64V(v []int64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - ee.EncodeInt(int64(v2)) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeInt(v[j]) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceInt64V(v []int64, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceInt64V(v []int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.e.EncodeInt(v[j]) } - ee.EncodeInt(int64(v2)) + e.mapEnd() } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncSliceBoolR(f *codecFnInfo, rv reflect.Value) { @@ -2116,3071 +1180,558 @@ func (e *Encoder) fastpathEncSliceBoolR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncSliceBoolV(rv2i(rv).([]bool), e) } } -func (_ fastpathT) EncSliceBoolV(v []bool, e *Encoder) { +func (fastpathT) EncSliceBoolV(v []bool, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { - ee.WriteArrayElem() - } - ee.EncodeBool(v2) + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + e.e.EncodeBool(v[j]) } - ee.WriteArrayEnd() + e.arrayEnd() } -func (_ fastpathT) EncAsMapSliceBoolV(v []bool, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { +func (fastpathT) EncAsMapSliceBoolV(v []bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } + e.e.EncodeBool(v[j]) } - ee.EncodeBool(v2) + e.mapEnd() } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfIntfR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfIntfV(rv2i(rv).(map[interface{}]interface{}), e) -} -func (_ fastpathT) EncMapIntfIntfV(v map[interface{}]interface{}, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfStringR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfStringV(rv2i(rv).(map[interface{}]string), e) -} -func (_ fastpathT) EncMapIntfStringV(v map[interface{}]string, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) - } else { - ee.EncodeStringEnc(cUTF8, v2) - } - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfUintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfUintV(rv2i(rv).(map[interface{}]uint), e) -} -func (_ fastpathT) EncMapIntfUintV(v map[interface{}]uint, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfUint8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfUint8V(rv2i(rv).(map[interface{}]uint8), e) -} -func (_ fastpathT) EncMapIntfUint8V(v map[interface{}]uint8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfUint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfUint16V(rv2i(rv).(map[interface{}]uint16), e) -} -func (_ fastpathT) EncMapIntfUint16V(v map[interface{}]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfUint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfUint32V(rv2i(rv).(map[interface{}]uint32), e) -} -func (_ fastpathT) EncMapIntfUint32V(v map[interface{}]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfUint64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfUint64V(rv2i(rv).(map[interface{}]uint64), e) -} -func (_ fastpathT) EncMapIntfUint64V(v map[interface{}]uint64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfUintptrR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfUintptrV(rv2i(rv).(map[interface{}]uintptr), e) -} -func (_ fastpathT) EncMapIntfUintptrV(v map[interface{}]uintptr, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfIntR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfIntV(rv2i(rv).(map[interface{}]int), e) -} -func (_ fastpathT) EncMapIntfIntV(v map[interface{}]int, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfInt8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfInt8V(rv2i(rv).(map[interface{}]int8), e) -} -func (_ fastpathT) EncMapIntfInt8V(v map[interface{}]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfInt16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfInt16V(rv2i(rv).(map[interface{}]int16), e) -} -func (_ fastpathT) EncMapIntfInt16V(v map[interface{}]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfInt32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfInt32V(rv2i(rv).(map[interface{}]int32), e) -} -func (_ fastpathT) EncMapIntfInt32V(v map[interface{}]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfInt64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfInt64V(rv2i(rv).(map[interface{}]int64), e) -} -func (_ fastpathT) EncMapIntfInt64V(v map[interface{}]int64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfFloat32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfFloat32V(rv2i(rv).(map[interface{}]float32), e) -} -func (_ fastpathT) EncMapIntfFloat32V(v map[interface{}]float32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfFloat64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfFloat64V(rv2i(rv).(map[interface{}]float64), e) -} -func (_ fastpathT) EncMapIntfFloat64V(v map[interface{}]float64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntfBoolR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntfBoolV(rv2i(rv).(map[interface{}]bool), e) -} -func (_ fastpathT) EncMapIntfBoolV(v map[interface{}]bool, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) - var i, l uint - var vp *bytesI - for k2 := range v { - l = uint(len(mksv)) - e2.MustEncode(k2) - vp = &v2[i] - vp.v = mksv[l:] - vp.i = k2 - i++ - } - sort.Sort(bytesISlice(v2)) - for j := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.asis(v2[j].v) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[v2[j].i]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) - } - } - ee.WriteMapEnd() } func (e *Encoder) fastpathEncMapStringIntfR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringIntfV(rv2i(rv).(map[string]interface{}), e) } -func (_ fastpathT) EncMapStringIntfV(v map[string]interface{}, e *Encoder) { +func (fastpathT) EncMapStringIntfV(v map[string]interface{}, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i uint for k := range v { - v2[i] = string(k) + v2[i] = k i++ } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - e.encode(v[string(k2)]) + e.mapElemValue() + e.encode(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() + e.e.EncodeStringEnc(cUTF8, k2) } + e.mapElemValue() e.encode(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapStringStringR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringStringV(rv2i(rv).(map[string]string), e) } -func (_ fastpathT) EncMapStringStringV(v map[string]string, e *Encoder) { +func (fastpathT) EncMapStringStringV(v map[string]string, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i uint for k := range v { - v2[i] = string(k) + v2[i] = k i++ } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() + e.e.EncodeStringEnc(cUTF8, k2) } + e.mapElemValue() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[string(k2)])) + e.e.EncodeStringBytesRaw(bytesView(v[k2])) } else { - ee.EncodeStringEnc(cUTF8, v[string(k2)]) + e.e.EncodeStringEnc(cUTF8, v[k2]) } } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() + e.e.EncodeStringEnc(cUTF8, k2) } + e.mapElemValue() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) + e.e.EncodeStringBytesRaw(bytesView(v2)) } else { - ee.EncodeStringEnc(cUTF8, v2) + e.e.EncodeStringEnc(cUTF8, v2) } } } - ee.WriteMapEnd() + e.mapEnd() +} + +func (e *Encoder) fastpathEncMapStringBytesR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringBytesV(rv2i(rv).(map[string][]byte), e) +} +func (fastpathT) EncMapStringBytesV(v map[string][]byte, e *Encoder) { + if v == nil { + e.e.EncodeNil() + return + } + e.mapStart(len(v)) + if e.h.Canonical { + v2 := make([]string, len(v)) + var i uint + for k := range v { + v2[i] = k + i++ + } + sort.Sort(stringSlice(v2)) + for _, k2 := range v2 { + e.mapElemKey() + if e.h.StringToRaw { + e.e.EncodeStringBytesRaw(bytesView(k2)) + } else { + e.e.EncodeStringEnc(cUTF8, k2) + } + e.mapElemValue() + e.e.EncodeStringBytesRaw(v[k2]) + } + } else { + for k2, v2 := range v { + e.mapElemKey() + if e.h.StringToRaw { + e.e.EncodeStringBytesRaw(bytesView(k2)) + } else { + e.e.EncodeStringEnc(cUTF8, k2) + } + e.mapElemValue() + e.e.EncodeStringBytesRaw(v2) + } + } + e.mapEnd() } func (e *Encoder) fastpathEncMapStringUintR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringUintV(rv2i(rv).(map[string]uint), e) } -func (_ fastpathT) EncMapStringUintV(v map[string]uint, e *Encoder) { +func (fastpathT) EncMapStringUintV(v map[string]uint, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i uint for k := range v { - v2[i] = string(k) + v2[i] = k i++ } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[string(k2)])) + e.mapElemValue() + e.e.EncodeUint(uint64(v[k2])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemValue() + e.e.EncodeUint(uint64(v2)) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapStringUint8R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringUint8V(rv2i(rv).(map[string]uint8), e) } -func (_ fastpathT) EncMapStringUint8V(v map[string]uint8, e *Encoder) { +func (fastpathT) EncMapStringUint8V(v map[string]uint8, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i uint for k := range v { - v2[i] = string(k) + v2[i] = k i++ } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[string(k2)])) + e.mapElemValue() + e.e.EncodeUint(uint64(v[k2])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemValue() + e.e.EncodeUint(uint64(v2)) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapStringUint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapStringUint16V(rv2i(rv).(map[string]uint16), e) -} -func (_ fastpathT) EncMapStringUint16V(v map[string]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]string, len(v)) - var i uint - for k := range v { - v2[i] = string(k) - i++ - } - sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) - } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[string(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) - } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapStringUint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapStringUint32V(rv2i(rv).(map[string]uint32), e) -} -func (_ fastpathT) EncMapStringUint32V(v map[string]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]string, len(v)) - var i uint - for k := range v { - v2[i] = string(k) - i++ - } - sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) - } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[string(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) - } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapStringUint64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringUint64V(rv2i(rv).(map[string]uint64), e) } -func (_ fastpathT) EncMapStringUint64V(v map[string]uint64, e *Encoder) { +func (fastpathT) EncMapStringUint64V(v map[string]uint64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i uint for k := range v { - v2[i] = string(k) + v2[i] = k i++ } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[string(k2)])) + e.mapElemValue() + e.e.EncodeUint(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemValue() + e.e.EncodeUint(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapStringUintptrR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringUintptrV(rv2i(rv).(map[string]uintptr), e) } -func (_ fastpathT) EncMapStringUintptrV(v map[string]uintptr, e *Encoder) { +func (fastpathT) EncMapStringUintptrV(v map[string]uintptr, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i uint for k := range v { - v2[i] = string(k) + v2[i] = k i++ } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - e.encode(v[string(k2)]) + e.mapElemValue() + e.encode(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() + e.e.EncodeStringEnc(cUTF8, k2) } + e.mapElemValue() e.encode(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapStringIntR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringIntV(rv2i(rv).(map[string]int), e) } -func (_ fastpathT) EncMapStringIntV(v map[string]int, e *Encoder) { +func (fastpathT) EncMapStringIntV(v map[string]int, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i uint for k := range v { - v2[i] = string(k) + v2[i] = k i++ } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[string(k2)])) + e.mapElemValue() + e.e.EncodeInt(int64(v[k2])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) + e.mapElemValue() + e.e.EncodeInt(int64(v2)) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapStringInt8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapStringInt8V(rv2i(rv).(map[string]int8), e) -} -func (_ fastpathT) EncMapStringInt8V(v map[string]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]string, len(v)) - var i uint - for k := range v { - v2[i] = string(k) - i++ - } - sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) - } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[string(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) - } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapStringInt16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapStringInt16V(rv2i(rv).(map[string]int16), e) -} -func (_ fastpathT) EncMapStringInt16V(v map[string]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]string, len(v)) - var i uint - for k := range v { - v2[i] = string(k) - i++ - } - sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) - } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[string(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) - } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapStringInt32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapStringInt32V(rv2i(rv).(map[string]int32), e) -} -func (_ fastpathT) EncMapStringInt32V(v map[string]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]string, len(v)) - var i uint - for k := range v { - v2[i] = string(k) - i++ - } - sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) - } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[string(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) - } else { - ee.EncodeStringEnc(cUTF8, k2) - } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapStringInt64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringInt64V(rv2i(rv).(map[string]int64), e) } -func (_ fastpathT) EncMapStringInt64V(v map[string]int64, e *Encoder) { +func (fastpathT) EncMapStringInt64V(v map[string]int64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i uint for k := range v { - v2[i] = string(k) + v2[i] = k i++ } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[string(k2)])) + e.mapElemValue() + e.e.EncodeInt(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) + e.mapElemValue() + e.e.EncodeInt(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapStringFloat32R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringFloat32V(rv2i(rv).(map[string]float32), e) } -func (_ fastpathT) EncMapStringFloat32V(v map[string]float32, e *Encoder) { +func (fastpathT) EncMapStringFloat32V(v map[string]float32, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i uint for k := range v { - v2[i] = string(k) + v2[i] = k i++ } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[string(k2)]) + e.mapElemValue() + e.e.EncodeFloat32(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) + e.mapElemValue() + e.e.EncodeFloat32(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapStringFloat64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringFloat64V(rv2i(rv).(map[string]float64), e) } -func (_ fastpathT) EncMapStringFloat64V(v map[string]float64, e *Encoder) { +func (fastpathT) EncMapStringFloat64V(v map[string]float64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i uint for k := range v { - v2[i] = string(k) + v2[i] = k i++ } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[string(k2)]) + e.mapElemValue() + e.e.EncodeFloat64(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) + e.mapElemValue() + e.e.EncodeFloat64(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapStringBoolR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringBoolV(rv2i(rv).(map[string]bool), e) } -func (_ fastpathT) EncMapStringBoolV(v map[string]bool, e *Encoder) { +func (fastpathT) EncMapStringBoolV(v map[string]bool, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i uint for k := range v { - v2[i] = string(k) + v2[i] = k i++ } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[string(k2)]) + e.mapElemValue() + e.e.EncodeBool(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } + e.mapElemKey() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(k2)) + e.e.EncodeStringBytesRaw(bytesView(k2)) } else { - ee.EncodeStringEnc(cUTF8, k2) + e.e.EncodeStringEnc(cUTF8, k2) } - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32IntfR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32IntfV(rv2i(rv).(map[float32]interface{}), e) -} -func (_ fastpathT) EncMapFloat32IntfV(v map[float32]interface{}, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[float32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32StringR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32StringV(rv2i(rv).(map[float32]string), e) -} -func (_ fastpathT) EncMapFloat32StringV(v map[float32]string, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[float32(k2)])) - } else { - ee.EncodeStringEnc(cUTF8, v[float32(k2)]) - } - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) - } else { - ee.EncodeStringEnc(cUTF8, v2) - } - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32UintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32UintV(rv2i(rv).(map[float32]uint), e) -} -func (_ fastpathT) EncMapFloat32UintV(v map[float32]uint, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[float32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32Uint8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32Uint8V(rv2i(rv).(map[float32]uint8), e) -} -func (_ fastpathT) EncMapFloat32Uint8V(v map[float32]uint8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[float32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32Uint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32Uint16V(rv2i(rv).(map[float32]uint16), e) -} -func (_ fastpathT) EncMapFloat32Uint16V(v map[float32]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[float32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32Uint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32Uint32V(rv2i(rv).(map[float32]uint32), e) -} -func (_ fastpathT) EncMapFloat32Uint32V(v map[float32]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[float32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32Uint64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32Uint64V(rv2i(rv).(map[float32]uint64), e) -} -func (_ fastpathT) EncMapFloat32Uint64V(v map[float32]uint64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[float32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32UintptrR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32UintptrV(rv2i(rv).(map[float32]uintptr), e) -} -func (_ fastpathT) EncMapFloat32UintptrV(v map[float32]uintptr, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[float32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32IntR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32IntV(rv2i(rv).(map[float32]int), e) -} -func (_ fastpathT) EncMapFloat32IntV(v map[float32]int, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[float32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32Int8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32Int8V(rv2i(rv).(map[float32]int8), e) -} -func (_ fastpathT) EncMapFloat32Int8V(v map[float32]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[float32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32Int16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32Int16V(rv2i(rv).(map[float32]int16), e) -} -func (_ fastpathT) EncMapFloat32Int16V(v map[float32]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[float32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32Int32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32Int32V(rv2i(rv).(map[float32]int32), e) -} -func (_ fastpathT) EncMapFloat32Int32V(v map[float32]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[float32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32Int64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32Int64V(rv2i(rv).(map[float32]int64), e) -} -func (_ fastpathT) EncMapFloat32Int64V(v map[float32]int64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[float32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32Float32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32Float32V(rv2i(rv).(map[float32]float32), e) -} -func (_ fastpathT) EncMapFloat32Float32V(v map[float32]float32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[float32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32Float64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32Float64V(rv2i(rv).(map[float32]float64), e) -} -func (_ fastpathT) EncMapFloat32Float64V(v map[float32]float64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[float32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat32BoolR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat32BoolV(rv2i(rv).(map[float32]bool), e) -} -func (_ fastpathT) EncMapFloat32BoolV(v map[float32]bool, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(float32(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[float32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat32(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64IntfR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64IntfV(rv2i(rv).(map[float64]interface{}), e) -} -func (_ fastpathT) EncMapFloat64IntfV(v map[float64]interface{}, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[float64(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64StringR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64StringV(rv2i(rv).(map[float64]string), e) -} -func (_ fastpathT) EncMapFloat64StringV(v map[float64]string, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[float64(k2)])) - } else { - ee.EncodeStringEnc(cUTF8, v[float64(k2)]) - } - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) - } else { - ee.EncodeStringEnc(cUTF8, v2) - } - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64UintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64UintV(rv2i(rv).(map[float64]uint), e) -} -func (_ fastpathT) EncMapFloat64UintV(v map[float64]uint, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[float64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64Uint8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64Uint8V(rv2i(rv).(map[float64]uint8), e) -} -func (_ fastpathT) EncMapFloat64Uint8V(v map[float64]uint8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[float64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64Uint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64Uint16V(rv2i(rv).(map[float64]uint16), e) -} -func (_ fastpathT) EncMapFloat64Uint16V(v map[float64]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[float64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64Uint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64Uint32V(rv2i(rv).(map[float64]uint32), e) -} -func (_ fastpathT) EncMapFloat64Uint32V(v map[float64]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[float64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64Uint64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64Uint64V(rv2i(rv).(map[float64]uint64), e) -} -func (_ fastpathT) EncMapFloat64Uint64V(v map[float64]uint64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[float64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64UintptrR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64UintptrV(rv2i(rv).(map[float64]uintptr), e) -} -func (_ fastpathT) EncMapFloat64UintptrV(v map[float64]uintptr, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[float64(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64IntR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64IntV(rv2i(rv).(map[float64]int), e) -} -func (_ fastpathT) EncMapFloat64IntV(v map[float64]int, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[float64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64Int8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64Int8V(rv2i(rv).(map[float64]int8), e) -} -func (_ fastpathT) EncMapFloat64Int8V(v map[float64]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[float64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64Int16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64Int16V(rv2i(rv).(map[float64]int16), e) -} -func (_ fastpathT) EncMapFloat64Int16V(v map[float64]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[float64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64Int32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64Int32V(rv2i(rv).(map[float64]int32), e) -} -func (_ fastpathT) EncMapFloat64Int32V(v map[float64]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[float64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64Int64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64Int64V(rv2i(rv).(map[float64]int64), e) -} -func (_ fastpathT) EncMapFloat64Int64V(v map[float64]int64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[float64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64Float32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64Float32V(rv2i(rv).(map[float64]float32), e) -} -func (_ fastpathT) EncMapFloat64Float32V(v map[float64]float32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[float64(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64Float64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64Float64V(rv2i(rv).(map[float64]float64), e) -} -func (_ fastpathT) EncMapFloat64Float64V(v map[float64]float64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[float64(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapFloat64BoolR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapFloat64BoolV(rv2i(rv).(map[float64]bool), e) -} -func (_ fastpathT) EncMapFloat64BoolV(v map[float64]bool, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]float64, len(v)) - var i uint - for k := range v { - v2[i] = float64(k) - i++ - } - sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(float64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[float64(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeFloat64(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) + e.mapElemValue() + e.e.EncodeBool(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUintIntfR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUintIntfV(rv2i(rv).(map[uint]interface{}), e) } -func (_ fastpathT) EncMapUintIntfV(v map[uint]interface{}, e *Encoder) { +func (fastpathT) EncMapUintIntfV(v map[uint]interface{}, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5188,42 +1739,33 @@ func (_ fastpathT) EncMapUintIntfV(v map[uint]interface{}, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(uint64(uint(k2))) + e.mapElemValue() e.encode(v[uint(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() e.encode(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUintStringR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUintStringV(rv2i(rv).(map[uint]string), e) } -func (_ fastpathT) EncMapUintStringV(v map[uint]string, e *Encoder) { +func (fastpathT) EncMapUintStringV(v map[uint]string, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5231,50 +1773,75 @@ func (_ fastpathT) EncMapUintStringV(v map[uint]string, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(uint64(uint(k2))) + e.mapElemValue() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[uint(k2)])) + e.e.EncodeStringBytesRaw(bytesView(v[uint(k2)])) } else { - ee.EncodeStringEnc(cUTF8, v[uint(k2)]) + e.e.EncodeStringEnc(cUTF8, v[uint(k2)]) } } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) + e.e.EncodeStringBytesRaw(bytesView(v2)) } else { - ee.EncodeStringEnc(cUTF8, v2) + e.e.EncodeStringEnc(cUTF8, v2) } } } - ee.WriteMapEnd() + e.mapEnd() +} + +func (e *Encoder) fastpathEncMapUintBytesR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintBytesV(rv2i(rv).(map[uint][]byte), e) +} +func (fastpathT) EncMapUintBytesV(v map[uint][]byte, e *Encoder) { + if v == nil { + e.e.EncodeNil() + return + } + e.mapStart(len(v)) + if e.h.Canonical { + v2 := make([]uint64, len(v)) + var i uint + for k := range v { + v2[i] = uint64(k) + i++ + } + sort.Sort(uint64Slice(v2)) + for _, k2 := range v2 { + e.mapElemKey() + e.e.EncodeUint(uint64(uint(k2))) + e.mapElemValue() + e.e.EncodeStringBytesRaw(v[uint(k2)]) + } + } else { + for k2, v2 := range v { + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeStringBytesRaw(v2) + } + } + e.mapEnd() } func (e *Encoder) fastpathEncMapUintUintR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUintUintV(rv2i(rv).(map[uint]uint), e) } -func (_ fastpathT) EncMapUintUintV(v map[uint]uint, e *Encoder) { +func (fastpathT) EncMapUintUintV(v map[uint]uint, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5282,42 +1849,33 @@ func (_ fastpathT) EncMapUintUintV(v map[uint]uint, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint(k2)])) + e.mapElemKey() + e.e.EncodeUint(uint64(uint(k2))) + e.mapElemValue() + e.e.EncodeUint(uint64(v[uint(k2)])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeUint(uint64(v2)) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUintUint8R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUintUint8V(rv2i(rv).(map[uint]uint8), e) } -func (_ fastpathT) EncMapUintUint8V(v map[uint]uint8, e *Encoder) { +func (fastpathT) EncMapUintUint8V(v map[uint]uint8, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5325,128 +1883,33 @@ func (_ fastpathT) EncMapUintUint8V(v map[uint]uint8, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint(k2)])) + e.mapElemKey() + e.e.EncodeUint(uint64(uint(k2))) + e.mapElemValue() + e.e.EncodeUint(uint64(v[uint(k2)])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeUint(uint64(v2)) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintUint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintUint16V(rv2i(rv).(map[uint]uint16), e) -} -func (_ fastpathT) EncMapUintUint16V(v map[uint]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintUint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintUint32V(rv2i(rv).(map[uint]uint32), e) -} -func (_ fastpathT) EncMapUintUint32V(v map[uint]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUintUint64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUintUint64V(rv2i(rv).(map[uint]uint64), e) } -func (_ fastpathT) EncMapUintUint64V(v map[uint]uint64, e *Encoder) { +func (fastpathT) EncMapUintUint64V(v map[uint]uint64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5454,42 +1917,33 @@ func (_ fastpathT) EncMapUintUint64V(v map[uint]uint64, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint(k2)])) + e.mapElemKey() + e.e.EncodeUint(uint64(uint(k2))) + e.mapElemValue() + e.e.EncodeUint(v[uint(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeUint(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUintUintptrR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUintUintptrV(rv2i(rv).(map[uint]uintptr), e) } -func (_ fastpathT) EncMapUintUintptrV(v map[uint]uintptr, e *Encoder) { +func (fastpathT) EncMapUintUintptrV(v map[uint]uintptr, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5497,42 +1951,33 @@ func (_ fastpathT) EncMapUintUintptrV(v map[uint]uintptr, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(uint64(uint(k2))) + e.mapElemValue() e.encode(v[uint(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() e.encode(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUintIntR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUintIntV(rv2i(rv).(map[uint]int), e) } -func (_ fastpathT) EncMapUintIntV(v map[uint]int, e *Encoder) { +func (fastpathT) EncMapUintIntV(v map[uint]int, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5540,171 +1985,33 @@ func (_ fastpathT) EncMapUintIntV(v map[uint]int, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint(k2)])) + e.mapElemKey() + e.e.EncodeUint(uint64(uint(k2))) + e.mapElemValue() + e.e.EncodeInt(int64(v[uint(k2)])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeInt(int64(v2)) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintInt8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintInt8V(rv2i(rv).(map[uint]int8), e) -} -func (_ fastpathT) EncMapUintInt8V(v map[uint]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintInt16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintInt16V(rv2i(rv).(map[uint]int16), e) -} -func (_ fastpathT) EncMapUintInt16V(v map[uint]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintInt32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintInt32V(rv2i(rv).(map[uint]int32), e) -} -func (_ fastpathT) EncMapUintInt32V(v map[uint]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUintInt64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUintInt64V(rv2i(rv).(map[uint]int64), e) } -func (_ fastpathT) EncMapUintInt64V(v map[uint]int64, e *Encoder) { +func (fastpathT) EncMapUintInt64V(v map[uint]int64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5712,42 +2019,33 @@ func (_ fastpathT) EncMapUintInt64V(v map[uint]int64, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint(k2)])) + e.mapElemKey() + e.e.EncodeUint(uint64(uint(k2))) + e.mapElemValue() + e.e.EncodeInt(v[uint(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeInt(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUintFloat32R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUintFloat32V(rv2i(rv).(map[uint]float32), e) } -func (_ fastpathT) EncMapUintFloat32V(v map[uint]float32, e *Encoder) { +func (fastpathT) EncMapUintFloat32V(v map[uint]float32, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5755,42 +2053,33 @@ func (_ fastpathT) EncMapUintFloat32V(v map[uint]float32, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[uint(k2)]) + e.mapElemKey() + e.e.EncodeUint(uint64(uint(k2))) + e.mapElemValue() + e.e.EncodeFloat32(v[uint(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeFloat32(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUintFloat64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUintFloat64V(rv2i(rv).(map[uint]float64), e) } -func (_ fastpathT) EncMapUintFloat64V(v map[uint]float64, e *Encoder) { +func (fastpathT) EncMapUintFloat64V(v map[uint]float64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5798,42 +2087,33 @@ func (_ fastpathT) EncMapUintFloat64V(v map[uint]float64, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[uint(k2)]) + e.mapElemKey() + e.e.EncodeUint(uint64(uint(k2))) + e.mapElemValue() + e.e.EncodeFloat64(v[uint(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeFloat64(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUintBoolR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUintBoolV(rv2i(rv).(map[uint]bool), e) } -func (_ fastpathT) EncMapUintBoolV(v map[uint]bool, e *Encoder) { +func (fastpathT) EncMapUintBoolV(v map[uint]bool, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5841,42 +2121,33 @@ func (_ fastpathT) EncMapUintBoolV(v map[uint]bool, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[uint(k2)]) + e.mapElemKey() + e.e.EncodeUint(uint64(uint(k2))) + e.mapElemValue() + e.e.EncodeBool(v[uint(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeBool(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint8IntfR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8IntfV(rv2i(rv).(map[uint8]interface{}), e) } -func (_ fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, e *Encoder) { +func (fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5884,42 +2155,33 @@ func (_ fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(uint64(uint8(k2))) + e.mapElemValue() e.encode(v[uint8(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() e.encode(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint8StringR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8StringV(rv2i(rv).(map[uint8]string), e) } -func (_ fastpathT) EncMapUint8StringV(v map[uint8]string, e *Encoder) { +func (fastpathT) EncMapUint8StringV(v map[uint8]string, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5927,50 +2189,75 @@ func (_ fastpathT) EncMapUint8StringV(v map[uint8]string, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(uint64(uint8(k2))) + e.mapElemValue() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[uint8(k2)])) + e.e.EncodeStringBytesRaw(bytesView(v[uint8(k2)])) } else { - ee.EncodeStringEnc(cUTF8, v[uint8(k2)]) + e.e.EncodeStringEnc(cUTF8, v[uint8(k2)]) } } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) + e.e.EncodeStringBytesRaw(bytesView(v2)) } else { - ee.EncodeStringEnc(cUTF8, v2) + e.e.EncodeStringEnc(cUTF8, v2) } } } - ee.WriteMapEnd() + e.mapEnd() +} + +func (e *Encoder) fastpathEncMapUint8BytesR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8BytesV(rv2i(rv).(map[uint8][]byte), e) +} +func (fastpathT) EncMapUint8BytesV(v map[uint8][]byte, e *Encoder) { + if v == nil { + e.e.EncodeNil() + return + } + e.mapStart(len(v)) + if e.h.Canonical { + v2 := make([]uint64, len(v)) + var i uint + for k := range v { + v2[i] = uint64(k) + i++ + } + sort.Sort(uint64Slice(v2)) + for _, k2 := range v2 { + e.mapElemKey() + e.e.EncodeUint(uint64(uint8(k2))) + e.mapElemValue() + e.e.EncodeStringBytesRaw(v[uint8(k2)]) + } + } else { + for k2, v2 := range v { + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeStringBytesRaw(v2) + } + } + e.mapEnd() } func (e *Encoder) fastpathEncMapUint8UintR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8UintV(rv2i(rv).(map[uint8]uint), e) } -func (_ fastpathT) EncMapUint8UintV(v map[uint8]uint, e *Encoder) { +func (fastpathT) EncMapUint8UintV(v map[uint8]uint, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -5978,42 +2265,33 @@ func (_ fastpathT) EncMapUint8UintV(v map[uint8]uint, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint8(k2)])) + e.mapElemKey() + e.e.EncodeUint(uint64(uint8(k2))) + e.mapElemValue() + e.e.EncodeUint(uint64(v[uint8(k2)])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeUint(uint64(v2)) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8Uint8V(rv2i(rv).(map[uint8]uint8), e) } -func (_ fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, e *Encoder) { +func (fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -6021,128 +2299,33 @@ func (_ fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint8(k2)])) + e.mapElemKey() + e.e.EncodeUint(uint64(uint8(k2))) + e.mapElemValue() + e.e.EncodeUint(uint64(v[uint8(k2)])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeUint(uint64(v2)) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint8Uint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint8Uint16V(rv2i(rv).(map[uint8]uint16), e) -} -func (_ fastpathT) EncMapUint8Uint16V(v map[uint8]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint8Uint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint8Uint32V(rv2i(rv).(map[uint8]uint32), e) -} -func (_ fastpathT) EncMapUint8Uint32V(v map[uint8]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8Uint64V(rv2i(rv).(map[uint8]uint64), e) } -func (_ fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, e *Encoder) { +func (fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -6150,42 +2333,33 @@ func (_ fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint8(k2)])) + e.mapElemKey() + e.e.EncodeUint(uint64(uint8(k2))) + e.mapElemValue() + e.e.EncodeUint(v[uint8(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeUint(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint8UintptrR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8UintptrV(rv2i(rv).(map[uint8]uintptr), e) } -func (_ fastpathT) EncMapUint8UintptrV(v map[uint8]uintptr, e *Encoder) { +func (fastpathT) EncMapUint8UintptrV(v map[uint8]uintptr, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -6193,42 +2367,33 @@ func (_ fastpathT) EncMapUint8UintptrV(v map[uint8]uintptr, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(uint64(uint8(k2))) + e.mapElemValue() e.encode(v[uint8(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() e.encode(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint8IntR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8IntV(rv2i(rv).(map[uint8]int), e) } -func (_ fastpathT) EncMapUint8IntV(v map[uint8]int, e *Encoder) { +func (fastpathT) EncMapUint8IntV(v map[uint8]int, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -6236,171 +2401,33 @@ func (_ fastpathT) EncMapUint8IntV(v map[uint8]int, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint8(k2)])) + e.mapElemKey() + e.e.EncodeUint(uint64(uint8(k2))) + e.mapElemValue() + e.e.EncodeInt(int64(v[uint8(k2)])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeInt(int64(v2)) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint8Int8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint8Int8V(rv2i(rv).(map[uint8]int8), e) -} -func (_ fastpathT) EncMapUint8Int8V(v map[uint8]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint8Int16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint8Int16V(rv2i(rv).(map[uint8]int16), e) -} -func (_ fastpathT) EncMapUint8Int16V(v map[uint8]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint8Int32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint8Int32V(rv2i(rv).(map[uint8]int32), e) -} -func (_ fastpathT) EncMapUint8Int32V(v map[uint8]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint8Int64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8Int64V(rv2i(rv).(map[uint8]int64), e) } -func (_ fastpathT) EncMapUint8Int64V(v map[uint8]int64, e *Encoder) { +func (fastpathT) EncMapUint8Int64V(v map[uint8]int64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -6408,42 +2435,33 @@ func (_ fastpathT) EncMapUint8Int64V(v map[uint8]int64, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint8(k2)])) + e.mapElemKey() + e.e.EncodeUint(uint64(uint8(k2))) + e.mapElemValue() + e.e.EncodeInt(v[uint8(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeInt(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint8Float32R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8Float32V(rv2i(rv).(map[uint8]float32), e) } -func (_ fastpathT) EncMapUint8Float32V(v map[uint8]float32, e *Encoder) { +func (fastpathT) EncMapUint8Float32V(v map[uint8]float32, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -6451,42 +2469,33 @@ func (_ fastpathT) EncMapUint8Float32V(v map[uint8]float32, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[uint8(k2)]) + e.mapElemKey() + e.e.EncodeUint(uint64(uint8(k2))) + e.mapElemValue() + e.e.EncodeFloat32(v[uint8(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeFloat32(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint8Float64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8Float64V(rv2i(rv).(map[uint8]float64), e) } -func (_ fastpathT) EncMapUint8Float64V(v map[uint8]float64, e *Encoder) { +func (fastpathT) EncMapUint8Float64V(v map[uint8]float64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -6494,42 +2503,33 @@ func (_ fastpathT) EncMapUint8Float64V(v map[uint8]float64, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[uint8(k2)]) + e.mapElemKey() + e.e.EncodeUint(uint64(uint8(k2))) + e.mapElemValue() + e.e.EncodeFloat64(v[uint8(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeFloat64(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint8BoolR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8BoolV(rv2i(rv).(map[uint8]bool), e) } -func (_ fastpathT) EncMapUint8BoolV(v map[uint8]bool, e *Encoder) { +func (fastpathT) EncMapUint8BoolV(v map[uint8]bool, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint @@ -6537,2826 +2537,449 @@ func (_ fastpathT) EncMapUint8BoolV(v map[uint8]bool, e *Encoder) { v2[i] = uint64(k) i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[uint8(k2)]) + e.mapElemKey() + e.e.EncodeUint(uint64(uint8(k2))) + e.mapElemValue() + e.e.EncodeBool(v[uint8(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) + e.mapElemKey() + e.e.EncodeUint(uint64(k2)) + e.mapElemValue() + e.e.EncodeBool(v2) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16IntfR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16IntfV(rv2i(rv).(map[uint16]interface{}), e) -} -func (_ fastpathT) EncMapUint16IntfV(v map[uint16]interface{}, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[uint16(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16StringR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16StringV(rv2i(rv).(map[uint16]string), e) -} -func (_ fastpathT) EncMapUint16StringV(v map[uint16]string, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[uint16(k2)])) - } else { - ee.EncodeStringEnc(cUTF8, v[uint16(k2)]) - } - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) - } else { - ee.EncodeStringEnc(cUTF8, v2) - } - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16UintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16UintV(rv2i(rv).(map[uint16]uint), e) -} -func (_ fastpathT) EncMapUint16UintV(v map[uint16]uint, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16Uint8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16Uint8V(rv2i(rv).(map[uint16]uint8), e) -} -func (_ fastpathT) EncMapUint16Uint8V(v map[uint16]uint8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16Uint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16Uint16V(rv2i(rv).(map[uint16]uint16), e) -} -func (_ fastpathT) EncMapUint16Uint16V(v map[uint16]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16Uint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16Uint32V(rv2i(rv).(map[uint16]uint32), e) -} -func (_ fastpathT) EncMapUint16Uint32V(v map[uint16]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16Uint64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16Uint64V(rv2i(rv).(map[uint16]uint64), e) -} -func (_ fastpathT) EncMapUint16Uint64V(v map[uint16]uint64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16UintptrR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16UintptrV(rv2i(rv).(map[uint16]uintptr), e) -} -func (_ fastpathT) EncMapUint16UintptrV(v map[uint16]uintptr, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[uint16(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16IntR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16IntV(rv2i(rv).(map[uint16]int), e) -} -func (_ fastpathT) EncMapUint16IntV(v map[uint16]int, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16Int8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16Int8V(rv2i(rv).(map[uint16]int8), e) -} -func (_ fastpathT) EncMapUint16Int8V(v map[uint16]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16Int16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16Int16V(rv2i(rv).(map[uint16]int16), e) -} -func (_ fastpathT) EncMapUint16Int16V(v map[uint16]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16Int32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16Int32V(rv2i(rv).(map[uint16]int32), e) -} -func (_ fastpathT) EncMapUint16Int32V(v map[uint16]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16Int64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16Int64V(rv2i(rv).(map[uint16]int64), e) -} -func (_ fastpathT) EncMapUint16Int64V(v map[uint16]int64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16Float32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16Float32V(rv2i(rv).(map[uint16]float32), e) -} -func (_ fastpathT) EncMapUint16Float32V(v map[uint16]float32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[uint16(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16Float64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16Float64V(rv2i(rv).(map[uint16]float64), e) -} -func (_ fastpathT) EncMapUint16Float64V(v map[uint16]float64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[uint16(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint16BoolR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint16BoolV(rv2i(rv).(map[uint16]bool), e) -} -func (_ fastpathT) EncMapUint16BoolV(v map[uint16]bool, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[uint16(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32IntfR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32IntfV(rv2i(rv).(map[uint32]interface{}), e) -} -func (_ fastpathT) EncMapUint32IntfV(v map[uint32]interface{}, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[uint32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32StringR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32StringV(rv2i(rv).(map[uint32]string), e) -} -func (_ fastpathT) EncMapUint32StringV(v map[uint32]string, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[uint32(k2)])) - } else { - ee.EncodeStringEnc(cUTF8, v[uint32(k2)]) - } - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) - } else { - ee.EncodeStringEnc(cUTF8, v2) - } - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32UintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32UintV(rv2i(rv).(map[uint32]uint), e) -} -func (_ fastpathT) EncMapUint32UintV(v map[uint32]uint, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32Uint8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32Uint8V(rv2i(rv).(map[uint32]uint8), e) -} -func (_ fastpathT) EncMapUint32Uint8V(v map[uint32]uint8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32Uint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32Uint16V(rv2i(rv).(map[uint32]uint16), e) -} -func (_ fastpathT) EncMapUint32Uint16V(v map[uint32]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32Uint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32Uint32V(rv2i(rv).(map[uint32]uint32), e) -} -func (_ fastpathT) EncMapUint32Uint32V(v map[uint32]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32Uint64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32Uint64V(rv2i(rv).(map[uint32]uint64), e) -} -func (_ fastpathT) EncMapUint32Uint64V(v map[uint32]uint64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32UintptrR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32UintptrV(rv2i(rv).(map[uint32]uintptr), e) -} -func (_ fastpathT) EncMapUint32UintptrV(v map[uint32]uintptr, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[uint32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32IntR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32IntV(rv2i(rv).(map[uint32]int), e) -} -func (_ fastpathT) EncMapUint32IntV(v map[uint32]int, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32Int8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32Int8V(rv2i(rv).(map[uint32]int8), e) -} -func (_ fastpathT) EncMapUint32Int8V(v map[uint32]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32Int16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32Int16V(rv2i(rv).(map[uint32]int16), e) -} -func (_ fastpathT) EncMapUint32Int16V(v map[uint32]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32Int32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32Int32V(rv2i(rv).(map[uint32]int32), e) -} -func (_ fastpathT) EncMapUint32Int32V(v map[uint32]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32Int64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32Int64V(rv2i(rv).(map[uint32]int64), e) -} -func (_ fastpathT) EncMapUint32Int64V(v map[uint32]int64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32Float32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32Float32V(rv2i(rv).(map[uint32]float32), e) -} -func (_ fastpathT) EncMapUint32Float32V(v map[uint32]float32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[uint32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32Float64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32Float64V(rv2i(rv).(map[uint32]float64), e) -} -func (_ fastpathT) EncMapUint32Float64V(v map[uint32]float64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[uint32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint32BoolR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint32BoolV(rv2i(rv).(map[uint32]bool), e) -} -func (_ fastpathT) EncMapUint32BoolV(v map[uint32]bool, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[uint32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint64IntfR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint64IntfV(rv2i(rv).(map[uint64]interface{}), e) } -func (_ fastpathT) EncMapUint64IntfV(v map[uint64]interface{}, e *Encoder) { +func (fastpathT) EncMapUint64IntfV(v map[uint64]interface{}, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[uint64(k2)]) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.encode(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() e.encode(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint64StringR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint64StringV(rv2i(rv).(map[uint64]string), e) } -func (_ fastpathT) EncMapUint64StringV(v map[uint64]string, e *Encoder) { +func (fastpathT) EncMapUint64StringV(v map[uint64]string, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[uint64(k2)])) + e.e.EncodeStringBytesRaw(bytesView(v[k2])) } else { - ee.EncodeStringEnc(cUTF8, v[uint64(k2)]) + e.e.EncodeStringEnc(cUTF8, v[k2]) } } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) + e.e.EncodeStringBytesRaw(bytesView(v2)) } else { - ee.EncodeStringEnc(cUTF8, v2) + e.e.EncodeStringEnc(cUTF8, v2) } } } - ee.WriteMapEnd() + e.mapEnd() +} + +func (e *Encoder) fastpathEncMapUint64BytesR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64BytesV(rv2i(rv).(map[uint64][]byte), e) +} +func (fastpathT) EncMapUint64BytesV(v map[uint64][]byte, e *Encoder) { + if v == nil { + e.e.EncodeNil() + return + } + e.mapStart(len(v)) + if e.h.Canonical { + v2 := make([]uint64, len(v)) + var i uint + for k := range v { + v2[i] = k + i++ + } + sort.Sort(uint64Slice(v2)) + for _, k2 := range v2 { + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeStringBytesRaw(v[k2]) + } + } else { + for k2, v2 := range v { + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeStringBytesRaw(v2) + } + } + e.mapEnd() } func (e *Encoder) fastpathEncMapUint64UintR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint64UintV(rv2i(rv).(map[uint64]uint), e) } -func (_ fastpathT) EncMapUint64UintV(v map[uint64]uint, e *Encoder) { +func (fastpathT) EncMapUint64UintV(v map[uint64]uint, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint64(k2)])) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeUint(uint64(v[k2])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeUint(uint64(v2)) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint64Uint8V(rv2i(rv).(map[uint64]uint8), e) } -func (_ fastpathT) EncMapUint64Uint8V(v map[uint64]uint8, e *Encoder) { +func (fastpathT) EncMapUint64Uint8V(v map[uint64]uint8, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint64(k2)])) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeUint(uint64(v[k2])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeUint(uint64(v2)) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint64Uint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint64Uint16V(rv2i(rv).(map[uint64]uint16), e) -} -func (_ fastpathT) EncMapUint64Uint16V(v map[uint64]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint64Uint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint64Uint32V(rv2i(rv).(map[uint64]uint32), e) -} -func (_ fastpathT) EncMapUint64Uint32V(v map[uint64]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint64Uint64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint64Uint64V(rv2i(rv).(map[uint64]uint64), e) } -func (_ fastpathT) EncMapUint64Uint64V(v map[uint64]uint64, e *Encoder) { +func (fastpathT) EncMapUint64Uint64V(v map[uint64]uint64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uint64(k2)])) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeUint(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeUint(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint64UintptrR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint64UintptrV(rv2i(rv).(map[uint64]uintptr), e) } -func (_ fastpathT) EncMapUint64UintptrV(v map[uint64]uintptr, e *Encoder) { +func (fastpathT) EncMapUint64UintptrV(v map[uint64]uintptr, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[uint64(k2)]) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.encode(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() e.encode(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint64IntR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint64IntV(rv2i(rv).(map[uint64]int), e) } -func (_ fastpathT) EncMapUint64IntV(v map[uint64]int, e *Encoder) { +func (fastpathT) EncMapUint64IntV(v map[uint64]int, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint64(k2)])) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeInt(int64(v[k2])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeInt(int64(v2)) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint64Int8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint64Int8V(rv2i(rv).(map[uint64]int8), e) -} -func (_ fastpathT) EncMapUint64Int8V(v map[uint64]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint64Int16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint64Int16V(rv2i(rv).(map[uint64]int16), e) -} -func (_ fastpathT) EncMapUint64Int16V(v map[uint64]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUint64Int32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint64Int32V(rv2i(rv).(map[uint64]int32), e) -} -func (_ fastpathT) EncMapUint64Int32V(v map[uint64]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint64Int64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint64Int64V(rv2i(rv).(map[uint64]int64), e) } -func (_ fastpathT) EncMapUint64Int64V(v map[uint64]int64, e *Encoder) { +func (fastpathT) EncMapUint64Int64V(v map[uint64]int64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uint64(k2)])) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeInt(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeInt(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint64Float32R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint64Float32V(rv2i(rv).(map[uint64]float32), e) } -func (_ fastpathT) EncMapUint64Float32V(v map[uint64]float32, e *Encoder) { +func (fastpathT) EncMapUint64Float32V(v map[uint64]float32, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[uint64(k2)]) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeFloat32(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeFloat32(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint64Float64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint64Float64V(rv2i(rv).(map[uint64]float64), e) } -func (_ fastpathT) EncMapUint64Float64V(v map[uint64]float64, e *Encoder) { +func (fastpathT) EncMapUint64Float64V(v map[uint64]float64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[uint64(k2)]) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeFloat64(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeFloat64(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapUint64BoolR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint64BoolV(rv2i(rv).(map[uint64]bool), e) } -func (_ fastpathT) EncMapUint64BoolV(v map[uint64]bool, e *Encoder) { +func (fastpathT) EncMapUint64BoolV(v map[uint64]bool, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uintSlice(v2)) + sort.Sort(uint64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(uint64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[uint64(k2)]) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeBool(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeUint(uint64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) + e.mapElemKey() + e.e.EncodeUint(k2) + e.mapElemValue() + e.e.EncodeBool(v2) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrIntfR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrIntfV(rv2i(rv).(map[uintptr]interface{}), e) -} -func (_ fastpathT) EncMapUintptrIntfV(v map[uintptr]interface{}, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[uintptr(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrStringR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrStringV(rv2i(rv).(map[uintptr]string), e) -} -func (_ fastpathT) EncMapUintptrStringV(v map[uintptr]string, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[uintptr(k2)])) - } else { - ee.EncodeStringEnc(cUTF8, v[uintptr(k2)]) - } - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) - } else { - ee.EncodeStringEnc(cUTF8, v2) - } - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrUintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrUintV(rv2i(rv).(map[uintptr]uint), e) -} -func (_ fastpathT) EncMapUintptrUintV(v map[uintptr]uint, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uintptr(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrUint8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrUint8V(rv2i(rv).(map[uintptr]uint8), e) -} -func (_ fastpathT) EncMapUintptrUint8V(v map[uintptr]uint8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uintptr(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrUint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrUint16V(rv2i(rv).(map[uintptr]uint16), e) -} -func (_ fastpathT) EncMapUintptrUint16V(v map[uintptr]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uintptr(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrUint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrUint32V(rv2i(rv).(map[uintptr]uint32), e) -} -func (_ fastpathT) EncMapUintptrUint32V(v map[uintptr]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uintptr(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrUint64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrUint64V(rv2i(rv).(map[uintptr]uint64), e) -} -func (_ fastpathT) EncMapUintptrUint64V(v map[uintptr]uint64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[uintptr(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrUintptrR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrUintptrV(rv2i(rv).(map[uintptr]uintptr), e) -} -func (_ fastpathT) EncMapUintptrUintptrV(v map[uintptr]uintptr, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[uintptr(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrIntR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrIntV(rv2i(rv).(map[uintptr]int), e) -} -func (_ fastpathT) EncMapUintptrIntV(v map[uintptr]int, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uintptr(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrInt8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrInt8V(rv2i(rv).(map[uintptr]int8), e) -} -func (_ fastpathT) EncMapUintptrInt8V(v map[uintptr]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uintptr(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrInt16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrInt16V(rv2i(rv).(map[uintptr]int16), e) -} -func (_ fastpathT) EncMapUintptrInt16V(v map[uintptr]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uintptr(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrInt32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrInt32V(rv2i(rv).(map[uintptr]int32), e) -} -func (_ fastpathT) EncMapUintptrInt32V(v map[uintptr]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uintptr(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrInt64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrInt64V(rv2i(rv).(map[uintptr]int64), e) -} -func (_ fastpathT) EncMapUintptrInt64V(v map[uintptr]int64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[uintptr(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrFloat32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrFloat32V(rv2i(rv).(map[uintptr]float32), e) -} -func (_ fastpathT) EncMapUintptrFloat32V(v map[uintptr]float32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[uintptr(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrFloat64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrFloat64V(rv2i(rv).(map[uintptr]float64), e) -} -func (_ fastpathT) EncMapUintptrFloat64V(v map[uintptr]float64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[uintptr(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapUintptrBoolR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintptrBoolV(rv2i(rv).(map[uintptr]bool), e) -} -func (_ fastpathT) EncMapUintptrBoolV(v map[uintptr]bool, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - e.encode(uintptr(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[uintptr(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - e.encode(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapIntIntfR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapIntIntfV(rv2i(rv).(map[int]interface{}), e) } -func (_ fastpathT) EncMapIntIntfV(v map[int]interface{}, e *Encoder) { +func (fastpathT) EncMapIntIntfV(v map[int]interface{}, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint @@ -9364,42 +2987,33 @@ func (_ fastpathT) EncMapIntIntfV(v map[int]interface{}, e *Encoder) { v2[i] = int64(k) i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeInt(int64(int(k2))) + e.mapElemValue() e.encode(v[int(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeInt(int64(k2)) + e.mapElemValue() e.encode(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapIntStringR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapIntStringV(rv2i(rv).(map[int]string), e) } -func (_ fastpathT) EncMapIntStringV(v map[int]string, e *Encoder) { +func (fastpathT) EncMapIntStringV(v map[int]string, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint @@ -9407,50 +3021,75 @@ func (_ fastpathT) EncMapIntStringV(v map[int]string, e *Encoder) { v2[i] = int64(k) i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeInt(int64(int(k2))) + e.mapElemValue() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[int(k2)])) + e.e.EncodeStringBytesRaw(bytesView(v[int(k2)])) } else { - ee.EncodeStringEnc(cUTF8, v[int(k2)]) + e.e.EncodeStringEnc(cUTF8, v[int(k2)]) } } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeInt(int64(k2)) + e.mapElemValue() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) + e.e.EncodeStringBytesRaw(bytesView(v2)) } else { - ee.EncodeStringEnc(cUTF8, v2) + e.e.EncodeStringEnc(cUTF8, v2) } } } - ee.WriteMapEnd() + e.mapEnd() +} + +func (e *Encoder) fastpathEncMapIntBytesR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntBytesV(rv2i(rv).(map[int][]byte), e) +} +func (fastpathT) EncMapIntBytesV(v map[int][]byte, e *Encoder) { + if v == nil { + e.e.EncodeNil() + return + } + e.mapStart(len(v)) + if e.h.Canonical { + v2 := make([]int64, len(v)) + var i uint + for k := range v { + v2[i] = int64(k) + i++ + } + sort.Sort(int64Slice(v2)) + for _, k2 := range v2 { + e.mapElemKey() + e.e.EncodeInt(int64(int(k2))) + e.mapElemValue() + e.e.EncodeStringBytesRaw(v[int(k2)]) + } + } else { + for k2, v2 := range v { + e.mapElemKey() + e.e.EncodeInt(int64(k2)) + e.mapElemValue() + e.e.EncodeStringBytesRaw(v2) + } + } + e.mapEnd() } func (e *Encoder) fastpathEncMapIntUintR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapIntUintV(rv2i(rv).(map[int]uint), e) } -func (_ fastpathT) EncMapIntUintV(v map[int]uint, e *Encoder) { +func (fastpathT) EncMapIntUintV(v map[int]uint, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint @@ -9458,42 +3097,33 @@ func (_ fastpathT) EncMapIntUintV(v map[int]uint, e *Encoder) { v2[i] = int64(k) i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int(k2)])) + e.mapElemKey() + e.e.EncodeInt(int64(int(k2))) + e.mapElemValue() + e.e.EncodeUint(uint64(v[int(k2)])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeInt(int64(k2)) + e.mapElemValue() + e.e.EncodeUint(uint64(v2)) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapIntUint8R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapIntUint8V(rv2i(rv).(map[int]uint8), e) } -func (_ fastpathT) EncMapIntUint8V(v map[int]uint8, e *Encoder) { +func (fastpathT) EncMapIntUint8V(v map[int]uint8, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint @@ -9501,128 +3131,33 @@ func (_ fastpathT) EncMapIntUint8V(v map[int]uint8, e *Encoder) { v2[i] = int64(k) i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int(k2)])) + e.mapElemKey() + e.e.EncodeInt(int64(int(k2))) + e.mapElemValue() + e.e.EncodeUint(uint64(v[int(k2)])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeInt(int64(k2)) + e.mapElemValue() + e.e.EncodeUint(uint64(v2)) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntUint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntUint16V(rv2i(rv).(map[int]uint16), e) -} -func (_ fastpathT) EncMapIntUint16V(v map[int]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntUint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntUint32V(rv2i(rv).(map[int]uint32), e) -} -func (_ fastpathT) EncMapIntUint32V(v map[int]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapIntUint64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapIntUint64V(rv2i(rv).(map[int]uint64), e) } -func (_ fastpathT) EncMapIntUint64V(v map[int]uint64, e *Encoder) { +func (fastpathT) EncMapIntUint64V(v map[int]uint64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint @@ -9630,42 +3165,33 @@ func (_ fastpathT) EncMapIntUint64V(v map[int]uint64, e *Encoder) { v2[i] = int64(k) i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int(k2)])) + e.mapElemKey() + e.e.EncodeInt(int64(int(k2))) + e.mapElemValue() + e.e.EncodeUint(v[int(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeInt(int64(k2)) + e.mapElemValue() + e.e.EncodeUint(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapIntUintptrR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapIntUintptrV(rv2i(rv).(map[int]uintptr), e) } -func (_ fastpathT) EncMapIntUintptrV(v map[int]uintptr, e *Encoder) { +func (fastpathT) EncMapIntUintptrV(v map[int]uintptr, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint @@ -9673,42 +3199,33 @@ func (_ fastpathT) EncMapIntUintptrV(v map[int]uintptr, e *Encoder) { v2[i] = int64(k) i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeInt(int64(int(k2))) + e.mapElemValue() e.encode(v[int(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeInt(int64(k2)) + e.mapElemValue() e.encode(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapIntIntR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapIntIntV(rv2i(rv).(map[int]int), e) } -func (_ fastpathT) EncMapIntIntV(v map[int]int, e *Encoder) { +func (fastpathT) EncMapIntIntV(v map[int]int, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint @@ -9716,171 +3233,33 @@ func (_ fastpathT) EncMapIntIntV(v map[int]int, e *Encoder) { v2[i] = int64(k) i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int(k2)])) + e.mapElemKey() + e.e.EncodeInt(int64(int(k2))) + e.mapElemValue() + e.e.EncodeInt(int64(v[int(k2)])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) + e.mapElemKey() + e.e.EncodeInt(int64(k2)) + e.mapElemValue() + e.e.EncodeInt(int64(v2)) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntInt8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntInt8V(rv2i(rv).(map[int]int8), e) -} -func (_ fastpathT) EncMapIntInt8V(v map[int]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntInt16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntInt16V(rv2i(rv).(map[int]int16), e) -} -func (_ fastpathT) EncMapIntInt16V(v map[int]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapIntInt32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntInt32V(rv2i(rv).(map[int]int32), e) -} -func (_ fastpathT) EncMapIntInt32V(v map[int]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapIntInt64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapIntInt64V(rv2i(rv).(map[int]int64), e) } -func (_ fastpathT) EncMapIntInt64V(v map[int]int64, e *Encoder) { +func (fastpathT) EncMapIntInt64V(v map[int]int64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint @@ -9888,42 +3267,33 @@ func (_ fastpathT) EncMapIntInt64V(v map[int]int64, e *Encoder) { v2[i] = int64(k) i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int(k2)])) + e.mapElemKey() + e.e.EncodeInt(int64(int(k2))) + e.mapElemValue() + e.e.EncodeInt(v[int(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) + e.mapElemKey() + e.e.EncodeInt(int64(k2)) + e.mapElemValue() + e.e.EncodeInt(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapIntFloat32R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapIntFloat32V(rv2i(rv).(map[int]float32), e) } -func (_ fastpathT) EncMapIntFloat32V(v map[int]float32, e *Encoder) { +func (fastpathT) EncMapIntFloat32V(v map[int]float32, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint @@ -9931,42 +3301,33 @@ func (_ fastpathT) EncMapIntFloat32V(v map[int]float32, e *Encoder) { v2[i] = int64(k) i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[int(k2)]) + e.mapElemKey() + e.e.EncodeInt(int64(int(k2))) + e.mapElemValue() + e.e.EncodeFloat32(v[int(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) + e.mapElemKey() + e.e.EncodeInt(int64(k2)) + e.mapElemValue() + e.e.EncodeFloat32(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapIntFloat64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapIntFloat64V(rv2i(rv).(map[int]float64), e) } -func (_ fastpathT) EncMapIntFloat64V(v map[int]float64, e *Encoder) { +func (fastpathT) EncMapIntFloat64V(v map[int]float64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint @@ -9974,42 +3335,33 @@ func (_ fastpathT) EncMapIntFloat64V(v map[int]float64, e *Encoder) { v2[i] = int64(k) i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[int(k2)]) + e.mapElemKey() + e.e.EncodeInt(int64(int(k2))) + e.mapElemValue() + e.e.EncodeFloat64(v[int(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) + e.mapElemKey() + e.e.EncodeInt(int64(k2)) + e.mapElemValue() + e.e.EncodeFloat64(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapIntBoolR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapIntBoolV(rv2i(rv).(map[int]bool), e) } -func (_ fastpathT) EncMapIntBoolV(v map[int]bool, e *Encoder) { +func (fastpathT) EncMapIntBoolV(v map[int]bool, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint @@ -10017,3510 +3369,438 @@ func (_ fastpathT) EncMapIntBoolV(v map[int]bool, e *Encoder) { v2[i] = int64(k) i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[int(k2)]) + e.mapElemKey() + e.e.EncodeInt(int64(int(k2))) + e.mapElemValue() + e.e.EncodeBool(v[int(k2)]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) + e.mapElemKey() + e.e.EncodeInt(int64(k2)) + e.mapElemValue() + e.e.EncodeBool(v2) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8IntfR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8IntfV(rv2i(rv).(map[int8]interface{}), e) -} -func (_ fastpathT) EncMapInt8IntfV(v map[int8]interface{}, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[int8(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8StringR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8StringV(rv2i(rv).(map[int8]string), e) -} -func (_ fastpathT) EncMapInt8StringV(v map[int8]string, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[int8(k2)])) - } else { - ee.EncodeStringEnc(cUTF8, v[int8(k2)]) - } - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) - } else { - ee.EncodeStringEnc(cUTF8, v2) - } - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8UintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8UintV(rv2i(rv).(map[int8]uint), e) -} -func (_ fastpathT) EncMapInt8UintV(v map[int8]uint, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8Uint8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8Uint8V(rv2i(rv).(map[int8]uint8), e) -} -func (_ fastpathT) EncMapInt8Uint8V(v map[int8]uint8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8Uint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8Uint16V(rv2i(rv).(map[int8]uint16), e) -} -func (_ fastpathT) EncMapInt8Uint16V(v map[int8]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8Uint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8Uint32V(rv2i(rv).(map[int8]uint32), e) -} -func (_ fastpathT) EncMapInt8Uint32V(v map[int8]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8Uint64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8Uint64V(rv2i(rv).(map[int8]uint64), e) -} -func (_ fastpathT) EncMapInt8Uint64V(v map[int8]uint64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8UintptrR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8UintptrV(rv2i(rv).(map[int8]uintptr), e) -} -func (_ fastpathT) EncMapInt8UintptrV(v map[int8]uintptr, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[int8(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8IntR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8IntV(rv2i(rv).(map[int8]int), e) -} -func (_ fastpathT) EncMapInt8IntV(v map[int8]int, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8Int8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8Int8V(rv2i(rv).(map[int8]int8), e) -} -func (_ fastpathT) EncMapInt8Int8V(v map[int8]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8Int16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8Int16V(rv2i(rv).(map[int8]int16), e) -} -func (_ fastpathT) EncMapInt8Int16V(v map[int8]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8Int32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8Int32V(rv2i(rv).(map[int8]int32), e) -} -func (_ fastpathT) EncMapInt8Int32V(v map[int8]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8Int64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8Int64V(rv2i(rv).(map[int8]int64), e) -} -func (_ fastpathT) EncMapInt8Int64V(v map[int8]int64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int8(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8Float32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8Float32V(rv2i(rv).(map[int8]float32), e) -} -func (_ fastpathT) EncMapInt8Float32V(v map[int8]float32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[int8(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8Float64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8Float64V(rv2i(rv).(map[int8]float64), e) -} -func (_ fastpathT) EncMapInt8Float64V(v map[int8]float64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[int8(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt8BoolR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt8BoolV(rv2i(rv).(map[int8]bool), e) -} -func (_ fastpathT) EncMapInt8BoolV(v map[int8]bool, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int8(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[int8(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16IntfR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16IntfV(rv2i(rv).(map[int16]interface{}), e) -} -func (_ fastpathT) EncMapInt16IntfV(v map[int16]interface{}, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[int16(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16StringR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16StringV(rv2i(rv).(map[int16]string), e) -} -func (_ fastpathT) EncMapInt16StringV(v map[int16]string, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[int16(k2)])) - } else { - ee.EncodeStringEnc(cUTF8, v[int16(k2)]) - } - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) - } else { - ee.EncodeStringEnc(cUTF8, v2) - } - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16UintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16UintV(rv2i(rv).(map[int16]uint), e) -} -func (_ fastpathT) EncMapInt16UintV(v map[int16]uint, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16Uint8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16Uint8V(rv2i(rv).(map[int16]uint8), e) -} -func (_ fastpathT) EncMapInt16Uint8V(v map[int16]uint8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16Uint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16Uint16V(rv2i(rv).(map[int16]uint16), e) -} -func (_ fastpathT) EncMapInt16Uint16V(v map[int16]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16Uint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16Uint32V(rv2i(rv).(map[int16]uint32), e) -} -func (_ fastpathT) EncMapInt16Uint32V(v map[int16]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16Uint64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16Uint64V(rv2i(rv).(map[int16]uint64), e) -} -func (_ fastpathT) EncMapInt16Uint64V(v map[int16]uint64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16UintptrR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16UintptrV(rv2i(rv).(map[int16]uintptr), e) -} -func (_ fastpathT) EncMapInt16UintptrV(v map[int16]uintptr, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[int16(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16IntR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16IntV(rv2i(rv).(map[int16]int), e) -} -func (_ fastpathT) EncMapInt16IntV(v map[int16]int, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16Int8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16Int8V(rv2i(rv).(map[int16]int8), e) -} -func (_ fastpathT) EncMapInt16Int8V(v map[int16]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16Int16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16Int16V(rv2i(rv).(map[int16]int16), e) -} -func (_ fastpathT) EncMapInt16Int16V(v map[int16]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16Int32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16Int32V(rv2i(rv).(map[int16]int32), e) -} -func (_ fastpathT) EncMapInt16Int32V(v map[int16]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16Int64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16Int64V(rv2i(rv).(map[int16]int64), e) -} -func (_ fastpathT) EncMapInt16Int64V(v map[int16]int64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int16(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16Float32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16Float32V(rv2i(rv).(map[int16]float32), e) -} -func (_ fastpathT) EncMapInt16Float32V(v map[int16]float32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[int16(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16Float64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16Float64V(rv2i(rv).(map[int16]float64), e) -} -func (_ fastpathT) EncMapInt16Float64V(v map[int16]float64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[int16(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt16BoolR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt16BoolV(rv2i(rv).(map[int16]bool), e) -} -func (_ fastpathT) EncMapInt16BoolV(v map[int16]bool, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int16(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[int16(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32IntfR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32IntfV(rv2i(rv).(map[int32]interface{}), e) -} -func (_ fastpathT) EncMapInt32IntfV(v map[int32]interface{}, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[int32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32StringR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32StringV(rv2i(rv).(map[int32]string), e) -} -func (_ fastpathT) EncMapInt32StringV(v map[int32]string, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[int32(k2)])) - } else { - ee.EncodeStringEnc(cUTF8, v[int32(k2)]) - } - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) - } else { - ee.EncodeStringEnc(cUTF8, v2) - } - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32UintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32UintV(rv2i(rv).(map[int32]uint), e) -} -func (_ fastpathT) EncMapInt32UintV(v map[int32]uint, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32Uint8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32Uint8V(rv2i(rv).(map[int32]uint8), e) -} -func (_ fastpathT) EncMapInt32Uint8V(v map[int32]uint8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32Uint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32Uint16V(rv2i(rv).(map[int32]uint16), e) -} -func (_ fastpathT) EncMapInt32Uint16V(v map[int32]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32Uint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32Uint32V(rv2i(rv).(map[int32]uint32), e) -} -func (_ fastpathT) EncMapInt32Uint32V(v map[int32]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32Uint64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32Uint64V(rv2i(rv).(map[int32]uint64), e) -} -func (_ fastpathT) EncMapInt32Uint64V(v map[int32]uint64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32UintptrR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32UintptrV(rv2i(rv).(map[int32]uintptr), e) -} -func (_ fastpathT) EncMapInt32UintptrV(v map[int32]uintptr, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[int32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32IntR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32IntV(rv2i(rv).(map[int32]int), e) -} -func (_ fastpathT) EncMapInt32IntV(v map[int32]int, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32Int8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32Int8V(rv2i(rv).(map[int32]int8), e) -} -func (_ fastpathT) EncMapInt32Int8V(v map[int32]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32Int16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32Int16V(rv2i(rv).(map[int32]int16), e) -} -func (_ fastpathT) EncMapInt32Int16V(v map[int32]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32Int32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32Int32V(rv2i(rv).(map[int32]int32), e) -} -func (_ fastpathT) EncMapInt32Int32V(v map[int32]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32Int64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32Int64V(rv2i(rv).(map[int32]int64), e) -} -func (_ fastpathT) EncMapInt32Int64V(v map[int32]int64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int32(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32Float32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32Float32V(rv2i(rv).(map[int32]float32), e) -} -func (_ fastpathT) EncMapInt32Float32V(v map[int32]float32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[int32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32Float64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32Float64V(rv2i(rv).(map[int32]float64), e) -} -func (_ fastpathT) EncMapInt32Float64V(v map[int32]float64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[int32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt32BoolR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt32BoolV(rv2i(rv).(map[int32]bool), e) -} -func (_ fastpathT) EncMapInt32BoolV(v map[int32]bool, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int32(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[int32(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapInt64IntfR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapInt64IntfV(rv2i(rv).(map[int64]interface{}), e) } -func (_ fastpathT) EncMapInt64IntfV(v map[int64]interface{}, e *Encoder) { +func (fastpathT) EncMapInt64IntfV(v map[int64]interface{}, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[int64(k2)]) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.encode(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() e.encode(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapInt64StringR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapInt64StringV(rv2i(rv).(map[int64]string), e) } -func (_ fastpathT) EncMapInt64StringV(v map[int64]string, e *Encoder) { +func (fastpathT) EncMapInt64StringV(v map[int64]string, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[int64(k2)])) + e.e.EncodeStringBytesRaw(bytesView(v[k2])) } else { - ee.EncodeStringEnc(cUTF8, v[int64(k2)]) + e.e.EncodeStringEnc(cUTF8, v[k2]) } } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) + e.e.EncodeStringBytesRaw(bytesView(v2)) } else { - ee.EncodeStringEnc(cUTF8, v2) + e.e.EncodeStringEnc(cUTF8, v2) } } } - ee.WriteMapEnd() + e.mapEnd() +} + +func (e *Encoder) fastpathEncMapInt64BytesR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64BytesV(rv2i(rv).(map[int64][]byte), e) +} +func (fastpathT) EncMapInt64BytesV(v map[int64][]byte, e *Encoder) { + if v == nil { + e.e.EncodeNil() + return + } + e.mapStart(len(v)) + if e.h.Canonical { + v2 := make([]int64, len(v)) + var i uint + for k := range v { + v2[i] = k + i++ + } + sort.Sort(int64Slice(v2)) + for _, k2 := range v2 { + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeStringBytesRaw(v[k2]) + } + } else { + for k2, v2 := range v { + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeStringBytesRaw(v2) + } + } + e.mapEnd() } func (e *Encoder) fastpathEncMapInt64UintR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapInt64UintV(rv2i(rv).(map[int64]uint), e) } -func (_ fastpathT) EncMapInt64UintV(v map[int64]uint, e *Encoder) { +func (fastpathT) EncMapInt64UintV(v map[int64]uint, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int64(k2)])) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeUint(uint64(v[k2])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeUint(uint64(v2)) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapInt64Uint8R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapInt64Uint8V(rv2i(rv).(map[int64]uint8), e) } -func (_ fastpathT) EncMapInt64Uint8V(v map[int64]uint8, e *Encoder) { +func (fastpathT) EncMapInt64Uint8V(v map[int64]uint8, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int64(k2)])) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeUint(uint64(v[k2])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeUint(uint64(v2)) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt64Uint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt64Uint16V(rv2i(rv).(map[int64]uint16), e) -} -func (_ fastpathT) EncMapInt64Uint16V(v map[int64]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt64Uint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt64Uint32V(rv2i(rv).(map[int64]uint32), e) -} -func (_ fastpathT) EncMapInt64Uint32V(v map[int64]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapInt64Uint64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapInt64Uint64V(rv2i(rv).(map[int64]uint64), e) } -func (_ fastpathT) EncMapInt64Uint64V(v map[int64]uint64, e *Encoder) { +func (fastpathT) EncMapInt64Uint64V(v map[int64]uint64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[int64(k2)])) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeUint(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeUint(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapInt64UintptrR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapInt64UintptrV(rv2i(rv).(map[int64]uintptr), e) } -func (_ fastpathT) EncMapInt64UintptrV(v map[int64]uintptr, e *Encoder) { +func (fastpathT) EncMapInt64UintptrV(v map[int64]uintptr, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[int64(k2)]) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.encode(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() e.encode(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapInt64IntR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapInt64IntV(rv2i(rv).(map[int64]int), e) } -func (_ fastpathT) EncMapInt64IntV(v map[int64]int, e *Encoder) { +func (fastpathT) EncMapInt64IntV(v map[int64]int, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int64(k2)])) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeInt(int64(v[k2])) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeInt(int64(v2)) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt64Int8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt64Int8V(rv2i(rv).(map[int64]int8), e) -} -func (_ fastpathT) EncMapInt64Int8V(v map[int64]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt64Int16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt64Int16V(rv2i(rv).(map[int64]int16), e) -} -func (_ fastpathT) EncMapInt64Int16V(v map[int64]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapInt64Int32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt64Int32V(rv2i(rv).(map[int64]int32), e) -} -func (_ fastpathT) EncMapInt64Int32V(v map[int64]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int64(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapInt64Int64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapInt64Int64V(rv2i(rv).(map[int64]int64), e) } -func (_ fastpathT) EncMapInt64Int64V(v map[int64]int64, e *Encoder) { +func (fastpathT) EncMapInt64Int64V(v map[int64]int64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[int64(k2)])) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeInt(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeInt(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapInt64Float32R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapInt64Float32V(rv2i(rv).(map[int64]float32), e) } -func (_ fastpathT) EncMapInt64Float32V(v map[int64]float32, e *Encoder) { +func (fastpathT) EncMapInt64Float32V(v map[int64]float32, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[int64(k2)]) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeFloat32(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeFloat32(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapInt64Float64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapInt64Float64V(rv2i(rv).(map[int64]float64), e) } -func (_ fastpathT) EncMapInt64Float64V(v map[int64]float64, e *Encoder) { +func (fastpathT) EncMapInt64Float64V(v map[int64]float64, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[int64(k2)]) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeFloat64(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeFloat64(v2) } } - ee.WriteMapEnd() + e.mapEnd() } func (e *Encoder) fastpathEncMapInt64BoolR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapInt64BoolV(rv2i(rv).(map[int64]bool), e) } -func (_ fastpathT) EncMapInt64BoolV(v map[int64]bool, e *Encoder) { +func (fastpathT) EncMapInt64BoolV(v map[int64]bool, e *Encoder) { if v == nil { e.e.EncodeNil() return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) + e.mapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(intSlice(v2)) + sort.Sort(int64Slice(v2)) for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(int64(k2))) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[int64(k2)]) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeBool(v[k2]) } } else { for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeInt(int64(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) + e.mapElemKey() + e.e.EncodeInt(k2) + e.mapElemValue() + e.e.EncodeBool(v2) } } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolIntfR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolIntfV(rv2i(rv).(map[bool]interface{}), e) -} -func (_ fastpathT) EncMapBoolIntfV(v map[bool]interface{}, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[bool(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolStringR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolStringV(rv2i(rv).(map[bool]string), e) -} -func (_ fastpathT) EncMapBoolStringV(v map[bool]string, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v[bool(k2)])) - } else { - ee.EncodeStringEnc(cUTF8, v[bool(k2)]) - } - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - if e.h.StringToRaw { - ee.EncodeStringBytesRaw(bytesView(v2)) - } else { - ee.EncodeStringEnc(cUTF8, v2) - } - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolUintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolUintV(rv2i(rv).(map[bool]uint), e) -} -func (_ fastpathT) EncMapBoolUintV(v map[bool]uint, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[bool(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolUint8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolUint8V(rv2i(rv).(map[bool]uint8), e) -} -func (_ fastpathT) EncMapBoolUint8V(v map[bool]uint8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[bool(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolUint16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolUint16V(rv2i(rv).(map[bool]uint16), e) -} -func (_ fastpathT) EncMapBoolUint16V(v map[bool]uint16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[bool(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolUint32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolUint32V(rv2i(rv).(map[bool]uint32), e) -} -func (_ fastpathT) EncMapBoolUint32V(v map[bool]uint32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[bool(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolUint64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolUint64V(rv2i(rv).(map[bool]uint64), e) -} -func (_ fastpathT) EncMapBoolUint64V(v map[bool]uint64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v[bool(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolUintptrR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolUintptrV(rv2i(rv).(map[bool]uintptr), e) -} -func (_ fastpathT) EncMapBoolUintptrV(v map[bool]uintptr, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - e.encode(v[bool(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - e.encode(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolIntR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolIntV(rv2i(rv).(map[bool]int), e) -} -func (_ fastpathT) EncMapBoolIntV(v map[bool]int, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[bool(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolInt8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolInt8V(rv2i(rv).(map[bool]int8), e) -} -func (_ fastpathT) EncMapBoolInt8V(v map[bool]int8, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[bool(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolInt16R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolInt16V(rv2i(rv).(map[bool]int16), e) -} -func (_ fastpathT) EncMapBoolInt16V(v map[bool]int16, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[bool(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolInt32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolInt32V(rv2i(rv).(map[bool]int32), e) -} -func (_ fastpathT) EncMapBoolInt32V(v map[bool]int32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[bool(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolInt64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolInt64V(rv2i(rv).(map[bool]int64), e) -} -func (_ fastpathT) EncMapBoolInt64V(v map[bool]int64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v[bool(k2)])) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeInt(int64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolFloat32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolFloat32V(rv2i(rv).(map[bool]float32), e) -} -func (_ fastpathT) EncMapBoolFloat32V(v map[bool]float32, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v[bool(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat32(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolFloat64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolFloat64V(rv2i(rv).(map[bool]float64), e) -} -func (_ fastpathT) EncMapBoolFloat64V(v map[bool]float64, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v[bool(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeFloat64(v2) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncMapBoolBoolR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapBoolBoolV(rv2i(rv).(map[bool]bool), e) -} -func (_ fastpathT) EncMapBoolBoolV(v map[bool]bool, e *Encoder) { - if v == nil { - e.e.EncodeNil() - return - } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - v2 := make([]bool, len(v)) - var i uint - for k := range v { - v2[i] = bool(k) - i++ - } - sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(bool(k2)) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v[bool(k2)]) - } - } else { - for k2, v2 := range v { - if esep { - ee.WriteMapElemKey() - } - ee.EncodeBool(k2) - if esep { - ee.WriteMapElemValue() - } - ee.EncodeBool(v2) - } - } - ee.WriteMapEnd() + e.mapEnd() } // -- decode @@ -13554,6 +3834,18 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } + case [][]byte: + var v2 [][]byte + v2, changed = fastpathTV.DecSliceBytesV(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[][]byte: + var v2 [][]byte + v2, changed = fastpathTV.DecSliceBytesV(*v, true, d) + if changed { + *v = v2 + } case []float32: var v2 []float32 v2, changed = fastpathTV.DecSliceFloat32V(v, false, d) @@ -13711,134 +4003,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { *v = v2 } - case map[interface{}]interface{}: - fastpathTV.DecMapIntfIntfV(v, false, d) - case *map[interface{}]interface{}: - var v2 map[interface{}]interface{} - v2, changed = fastpathTV.DecMapIntfIntfV(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]string: - fastpathTV.DecMapIntfStringV(v, false, d) - case *map[interface{}]string: - var v2 map[interface{}]string - v2, changed = fastpathTV.DecMapIntfStringV(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]uint: - fastpathTV.DecMapIntfUintV(v, false, d) - case *map[interface{}]uint: - var v2 map[interface{}]uint - v2, changed = fastpathTV.DecMapIntfUintV(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]uint8: - fastpathTV.DecMapIntfUint8V(v, false, d) - case *map[interface{}]uint8: - var v2 map[interface{}]uint8 - v2, changed = fastpathTV.DecMapIntfUint8V(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]uint16: - fastpathTV.DecMapIntfUint16V(v, false, d) - case *map[interface{}]uint16: - var v2 map[interface{}]uint16 - v2, changed = fastpathTV.DecMapIntfUint16V(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]uint32: - fastpathTV.DecMapIntfUint32V(v, false, d) - case *map[interface{}]uint32: - var v2 map[interface{}]uint32 - v2, changed = fastpathTV.DecMapIntfUint32V(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]uint64: - fastpathTV.DecMapIntfUint64V(v, false, d) - case *map[interface{}]uint64: - var v2 map[interface{}]uint64 - v2, changed = fastpathTV.DecMapIntfUint64V(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]uintptr: - fastpathTV.DecMapIntfUintptrV(v, false, d) - case *map[interface{}]uintptr: - var v2 map[interface{}]uintptr - v2, changed = fastpathTV.DecMapIntfUintptrV(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]int: - fastpathTV.DecMapIntfIntV(v, false, d) - case *map[interface{}]int: - var v2 map[interface{}]int - v2, changed = fastpathTV.DecMapIntfIntV(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]int8: - fastpathTV.DecMapIntfInt8V(v, false, d) - case *map[interface{}]int8: - var v2 map[interface{}]int8 - v2, changed = fastpathTV.DecMapIntfInt8V(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]int16: - fastpathTV.DecMapIntfInt16V(v, false, d) - case *map[interface{}]int16: - var v2 map[interface{}]int16 - v2, changed = fastpathTV.DecMapIntfInt16V(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]int32: - fastpathTV.DecMapIntfInt32V(v, false, d) - case *map[interface{}]int32: - var v2 map[interface{}]int32 - v2, changed = fastpathTV.DecMapIntfInt32V(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]int64: - fastpathTV.DecMapIntfInt64V(v, false, d) - case *map[interface{}]int64: - var v2 map[interface{}]int64 - v2, changed = fastpathTV.DecMapIntfInt64V(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]float32: - fastpathTV.DecMapIntfFloat32V(v, false, d) - case *map[interface{}]float32: - var v2 map[interface{}]float32 - v2, changed = fastpathTV.DecMapIntfFloat32V(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]float64: - fastpathTV.DecMapIntfFloat64V(v, false, d) - case *map[interface{}]float64: - var v2 map[interface{}]float64 - v2, changed = fastpathTV.DecMapIntfFloat64V(*v, true, d) - if changed { - *v = v2 - } - case map[interface{}]bool: - fastpathTV.DecMapIntfBoolV(v, false, d) - case *map[interface{}]bool: - var v2 map[interface{}]bool - v2, changed = fastpathTV.DecMapIntfBoolV(*v, true, d) - if changed { - *v = v2 - } case map[string]interface{}: fastpathTV.DecMapStringIntfV(v, false, d) case *map[string]interface{}: @@ -13855,6 +4019,14 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } + case map[string][]byte: + fastpathTV.DecMapStringBytesV(v, false, d) + case *map[string][]byte: + var v2 map[string][]byte + v2, changed = fastpathTV.DecMapStringBytesV(*v, true, d) + if changed { + *v = v2 + } case map[string]uint: fastpathTV.DecMapStringUintV(v, false, d) case *map[string]uint: @@ -13871,22 +4043,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[string]uint16: - fastpathTV.DecMapStringUint16V(v, false, d) - case *map[string]uint16: - var v2 map[string]uint16 - v2, changed = fastpathTV.DecMapStringUint16V(*v, true, d) - if changed { - *v = v2 - } - case map[string]uint32: - fastpathTV.DecMapStringUint32V(v, false, d) - case *map[string]uint32: - var v2 map[string]uint32 - v2, changed = fastpathTV.DecMapStringUint32V(*v, true, d) - if changed { - *v = v2 - } case map[string]uint64: fastpathTV.DecMapStringUint64V(v, false, d) case *map[string]uint64: @@ -13911,30 +4067,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[string]int8: - fastpathTV.DecMapStringInt8V(v, false, d) - case *map[string]int8: - var v2 map[string]int8 - v2, changed = fastpathTV.DecMapStringInt8V(*v, true, d) - if changed { - *v = v2 - } - case map[string]int16: - fastpathTV.DecMapStringInt16V(v, false, d) - case *map[string]int16: - var v2 map[string]int16 - v2, changed = fastpathTV.DecMapStringInt16V(*v, true, d) - if changed { - *v = v2 - } - case map[string]int32: - fastpathTV.DecMapStringInt32V(v, false, d) - case *map[string]int32: - var v2 map[string]int32 - v2, changed = fastpathTV.DecMapStringInt32V(*v, true, d) - if changed { - *v = v2 - } case map[string]int64: fastpathTV.DecMapStringInt64V(v, false, d) case *map[string]int64: @@ -13967,262 +4099,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[float32]interface{}: - fastpathTV.DecMapFloat32IntfV(v, false, d) - case *map[float32]interface{}: - var v2 map[float32]interface{} - v2, changed = fastpathTV.DecMapFloat32IntfV(*v, true, d) - if changed { - *v = v2 - } - case map[float32]string: - fastpathTV.DecMapFloat32StringV(v, false, d) - case *map[float32]string: - var v2 map[float32]string - v2, changed = fastpathTV.DecMapFloat32StringV(*v, true, d) - if changed { - *v = v2 - } - case map[float32]uint: - fastpathTV.DecMapFloat32UintV(v, false, d) - case *map[float32]uint: - var v2 map[float32]uint - v2, changed = fastpathTV.DecMapFloat32UintV(*v, true, d) - if changed { - *v = v2 - } - case map[float32]uint8: - fastpathTV.DecMapFloat32Uint8V(v, false, d) - case *map[float32]uint8: - var v2 map[float32]uint8 - v2, changed = fastpathTV.DecMapFloat32Uint8V(*v, true, d) - if changed { - *v = v2 - } - case map[float32]uint16: - fastpathTV.DecMapFloat32Uint16V(v, false, d) - case *map[float32]uint16: - var v2 map[float32]uint16 - v2, changed = fastpathTV.DecMapFloat32Uint16V(*v, true, d) - if changed { - *v = v2 - } - case map[float32]uint32: - fastpathTV.DecMapFloat32Uint32V(v, false, d) - case *map[float32]uint32: - var v2 map[float32]uint32 - v2, changed = fastpathTV.DecMapFloat32Uint32V(*v, true, d) - if changed { - *v = v2 - } - case map[float32]uint64: - fastpathTV.DecMapFloat32Uint64V(v, false, d) - case *map[float32]uint64: - var v2 map[float32]uint64 - v2, changed = fastpathTV.DecMapFloat32Uint64V(*v, true, d) - if changed { - *v = v2 - } - case map[float32]uintptr: - fastpathTV.DecMapFloat32UintptrV(v, false, d) - case *map[float32]uintptr: - var v2 map[float32]uintptr - v2, changed = fastpathTV.DecMapFloat32UintptrV(*v, true, d) - if changed { - *v = v2 - } - case map[float32]int: - fastpathTV.DecMapFloat32IntV(v, false, d) - case *map[float32]int: - var v2 map[float32]int - v2, changed = fastpathTV.DecMapFloat32IntV(*v, true, d) - if changed { - *v = v2 - } - case map[float32]int8: - fastpathTV.DecMapFloat32Int8V(v, false, d) - case *map[float32]int8: - var v2 map[float32]int8 - v2, changed = fastpathTV.DecMapFloat32Int8V(*v, true, d) - if changed { - *v = v2 - } - case map[float32]int16: - fastpathTV.DecMapFloat32Int16V(v, false, d) - case *map[float32]int16: - var v2 map[float32]int16 - v2, changed = fastpathTV.DecMapFloat32Int16V(*v, true, d) - if changed { - *v = v2 - } - case map[float32]int32: - fastpathTV.DecMapFloat32Int32V(v, false, d) - case *map[float32]int32: - var v2 map[float32]int32 - v2, changed = fastpathTV.DecMapFloat32Int32V(*v, true, d) - if changed { - *v = v2 - } - case map[float32]int64: - fastpathTV.DecMapFloat32Int64V(v, false, d) - case *map[float32]int64: - var v2 map[float32]int64 - v2, changed = fastpathTV.DecMapFloat32Int64V(*v, true, d) - if changed { - *v = v2 - } - case map[float32]float32: - fastpathTV.DecMapFloat32Float32V(v, false, d) - case *map[float32]float32: - var v2 map[float32]float32 - v2, changed = fastpathTV.DecMapFloat32Float32V(*v, true, d) - if changed { - *v = v2 - } - case map[float32]float64: - fastpathTV.DecMapFloat32Float64V(v, false, d) - case *map[float32]float64: - var v2 map[float32]float64 - v2, changed = fastpathTV.DecMapFloat32Float64V(*v, true, d) - if changed { - *v = v2 - } - case map[float32]bool: - fastpathTV.DecMapFloat32BoolV(v, false, d) - case *map[float32]bool: - var v2 map[float32]bool - v2, changed = fastpathTV.DecMapFloat32BoolV(*v, true, d) - if changed { - *v = v2 - } - case map[float64]interface{}: - fastpathTV.DecMapFloat64IntfV(v, false, d) - case *map[float64]interface{}: - var v2 map[float64]interface{} - v2, changed = fastpathTV.DecMapFloat64IntfV(*v, true, d) - if changed { - *v = v2 - } - case map[float64]string: - fastpathTV.DecMapFloat64StringV(v, false, d) - case *map[float64]string: - var v2 map[float64]string - v2, changed = fastpathTV.DecMapFloat64StringV(*v, true, d) - if changed { - *v = v2 - } - case map[float64]uint: - fastpathTV.DecMapFloat64UintV(v, false, d) - case *map[float64]uint: - var v2 map[float64]uint - v2, changed = fastpathTV.DecMapFloat64UintV(*v, true, d) - if changed { - *v = v2 - } - case map[float64]uint8: - fastpathTV.DecMapFloat64Uint8V(v, false, d) - case *map[float64]uint8: - var v2 map[float64]uint8 - v2, changed = fastpathTV.DecMapFloat64Uint8V(*v, true, d) - if changed { - *v = v2 - } - case map[float64]uint16: - fastpathTV.DecMapFloat64Uint16V(v, false, d) - case *map[float64]uint16: - var v2 map[float64]uint16 - v2, changed = fastpathTV.DecMapFloat64Uint16V(*v, true, d) - if changed { - *v = v2 - } - case map[float64]uint32: - fastpathTV.DecMapFloat64Uint32V(v, false, d) - case *map[float64]uint32: - var v2 map[float64]uint32 - v2, changed = fastpathTV.DecMapFloat64Uint32V(*v, true, d) - if changed { - *v = v2 - } - case map[float64]uint64: - fastpathTV.DecMapFloat64Uint64V(v, false, d) - case *map[float64]uint64: - var v2 map[float64]uint64 - v2, changed = fastpathTV.DecMapFloat64Uint64V(*v, true, d) - if changed { - *v = v2 - } - case map[float64]uintptr: - fastpathTV.DecMapFloat64UintptrV(v, false, d) - case *map[float64]uintptr: - var v2 map[float64]uintptr - v2, changed = fastpathTV.DecMapFloat64UintptrV(*v, true, d) - if changed { - *v = v2 - } - case map[float64]int: - fastpathTV.DecMapFloat64IntV(v, false, d) - case *map[float64]int: - var v2 map[float64]int - v2, changed = fastpathTV.DecMapFloat64IntV(*v, true, d) - if changed { - *v = v2 - } - case map[float64]int8: - fastpathTV.DecMapFloat64Int8V(v, false, d) - case *map[float64]int8: - var v2 map[float64]int8 - v2, changed = fastpathTV.DecMapFloat64Int8V(*v, true, d) - if changed { - *v = v2 - } - case map[float64]int16: - fastpathTV.DecMapFloat64Int16V(v, false, d) - case *map[float64]int16: - var v2 map[float64]int16 - v2, changed = fastpathTV.DecMapFloat64Int16V(*v, true, d) - if changed { - *v = v2 - } - case map[float64]int32: - fastpathTV.DecMapFloat64Int32V(v, false, d) - case *map[float64]int32: - var v2 map[float64]int32 - v2, changed = fastpathTV.DecMapFloat64Int32V(*v, true, d) - if changed { - *v = v2 - } - case map[float64]int64: - fastpathTV.DecMapFloat64Int64V(v, false, d) - case *map[float64]int64: - var v2 map[float64]int64 - v2, changed = fastpathTV.DecMapFloat64Int64V(*v, true, d) - if changed { - *v = v2 - } - case map[float64]float32: - fastpathTV.DecMapFloat64Float32V(v, false, d) - case *map[float64]float32: - var v2 map[float64]float32 - v2, changed = fastpathTV.DecMapFloat64Float32V(*v, true, d) - if changed { - *v = v2 - } - case map[float64]float64: - fastpathTV.DecMapFloat64Float64V(v, false, d) - case *map[float64]float64: - var v2 map[float64]float64 - v2, changed = fastpathTV.DecMapFloat64Float64V(*v, true, d) - if changed { - *v = v2 - } - case map[float64]bool: - fastpathTV.DecMapFloat64BoolV(v, false, d) - case *map[float64]bool: - var v2 map[float64]bool - v2, changed = fastpathTV.DecMapFloat64BoolV(*v, true, d) - if changed { - *v = v2 - } case map[uint]interface{}: fastpathTV.DecMapUintIntfV(v, false, d) case *map[uint]interface{}: @@ -14239,6 +4115,14 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } + case map[uint][]byte: + fastpathTV.DecMapUintBytesV(v, false, d) + case *map[uint][]byte: + var v2 map[uint][]byte + v2, changed = fastpathTV.DecMapUintBytesV(*v, true, d) + if changed { + *v = v2 + } case map[uint]uint: fastpathTV.DecMapUintUintV(v, false, d) case *map[uint]uint: @@ -14255,22 +4139,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[uint]uint16: - fastpathTV.DecMapUintUint16V(v, false, d) - case *map[uint]uint16: - var v2 map[uint]uint16 - v2, changed = fastpathTV.DecMapUintUint16V(*v, true, d) - if changed { - *v = v2 - } - case map[uint]uint32: - fastpathTV.DecMapUintUint32V(v, false, d) - case *map[uint]uint32: - var v2 map[uint]uint32 - v2, changed = fastpathTV.DecMapUintUint32V(*v, true, d) - if changed { - *v = v2 - } case map[uint]uint64: fastpathTV.DecMapUintUint64V(v, false, d) case *map[uint]uint64: @@ -14295,30 +4163,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[uint]int8: - fastpathTV.DecMapUintInt8V(v, false, d) - case *map[uint]int8: - var v2 map[uint]int8 - v2, changed = fastpathTV.DecMapUintInt8V(*v, true, d) - if changed { - *v = v2 - } - case map[uint]int16: - fastpathTV.DecMapUintInt16V(v, false, d) - case *map[uint]int16: - var v2 map[uint]int16 - v2, changed = fastpathTV.DecMapUintInt16V(*v, true, d) - if changed { - *v = v2 - } - case map[uint]int32: - fastpathTV.DecMapUintInt32V(v, false, d) - case *map[uint]int32: - var v2 map[uint]int32 - v2, changed = fastpathTV.DecMapUintInt32V(*v, true, d) - if changed { - *v = v2 - } case map[uint]int64: fastpathTV.DecMapUintInt64V(v, false, d) case *map[uint]int64: @@ -14367,6 +4211,14 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } + case map[uint8][]byte: + fastpathTV.DecMapUint8BytesV(v, false, d) + case *map[uint8][]byte: + var v2 map[uint8][]byte + v2, changed = fastpathTV.DecMapUint8BytesV(*v, true, d) + if changed { + *v = v2 + } case map[uint8]uint: fastpathTV.DecMapUint8UintV(v, false, d) case *map[uint8]uint: @@ -14383,22 +4235,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[uint8]uint16: - fastpathTV.DecMapUint8Uint16V(v, false, d) - case *map[uint8]uint16: - var v2 map[uint8]uint16 - v2, changed = fastpathTV.DecMapUint8Uint16V(*v, true, d) - if changed { - *v = v2 - } - case map[uint8]uint32: - fastpathTV.DecMapUint8Uint32V(v, false, d) - case *map[uint8]uint32: - var v2 map[uint8]uint32 - v2, changed = fastpathTV.DecMapUint8Uint32V(*v, true, d) - if changed { - *v = v2 - } case map[uint8]uint64: fastpathTV.DecMapUint8Uint64V(v, false, d) case *map[uint8]uint64: @@ -14423,30 +4259,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[uint8]int8: - fastpathTV.DecMapUint8Int8V(v, false, d) - case *map[uint8]int8: - var v2 map[uint8]int8 - v2, changed = fastpathTV.DecMapUint8Int8V(*v, true, d) - if changed { - *v = v2 - } - case map[uint8]int16: - fastpathTV.DecMapUint8Int16V(v, false, d) - case *map[uint8]int16: - var v2 map[uint8]int16 - v2, changed = fastpathTV.DecMapUint8Int16V(*v, true, d) - if changed { - *v = v2 - } - case map[uint8]int32: - fastpathTV.DecMapUint8Int32V(v, false, d) - case *map[uint8]int32: - var v2 map[uint8]int32 - v2, changed = fastpathTV.DecMapUint8Int32V(*v, true, d) - if changed { - *v = v2 - } case map[uint8]int64: fastpathTV.DecMapUint8Int64V(v, false, d) case *map[uint8]int64: @@ -14479,262 +4291,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[uint16]interface{}: - fastpathTV.DecMapUint16IntfV(v, false, d) - case *map[uint16]interface{}: - var v2 map[uint16]interface{} - v2, changed = fastpathTV.DecMapUint16IntfV(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]string: - fastpathTV.DecMapUint16StringV(v, false, d) - case *map[uint16]string: - var v2 map[uint16]string - v2, changed = fastpathTV.DecMapUint16StringV(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]uint: - fastpathTV.DecMapUint16UintV(v, false, d) - case *map[uint16]uint: - var v2 map[uint16]uint - v2, changed = fastpathTV.DecMapUint16UintV(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]uint8: - fastpathTV.DecMapUint16Uint8V(v, false, d) - case *map[uint16]uint8: - var v2 map[uint16]uint8 - v2, changed = fastpathTV.DecMapUint16Uint8V(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]uint16: - fastpathTV.DecMapUint16Uint16V(v, false, d) - case *map[uint16]uint16: - var v2 map[uint16]uint16 - v2, changed = fastpathTV.DecMapUint16Uint16V(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]uint32: - fastpathTV.DecMapUint16Uint32V(v, false, d) - case *map[uint16]uint32: - var v2 map[uint16]uint32 - v2, changed = fastpathTV.DecMapUint16Uint32V(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]uint64: - fastpathTV.DecMapUint16Uint64V(v, false, d) - case *map[uint16]uint64: - var v2 map[uint16]uint64 - v2, changed = fastpathTV.DecMapUint16Uint64V(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]uintptr: - fastpathTV.DecMapUint16UintptrV(v, false, d) - case *map[uint16]uintptr: - var v2 map[uint16]uintptr - v2, changed = fastpathTV.DecMapUint16UintptrV(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]int: - fastpathTV.DecMapUint16IntV(v, false, d) - case *map[uint16]int: - var v2 map[uint16]int - v2, changed = fastpathTV.DecMapUint16IntV(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]int8: - fastpathTV.DecMapUint16Int8V(v, false, d) - case *map[uint16]int8: - var v2 map[uint16]int8 - v2, changed = fastpathTV.DecMapUint16Int8V(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]int16: - fastpathTV.DecMapUint16Int16V(v, false, d) - case *map[uint16]int16: - var v2 map[uint16]int16 - v2, changed = fastpathTV.DecMapUint16Int16V(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]int32: - fastpathTV.DecMapUint16Int32V(v, false, d) - case *map[uint16]int32: - var v2 map[uint16]int32 - v2, changed = fastpathTV.DecMapUint16Int32V(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]int64: - fastpathTV.DecMapUint16Int64V(v, false, d) - case *map[uint16]int64: - var v2 map[uint16]int64 - v2, changed = fastpathTV.DecMapUint16Int64V(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]float32: - fastpathTV.DecMapUint16Float32V(v, false, d) - case *map[uint16]float32: - var v2 map[uint16]float32 - v2, changed = fastpathTV.DecMapUint16Float32V(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]float64: - fastpathTV.DecMapUint16Float64V(v, false, d) - case *map[uint16]float64: - var v2 map[uint16]float64 - v2, changed = fastpathTV.DecMapUint16Float64V(*v, true, d) - if changed { - *v = v2 - } - case map[uint16]bool: - fastpathTV.DecMapUint16BoolV(v, false, d) - case *map[uint16]bool: - var v2 map[uint16]bool - v2, changed = fastpathTV.DecMapUint16BoolV(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]interface{}: - fastpathTV.DecMapUint32IntfV(v, false, d) - case *map[uint32]interface{}: - var v2 map[uint32]interface{} - v2, changed = fastpathTV.DecMapUint32IntfV(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]string: - fastpathTV.DecMapUint32StringV(v, false, d) - case *map[uint32]string: - var v2 map[uint32]string - v2, changed = fastpathTV.DecMapUint32StringV(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]uint: - fastpathTV.DecMapUint32UintV(v, false, d) - case *map[uint32]uint: - var v2 map[uint32]uint - v2, changed = fastpathTV.DecMapUint32UintV(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]uint8: - fastpathTV.DecMapUint32Uint8V(v, false, d) - case *map[uint32]uint8: - var v2 map[uint32]uint8 - v2, changed = fastpathTV.DecMapUint32Uint8V(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]uint16: - fastpathTV.DecMapUint32Uint16V(v, false, d) - case *map[uint32]uint16: - var v2 map[uint32]uint16 - v2, changed = fastpathTV.DecMapUint32Uint16V(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]uint32: - fastpathTV.DecMapUint32Uint32V(v, false, d) - case *map[uint32]uint32: - var v2 map[uint32]uint32 - v2, changed = fastpathTV.DecMapUint32Uint32V(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]uint64: - fastpathTV.DecMapUint32Uint64V(v, false, d) - case *map[uint32]uint64: - var v2 map[uint32]uint64 - v2, changed = fastpathTV.DecMapUint32Uint64V(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]uintptr: - fastpathTV.DecMapUint32UintptrV(v, false, d) - case *map[uint32]uintptr: - var v2 map[uint32]uintptr - v2, changed = fastpathTV.DecMapUint32UintptrV(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]int: - fastpathTV.DecMapUint32IntV(v, false, d) - case *map[uint32]int: - var v2 map[uint32]int - v2, changed = fastpathTV.DecMapUint32IntV(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]int8: - fastpathTV.DecMapUint32Int8V(v, false, d) - case *map[uint32]int8: - var v2 map[uint32]int8 - v2, changed = fastpathTV.DecMapUint32Int8V(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]int16: - fastpathTV.DecMapUint32Int16V(v, false, d) - case *map[uint32]int16: - var v2 map[uint32]int16 - v2, changed = fastpathTV.DecMapUint32Int16V(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]int32: - fastpathTV.DecMapUint32Int32V(v, false, d) - case *map[uint32]int32: - var v2 map[uint32]int32 - v2, changed = fastpathTV.DecMapUint32Int32V(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]int64: - fastpathTV.DecMapUint32Int64V(v, false, d) - case *map[uint32]int64: - var v2 map[uint32]int64 - v2, changed = fastpathTV.DecMapUint32Int64V(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]float32: - fastpathTV.DecMapUint32Float32V(v, false, d) - case *map[uint32]float32: - var v2 map[uint32]float32 - v2, changed = fastpathTV.DecMapUint32Float32V(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]float64: - fastpathTV.DecMapUint32Float64V(v, false, d) - case *map[uint32]float64: - var v2 map[uint32]float64 - v2, changed = fastpathTV.DecMapUint32Float64V(*v, true, d) - if changed { - *v = v2 - } - case map[uint32]bool: - fastpathTV.DecMapUint32BoolV(v, false, d) - case *map[uint32]bool: - var v2 map[uint32]bool - v2, changed = fastpathTV.DecMapUint32BoolV(*v, true, d) - if changed { - *v = v2 - } case map[uint64]interface{}: fastpathTV.DecMapUint64IntfV(v, false, d) case *map[uint64]interface{}: @@ -14751,6 +4307,14 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } + case map[uint64][]byte: + fastpathTV.DecMapUint64BytesV(v, false, d) + case *map[uint64][]byte: + var v2 map[uint64][]byte + v2, changed = fastpathTV.DecMapUint64BytesV(*v, true, d) + if changed { + *v = v2 + } case map[uint64]uint: fastpathTV.DecMapUint64UintV(v, false, d) case *map[uint64]uint: @@ -14767,22 +4331,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[uint64]uint16: - fastpathTV.DecMapUint64Uint16V(v, false, d) - case *map[uint64]uint16: - var v2 map[uint64]uint16 - v2, changed = fastpathTV.DecMapUint64Uint16V(*v, true, d) - if changed { - *v = v2 - } - case map[uint64]uint32: - fastpathTV.DecMapUint64Uint32V(v, false, d) - case *map[uint64]uint32: - var v2 map[uint64]uint32 - v2, changed = fastpathTV.DecMapUint64Uint32V(*v, true, d) - if changed { - *v = v2 - } case map[uint64]uint64: fastpathTV.DecMapUint64Uint64V(v, false, d) case *map[uint64]uint64: @@ -14807,30 +4355,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[uint64]int8: - fastpathTV.DecMapUint64Int8V(v, false, d) - case *map[uint64]int8: - var v2 map[uint64]int8 - v2, changed = fastpathTV.DecMapUint64Int8V(*v, true, d) - if changed { - *v = v2 - } - case map[uint64]int16: - fastpathTV.DecMapUint64Int16V(v, false, d) - case *map[uint64]int16: - var v2 map[uint64]int16 - v2, changed = fastpathTV.DecMapUint64Int16V(*v, true, d) - if changed { - *v = v2 - } - case map[uint64]int32: - fastpathTV.DecMapUint64Int32V(v, false, d) - case *map[uint64]int32: - var v2 map[uint64]int32 - v2, changed = fastpathTV.DecMapUint64Int32V(*v, true, d) - if changed { - *v = v2 - } case map[uint64]int64: fastpathTV.DecMapUint64Int64V(v, false, d) case *map[uint64]int64: @@ -14863,134 +4387,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[uintptr]interface{}: - fastpathTV.DecMapUintptrIntfV(v, false, d) - case *map[uintptr]interface{}: - var v2 map[uintptr]interface{} - v2, changed = fastpathTV.DecMapUintptrIntfV(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]string: - fastpathTV.DecMapUintptrStringV(v, false, d) - case *map[uintptr]string: - var v2 map[uintptr]string - v2, changed = fastpathTV.DecMapUintptrStringV(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]uint: - fastpathTV.DecMapUintptrUintV(v, false, d) - case *map[uintptr]uint: - var v2 map[uintptr]uint - v2, changed = fastpathTV.DecMapUintptrUintV(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]uint8: - fastpathTV.DecMapUintptrUint8V(v, false, d) - case *map[uintptr]uint8: - var v2 map[uintptr]uint8 - v2, changed = fastpathTV.DecMapUintptrUint8V(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]uint16: - fastpathTV.DecMapUintptrUint16V(v, false, d) - case *map[uintptr]uint16: - var v2 map[uintptr]uint16 - v2, changed = fastpathTV.DecMapUintptrUint16V(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]uint32: - fastpathTV.DecMapUintptrUint32V(v, false, d) - case *map[uintptr]uint32: - var v2 map[uintptr]uint32 - v2, changed = fastpathTV.DecMapUintptrUint32V(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]uint64: - fastpathTV.DecMapUintptrUint64V(v, false, d) - case *map[uintptr]uint64: - var v2 map[uintptr]uint64 - v2, changed = fastpathTV.DecMapUintptrUint64V(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]uintptr: - fastpathTV.DecMapUintptrUintptrV(v, false, d) - case *map[uintptr]uintptr: - var v2 map[uintptr]uintptr - v2, changed = fastpathTV.DecMapUintptrUintptrV(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]int: - fastpathTV.DecMapUintptrIntV(v, false, d) - case *map[uintptr]int: - var v2 map[uintptr]int - v2, changed = fastpathTV.DecMapUintptrIntV(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]int8: - fastpathTV.DecMapUintptrInt8V(v, false, d) - case *map[uintptr]int8: - var v2 map[uintptr]int8 - v2, changed = fastpathTV.DecMapUintptrInt8V(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]int16: - fastpathTV.DecMapUintptrInt16V(v, false, d) - case *map[uintptr]int16: - var v2 map[uintptr]int16 - v2, changed = fastpathTV.DecMapUintptrInt16V(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]int32: - fastpathTV.DecMapUintptrInt32V(v, false, d) - case *map[uintptr]int32: - var v2 map[uintptr]int32 - v2, changed = fastpathTV.DecMapUintptrInt32V(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]int64: - fastpathTV.DecMapUintptrInt64V(v, false, d) - case *map[uintptr]int64: - var v2 map[uintptr]int64 - v2, changed = fastpathTV.DecMapUintptrInt64V(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]float32: - fastpathTV.DecMapUintptrFloat32V(v, false, d) - case *map[uintptr]float32: - var v2 map[uintptr]float32 - v2, changed = fastpathTV.DecMapUintptrFloat32V(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]float64: - fastpathTV.DecMapUintptrFloat64V(v, false, d) - case *map[uintptr]float64: - var v2 map[uintptr]float64 - v2, changed = fastpathTV.DecMapUintptrFloat64V(*v, true, d) - if changed { - *v = v2 - } - case map[uintptr]bool: - fastpathTV.DecMapUintptrBoolV(v, false, d) - case *map[uintptr]bool: - var v2 map[uintptr]bool - v2, changed = fastpathTV.DecMapUintptrBoolV(*v, true, d) - if changed { - *v = v2 - } case map[int]interface{}: fastpathTV.DecMapIntIntfV(v, false, d) case *map[int]interface{}: @@ -15007,6 +4403,14 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } + case map[int][]byte: + fastpathTV.DecMapIntBytesV(v, false, d) + case *map[int][]byte: + var v2 map[int][]byte + v2, changed = fastpathTV.DecMapIntBytesV(*v, true, d) + if changed { + *v = v2 + } case map[int]uint: fastpathTV.DecMapIntUintV(v, false, d) case *map[int]uint: @@ -15023,22 +4427,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[int]uint16: - fastpathTV.DecMapIntUint16V(v, false, d) - case *map[int]uint16: - var v2 map[int]uint16 - v2, changed = fastpathTV.DecMapIntUint16V(*v, true, d) - if changed { - *v = v2 - } - case map[int]uint32: - fastpathTV.DecMapIntUint32V(v, false, d) - case *map[int]uint32: - var v2 map[int]uint32 - v2, changed = fastpathTV.DecMapIntUint32V(*v, true, d) - if changed { - *v = v2 - } case map[int]uint64: fastpathTV.DecMapIntUint64V(v, false, d) case *map[int]uint64: @@ -15063,30 +4451,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[int]int8: - fastpathTV.DecMapIntInt8V(v, false, d) - case *map[int]int8: - var v2 map[int]int8 - v2, changed = fastpathTV.DecMapIntInt8V(*v, true, d) - if changed { - *v = v2 - } - case map[int]int16: - fastpathTV.DecMapIntInt16V(v, false, d) - case *map[int]int16: - var v2 map[int]int16 - v2, changed = fastpathTV.DecMapIntInt16V(*v, true, d) - if changed { - *v = v2 - } - case map[int]int32: - fastpathTV.DecMapIntInt32V(v, false, d) - case *map[int]int32: - var v2 map[int]int32 - v2, changed = fastpathTV.DecMapIntInt32V(*v, true, d) - if changed { - *v = v2 - } case map[int]int64: fastpathTV.DecMapIntInt64V(v, false, d) case *map[int]int64: @@ -15119,390 +4483,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[int8]interface{}: - fastpathTV.DecMapInt8IntfV(v, false, d) - case *map[int8]interface{}: - var v2 map[int8]interface{} - v2, changed = fastpathTV.DecMapInt8IntfV(*v, true, d) - if changed { - *v = v2 - } - case map[int8]string: - fastpathTV.DecMapInt8StringV(v, false, d) - case *map[int8]string: - var v2 map[int8]string - v2, changed = fastpathTV.DecMapInt8StringV(*v, true, d) - if changed { - *v = v2 - } - case map[int8]uint: - fastpathTV.DecMapInt8UintV(v, false, d) - case *map[int8]uint: - var v2 map[int8]uint - v2, changed = fastpathTV.DecMapInt8UintV(*v, true, d) - if changed { - *v = v2 - } - case map[int8]uint8: - fastpathTV.DecMapInt8Uint8V(v, false, d) - case *map[int8]uint8: - var v2 map[int8]uint8 - v2, changed = fastpathTV.DecMapInt8Uint8V(*v, true, d) - if changed { - *v = v2 - } - case map[int8]uint16: - fastpathTV.DecMapInt8Uint16V(v, false, d) - case *map[int8]uint16: - var v2 map[int8]uint16 - v2, changed = fastpathTV.DecMapInt8Uint16V(*v, true, d) - if changed { - *v = v2 - } - case map[int8]uint32: - fastpathTV.DecMapInt8Uint32V(v, false, d) - case *map[int8]uint32: - var v2 map[int8]uint32 - v2, changed = fastpathTV.DecMapInt8Uint32V(*v, true, d) - if changed { - *v = v2 - } - case map[int8]uint64: - fastpathTV.DecMapInt8Uint64V(v, false, d) - case *map[int8]uint64: - var v2 map[int8]uint64 - v2, changed = fastpathTV.DecMapInt8Uint64V(*v, true, d) - if changed { - *v = v2 - } - case map[int8]uintptr: - fastpathTV.DecMapInt8UintptrV(v, false, d) - case *map[int8]uintptr: - var v2 map[int8]uintptr - v2, changed = fastpathTV.DecMapInt8UintptrV(*v, true, d) - if changed { - *v = v2 - } - case map[int8]int: - fastpathTV.DecMapInt8IntV(v, false, d) - case *map[int8]int: - var v2 map[int8]int - v2, changed = fastpathTV.DecMapInt8IntV(*v, true, d) - if changed { - *v = v2 - } - case map[int8]int8: - fastpathTV.DecMapInt8Int8V(v, false, d) - case *map[int8]int8: - var v2 map[int8]int8 - v2, changed = fastpathTV.DecMapInt8Int8V(*v, true, d) - if changed { - *v = v2 - } - case map[int8]int16: - fastpathTV.DecMapInt8Int16V(v, false, d) - case *map[int8]int16: - var v2 map[int8]int16 - v2, changed = fastpathTV.DecMapInt8Int16V(*v, true, d) - if changed { - *v = v2 - } - case map[int8]int32: - fastpathTV.DecMapInt8Int32V(v, false, d) - case *map[int8]int32: - var v2 map[int8]int32 - v2, changed = fastpathTV.DecMapInt8Int32V(*v, true, d) - if changed { - *v = v2 - } - case map[int8]int64: - fastpathTV.DecMapInt8Int64V(v, false, d) - case *map[int8]int64: - var v2 map[int8]int64 - v2, changed = fastpathTV.DecMapInt8Int64V(*v, true, d) - if changed { - *v = v2 - } - case map[int8]float32: - fastpathTV.DecMapInt8Float32V(v, false, d) - case *map[int8]float32: - var v2 map[int8]float32 - v2, changed = fastpathTV.DecMapInt8Float32V(*v, true, d) - if changed { - *v = v2 - } - case map[int8]float64: - fastpathTV.DecMapInt8Float64V(v, false, d) - case *map[int8]float64: - var v2 map[int8]float64 - v2, changed = fastpathTV.DecMapInt8Float64V(*v, true, d) - if changed { - *v = v2 - } - case map[int8]bool: - fastpathTV.DecMapInt8BoolV(v, false, d) - case *map[int8]bool: - var v2 map[int8]bool - v2, changed = fastpathTV.DecMapInt8BoolV(*v, true, d) - if changed { - *v = v2 - } - case map[int16]interface{}: - fastpathTV.DecMapInt16IntfV(v, false, d) - case *map[int16]interface{}: - var v2 map[int16]interface{} - v2, changed = fastpathTV.DecMapInt16IntfV(*v, true, d) - if changed { - *v = v2 - } - case map[int16]string: - fastpathTV.DecMapInt16StringV(v, false, d) - case *map[int16]string: - var v2 map[int16]string - v2, changed = fastpathTV.DecMapInt16StringV(*v, true, d) - if changed { - *v = v2 - } - case map[int16]uint: - fastpathTV.DecMapInt16UintV(v, false, d) - case *map[int16]uint: - var v2 map[int16]uint - v2, changed = fastpathTV.DecMapInt16UintV(*v, true, d) - if changed { - *v = v2 - } - case map[int16]uint8: - fastpathTV.DecMapInt16Uint8V(v, false, d) - case *map[int16]uint8: - var v2 map[int16]uint8 - v2, changed = fastpathTV.DecMapInt16Uint8V(*v, true, d) - if changed { - *v = v2 - } - case map[int16]uint16: - fastpathTV.DecMapInt16Uint16V(v, false, d) - case *map[int16]uint16: - var v2 map[int16]uint16 - v2, changed = fastpathTV.DecMapInt16Uint16V(*v, true, d) - if changed { - *v = v2 - } - case map[int16]uint32: - fastpathTV.DecMapInt16Uint32V(v, false, d) - case *map[int16]uint32: - var v2 map[int16]uint32 - v2, changed = fastpathTV.DecMapInt16Uint32V(*v, true, d) - if changed { - *v = v2 - } - case map[int16]uint64: - fastpathTV.DecMapInt16Uint64V(v, false, d) - case *map[int16]uint64: - var v2 map[int16]uint64 - v2, changed = fastpathTV.DecMapInt16Uint64V(*v, true, d) - if changed { - *v = v2 - } - case map[int16]uintptr: - fastpathTV.DecMapInt16UintptrV(v, false, d) - case *map[int16]uintptr: - var v2 map[int16]uintptr - v2, changed = fastpathTV.DecMapInt16UintptrV(*v, true, d) - if changed { - *v = v2 - } - case map[int16]int: - fastpathTV.DecMapInt16IntV(v, false, d) - case *map[int16]int: - var v2 map[int16]int - v2, changed = fastpathTV.DecMapInt16IntV(*v, true, d) - if changed { - *v = v2 - } - case map[int16]int8: - fastpathTV.DecMapInt16Int8V(v, false, d) - case *map[int16]int8: - var v2 map[int16]int8 - v2, changed = fastpathTV.DecMapInt16Int8V(*v, true, d) - if changed { - *v = v2 - } - case map[int16]int16: - fastpathTV.DecMapInt16Int16V(v, false, d) - case *map[int16]int16: - var v2 map[int16]int16 - v2, changed = fastpathTV.DecMapInt16Int16V(*v, true, d) - if changed { - *v = v2 - } - case map[int16]int32: - fastpathTV.DecMapInt16Int32V(v, false, d) - case *map[int16]int32: - var v2 map[int16]int32 - v2, changed = fastpathTV.DecMapInt16Int32V(*v, true, d) - if changed { - *v = v2 - } - case map[int16]int64: - fastpathTV.DecMapInt16Int64V(v, false, d) - case *map[int16]int64: - var v2 map[int16]int64 - v2, changed = fastpathTV.DecMapInt16Int64V(*v, true, d) - if changed { - *v = v2 - } - case map[int16]float32: - fastpathTV.DecMapInt16Float32V(v, false, d) - case *map[int16]float32: - var v2 map[int16]float32 - v2, changed = fastpathTV.DecMapInt16Float32V(*v, true, d) - if changed { - *v = v2 - } - case map[int16]float64: - fastpathTV.DecMapInt16Float64V(v, false, d) - case *map[int16]float64: - var v2 map[int16]float64 - v2, changed = fastpathTV.DecMapInt16Float64V(*v, true, d) - if changed { - *v = v2 - } - case map[int16]bool: - fastpathTV.DecMapInt16BoolV(v, false, d) - case *map[int16]bool: - var v2 map[int16]bool - v2, changed = fastpathTV.DecMapInt16BoolV(*v, true, d) - if changed { - *v = v2 - } - case map[int32]interface{}: - fastpathTV.DecMapInt32IntfV(v, false, d) - case *map[int32]interface{}: - var v2 map[int32]interface{} - v2, changed = fastpathTV.DecMapInt32IntfV(*v, true, d) - if changed { - *v = v2 - } - case map[int32]string: - fastpathTV.DecMapInt32StringV(v, false, d) - case *map[int32]string: - var v2 map[int32]string - v2, changed = fastpathTV.DecMapInt32StringV(*v, true, d) - if changed { - *v = v2 - } - case map[int32]uint: - fastpathTV.DecMapInt32UintV(v, false, d) - case *map[int32]uint: - var v2 map[int32]uint - v2, changed = fastpathTV.DecMapInt32UintV(*v, true, d) - if changed { - *v = v2 - } - case map[int32]uint8: - fastpathTV.DecMapInt32Uint8V(v, false, d) - case *map[int32]uint8: - var v2 map[int32]uint8 - v2, changed = fastpathTV.DecMapInt32Uint8V(*v, true, d) - if changed { - *v = v2 - } - case map[int32]uint16: - fastpathTV.DecMapInt32Uint16V(v, false, d) - case *map[int32]uint16: - var v2 map[int32]uint16 - v2, changed = fastpathTV.DecMapInt32Uint16V(*v, true, d) - if changed { - *v = v2 - } - case map[int32]uint32: - fastpathTV.DecMapInt32Uint32V(v, false, d) - case *map[int32]uint32: - var v2 map[int32]uint32 - v2, changed = fastpathTV.DecMapInt32Uint32V(*v, true, d) - if changed { - *v = v2 - } - case map[int32]uint64: - fastpathTV.DecMapInt32Uint64V(v, false, d) - case *map[int32]uint64: - var v2 map[int32]uint64 - v2, changed = fastpathTV.DecMapInt32Uint64V(*v, true, d) - if changed { - *v = v2 - } - case map[int32]uintptr: - fastpathTV.DecMapInt32UintptrV(v, false, d) - case *map[int32]uintptr: - var v2 map[int32]uintptr - v2, changed = fastpathTV.DecMapInt32UintptrV(*v, true, d) - if changed { - *v = v2 - } - case map[int32]int: - fastpathTV.DecMapInt32IntV(v, false, d) - case *map[int32]int: - var v2 map[int32]int - v2, changed = fastpathTV.DecMapInt32IntV(*v, true, d) - if changed { - *v = v2 - } - case map[int32]int8: - fastpathTV.DecMapInt32Int8V(v, false, d) - case *map[int32]int8: - var v2 map[int32]int8 - v2, changed = fastpathTV.DecMapInt32Int8V(*v, true, d) - if changed { - *v = v2 - } - case map[int32]int16: - fastpathTV.DecMapInt32Int16V(v, false, d) - case *map[int32]int16: - var v2 map[int32]int16 - v2, changed = fastpathTV.DecMapInt32Int16V(*v, true, d) - if changed { - *v = v2 - } - case map[int32]int32: - fastpathTV.DecMapInt32Int32V(v, false, d) - case *map[int32]int32: - var v2 map[int32]int32 - v2, changed = fastpathTV.DecMapInt32Int32V(*v, true, d) - if changed { - *v = v2 - } - case map[int32]int64: - fastpathTV.DecMapInt32Int64V(v, false, d) - case *map[int32]int64: - var v2 map[int32]int64 - v2, changed = fastpathTV.DecMapInt32Int64V(*v, true, d) - if changed { - *v = v2 - } - case map[int32]float32: - fastpathTV.DecMapInt32Float32V(v, false, d) - case *map[int32]float32: - var v2 map[int32]float32 - v2, changed = fastpathTV.DecMapInt32Float32V(*v, true, d) - if changed { - *v = v2 - } - case map[int32]float64: - fastpathTV.DecMapInt32Float64V(v, false, d) - case *map[int32]float64: - var v2 map[int32]float64 - v2, changed = fastpathTV.DecMapInt32Float64V(*v, true, d) - if changed { - *v = v2 - } - case map[int32]bool: - fastpathTV.DecMapInt32BoolV(v, false, d) - case *map[int32]bool: - var v2 map[int32]bool - v2, changed = fastpathTV.DecMapInt32BoolV(*v, true, d) - if changed { - *v = v2 - } case map[int64]interface{}: fastpathTV.DecMapInt64IntfV(v, false, d) case *map[int64]interface{}: @@ -15519,6 +4499,14 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } + case map[int64][]byte: + fastpathTV.DecMapInt64BytesV(v, false, d) + case *map[int64][]byte: + var v2 map[int64][]byte + v2, changed = fastpathTV.DecMapInt64BytesV(*v, true, d) + if changed { + *v = v2 + } case map[int64]uint: fastpathTV.DecMapInt64UintV(v, false, d) case *map[int64]uint: @@ -15535,22 +4523,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[int64]uint16: - fastpathTV.DecMapInt64Uint16V(v, false, d) - case *map[int64]uint16: - var v2 map[int64]uint16 - v2, changed = fastpathTV.DecMapInt64Uint16V(*v, true, d) - if changed { - *v = v2 - } - case map[int64]uint32: - fastpathTV.DecMapInt64Uint32V(v, false, d) - case *map[int64]uint32: - var v2 map[int64]uint32 - v2, changed = fastpathTV.DecMapInt64Uint32V(*v, true, d) - if changed { - *v = v2 - } case map[int64]uint64: fastpathTV.DecMapInt64Uint64V(v, false, d) case *map[int64]uint64: @@ -15575,30 +4547,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[int64]int8: - fastpathTV.DecMapInt64Int8V(v, false, d) - case *map[int64]int8: - var v2 map[int64]int8 - v2, changed = fastpathTV.DecMapInt64Int8V(*v, true, d) - if changed { - *v = v2 - } - case map[int64]int16: - fastpathTV.DecMapInt64Int16V(v, false, d) - case *map[int64]int16: - var v2 map[int64]int16 - v2, changed = fastpathTV.DecMapInt64Int16V(*v, true, d) - if changed { - *v = v2 - } - case map[int64]int32: - fastpathTV.DecMapInt64Int32V(v, false, d) - case *map[int64]int32: - var v2 map[int64]int32 - v2, changed = fastpathTV.DecMapInt64Int32V(*v, true, d) - if changed { - *v = v2 - } case map[int64]int64: fastpathTV.DecMapInt64Int64V(v, false, d) case *map[int64]int64: @@ -15631,134 +4579,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if changed { *v = v2 } - case map[bool]interface{}: - fastpathTV.DecMapBoolIntfV(v, false, d) - case *map[bool]interface{}: - var v2 map[bool]interface{} - v2, changed = fastpathTV.DecMapBoolIntfV(*v, true, d) - if changed { - *v = v2 - } - case map[bool]string: - fastpathTV.DecMapBoolStringV(v, false, d) - case *map[bool]string: - var v2 map[bool]string - v2, changed = fastpathTV.DecMapBoolStringV(*v, true, d) - if changed { - *v = v2 - } - case map[bool]uint: - fastpathTV.DecMapBoolUintV(v, false, d) - case *map[bool]uint: - var v2 map[bool]uint - v2, changed = fastpathTV.DecMapBoolUintV(*v, true, d) - if changed { - *v = v2 - } - case map[bool]uint8: - fastpathTV.DecMapBoolUint8V(v, false, d) - case *map[bool]uint8: - var v2 map[bool]uint8 - v2, changed = fastpathTV.DecMapBoolUint8V(*v, true, d) - if changed { - *v = v2 - } - case map[bool]uint16: - fastpathTV.DecMapBoolUint16V(v, false, d) - case *map[bool]uint16: - var v2 map[bool]uint16 - v2, changed = fastpathTV.DecMapBoolUint16V(*v, true, d) - if changed { - *v = v2 - } - case map[bool]uint32: - fastpathTV.DecMapBoolUint32V(v, false, d) - case *map[bool]uint32: - var v2 map[bool]uint32 - v2, changed = fastpathTV.DecMapBoolUint32V(*v, true, d) - if changed { - *v = v2 - } - case map[bool]uint64: - fastpathTV.DecMapBoolUint64V(v, false, d) - case *map[bool]uint64: - var v2 map[bool]uint64 - v2, changed = fastpathTV.DecMapBoolUint64V(*v, true, d) - if changed { - *v = v2 - } - case map[bool]uintptr: - fastpathTV.DecMapBoolUintptrV(v, false, d) - case *map[bool]uintptr: - var v2 map[bool]uintptr - v2, changed = fastpathTV.DecMapBoolUintptrV(*v, true, d) - if changed { - *v = v2 - } - case map[bool]int: - fastpathTV.DecMapBoolIntV(v, false, d) - case *map[bool]int: - var v2 map[bool]int - v2, changed = fastpathTV.DecMapBoolIntV(*v, true, d) - if changed { - *v = v2 - } - case map[bool]int8: - fastpathTV.DecMapBoolInt8V(v, false, d) - case *map[bool]int8: - var v2 map[bool]int8 - v2, changed = fastpathTV.DecMapBoolInt8V(*v, true, d) - if changed { - *v = v2 - } - case map[bool]int16: - fastpathTV.DecMapBoolInt16V(v, false, d) - case *map[bool]int16: - var v2 map[bool]int16 - v2, changed = fastpathTV.DecMapBoolInt16V(*v, true, d) - if changed { - *v = v2 - } - case map[bool]int32: - fastpathTV.DecMapBoolInt32V(v, false, d) - case *map[bool]int32: - var v2 map[bool]int32 - v2, changed = fastpathTV.DecMapBoolInt32V(*v, true, d) - if changed { - *v = v2 - } - case map[bool]int64: - fastpathTV.DecMapBoolInt64V(v, false, d) - case *map[bool]int64: - var v2 map[bool]int64 - v2, changed = fastpathTV.DecMapBoolInt64V(*v, true, d) - if changed { - *v = v2 - } - case map[bool]float32: - fastpathTV.DecMapBoolFloat32V(v, false, d) - case *map[bool]float32: - var v2 map[bool]float32 - v2, changed = fastpathTV.DecMapBoolFloat32V(*v, true, d) - if changed { - *v = v2 - } - case map[bool]float64: - fastpathTV.DecMapBoolFloat64V(v, false, d) - case *map[bool]float64: - var v2 map[bool]float64 - v2, changed = fastpathTV.DecMapBoolFloat64V(*v, true, d) - if changed { - *v = v2 - } - case map[bool]bool: - fastpathTV.DecMapBoolBoolV(v, false, d) - case *map[bool]bool: - var v2 map[bool]bool - v2, changed = fastpathTV.DecMapBoolBoolV(*v, true, d) - if changed { - *v = v2 - } default: _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 return false @@ -15773,6 +4593,8 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *[]string: *v = nil + case *[][]byte: + *v = nil case *[]float32: *v = nil case *[]float64: @@ -15802,62 +4624,22 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { case *[]bool: *v = nil - case *map[interface{}]interface{}: - *v = nil - case *map[interface{}]string: - *v = nil - case *map[interface{}]uint: - *v = nil - case *map[interface{}]uint8: - *v = nil - case *map[interface{}]uint16: - *v = nil - case *map[interface{}]uint32: - *v = nil - case *map[interface{}]uint64: - *v = nil - case *map[interface{}]uintptr: - *v = nil - case *map[interface{}]int: - *v = nil - case *map[interface{}]int8: - *v = nil - case *map[interface{}]int16: - *v = nil - case *map[interface{}]int32: - *v = nil - case *map[interface{}]int64: - *v = nil - case *map[interface{}]float32: - *v = nil - case *map[interface{}]float64: - *v = nil - case *map[interface{}]bool: - *v = nil case *map[string]interface{}: *v = nil case *map[string]string: *v = nil + case *map[string][]byte: + *v = nil case *map[string]uint: *v = nil case *map[string]uint8: *v = nil - case *map[string]uint16: - *v = nil - case *map[string]uint32: - *v = nil case *map[string]uint64: *v = nil case *map[string]uintptr: *v = nil case *map[string]int: *v = nil - case *map[string]int8: - *v = nil - case *map[string]int16: - *v = nil - case *map[string]int32: - *v = nil case *map[string]int64: *v = nil case *map[string]float32: @@ -15866,94 +4648,22 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[string]bool: *v = nil - case *map[float32]interface{}: - *v = nil - case *map[float32]string: - *v = nil - case *map[float32]uint: - *v = nil - case *map[float32]uint8: - *v = nil - case *map[float32]uint16: - *v = nil - case *map[float32]uint32: - *v = nil - case *map[float32]uint64: - *v = nil - case *map[float32]uintptr: - *v = nil - case *map[float32]int: - *v = nil - case *map[float32]int8: - *v = nil - case *map[float32]int16: - *v = nil - case *map[float32]int32: - *v = nil - case *map[float32]int64: - *v = nil - case *map[float32]float32: - *v = nil - case *map[float32]float64: - *v = nil - case *map[float32]bool: - *v = nil - case *map[float64]interface{}: - *v = nil - case *map[float64]string: - *v = nil - case *map[float64]uint: - *v = nil - case *map[float64]uint8: - *v = nil - case *map[float64]uint16: - *v = nil - case *map[float64]uint32: - *v = nil - case *map[float64]uint64: - *v = nil - case *map[float64]uintptr: - *v = nil - case *map[float64]int: - *v = nil - case *map[float64]int8: - *v = nil - case *map[float64]int16: - *v = nil - case *map[float64]int32: - *v = nil - case *map[float64]int64: - *v = nil - case *map[float64]float32: - *v = nil - case *map[float64]float64: - *v = nil - case *map[float64]bool: - *v = nil case *map[uint]interface{}: *v = nil case *map[uint]string: *v = nil + case *map[uint][]byte: + *v = nil case *map[uint]uint: *v = nil case *map[uint]uint8: *v = nil - case *map[uint]uint16: - *v = nil - case *map[uint]uint32: - *v = nil case *map[uint]uint64: *v = nil case *map[uint]uintptr: *v = nil case *map[uint]int: *v = nil - case *map[uint]int8: - *v = nil - case *map[uint]int16: - *v = nil - case *map[uint]int32: - *v = nil case *map[uint]int64: *v = nil case *map[uint]float32: @@ -15966,26 +4676,18 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[uint8]string: *v = nil + case *map[uint8][]byte: + *v = nil case *map[uint8]uint: *v = nil case *map[uint8]uint8: *v = nil - case *map[uint8]uint16: - *v = nil - case *map[uint8]uint32: - *v = nil case *map[uint8]uint64: *v = nil case *map[uint8]uintptr: *v = nil case *map[uint8]int: *v = nil - case *map[uint8]int8: - *v = nil - case *map[uint8]int16: - *v = nil - case *map[uint8]int32: - *v = nil case *map[uint8]int64: *v = nil case *map[uint8]float32: @@ -15994,94 +4696,22 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[uint8]bool: *v = nil - case *map[uint16]interface{}: - *v = nil - case *map[uint16]string: - *v = nil - case *map[uint16]uint: - *v = nil - case *map[uint16]uint8: - *v = nil - case *map[uint16]uint16: - *v = nil - case *map[uint16]uint32: - *v = nil - case *map[uint16]uint64: - *v = nil - case *map[uint16]uintptr: - *v = nil - case *map[uint16]int: - *v = nil - case *map[uint16]int8: - *v = nil - case *map[uint16]int16: - *v = nil - case *map[uint16]int32: - *v = nil - case *map[uint16]int64: - *v = nil - case *map[uint16]float32: - *v = nil - case *map[uint16]float64: - *v = nil - case *map[uint16]bool: - *v = nil - case *map[uint32]interface{}: - *v = nil - case *map[uint32]string: - *v = nil - case *map[uint32]uint: - *v = nil - case *map[uint32]uint8: - *v = nil - case *map[uint32]uint16: - *v = nil - case *map[uint32]uint32: - *v = nil - case *map[uint32]uint64: - *v = nil - case *map[uint32]uintptr: - *v = nil - case *map[uint32]int: - *v = nil - case *map[uint32]int8: - *v = nil - case *map[uint32]int16: - *v = nil - case *map[uint32]int32: - *v = nil - case *map[uint32]int64: - *v = nil - case *map[uint32]float32: - *v = nil - case *map[uint32]float64: - *v = nil - case *map[uint32]bool: - *v = nil case *map[uint64]interface{}: *v = nil case *map[uint64]string: *v = nil + case *map[uint64][]byte: + *v = nil case *map[uint64]uint: *v = nil case *map[uint64]uint8: *v = nil - case *map[uint64]uint16: - *v = nil - case *map[uint64]uint32: - *v = nil case *map[uint64]uint64: *v = nil case *map[uint64]uintptr: *v = nil case *map[uint64]int: *v = nil - case *map[uint64]int8: - *v = nil - case *map[uint64]int16: - *v = nil - case *map[uint64]int32: - *v = nil case *map[uint64]int64: *v = nil case *map[uint64]float32: @@ -16090,62 +4720,22 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[uint64]bool: *v = nil - case *map[uintptr]interface{}: - *v = nil - case *map[uintptr]string: - *v = nil - case *map[uintptr]uint: - *v = nil - case *map[uintptr]uint8: - *v = nil - case *map[uintptr]uint16: - *v = nil - case *map[uintptr]uint32: - *v = nil - case *map[uintptr]uint64: - *v = nil - case *map[uintptr]uintptr: - *v = nil - case *map[uintptr]int: - *v = nil - case *map[uintptr]int8: - *v = nil - case *map[uintptr]int16: - *v = nil - case *map[uintptr]int32: - *v = nil - case *map[uintptr]int64: - *v = nil - case *map[uintptr]float32: - *v = nil - case *map[uintptr]float64: - *v = nil - case *map[uintptr]bool: - *v = nil case *map[int]interface{}: *v = nil case *map[int]string: *v = nil + case *map[int][]byte: + *v = nil case *map[int]uint: *v = nil case *map[int]uint8: *v = nil - case *map[int]uint16: - *v = nil - case *map[int]uint32: - *v = nil case *map[int]uint64: *v = nil case *map[int]uintptr: *v = nil case *map[int]int: *v = nil - case *map[int]int8: - *v = nil - case *map[int]int16: - *v = nil - case *map[int]int32: - *v = nil case *map[int]int64: *v = nil case *map[int]float32: @@ -16154,126 +4744,22 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[int]bool: *v = nil - case *map[int8]interface{}: - *v = nil - case *map[int8]string: - *v = nil - case *map[int8]uint: - *v = nil - case *map[int8]uint8: - *v = nil - case *map[int8]uint16: - *v = nil - case *map[int8]uint32: - *v = nil - case *map[int8]uint64: - *v = nil - case *map[int8]uintptr: - *v = nil - case *map[int8]int: - *v = nil - case *map[int8]int8: - *v = nil - case *map[int8]int16: - *v = nil - case *map[int8]int32: - *v = nil - case *map[int8]int64: - *v = nil - case *map[int8]float32: - *v = nil - case *map[int8]float64: - *v = nil - case *map[int8]bool: - *v = nil - case *map[int16]interface{}: - *v = nil - case *map[int16]string: - *v = nil - case *map[int16]uint: - *v = nil - case *map[int16]uint8: - *v = nil - case *map[int16]uint16: - *v = nil - case *map[int16]uint32: - *v = nil - case *map[int16]uint64: - *v = nil - case *map[int16]uintptr: - *v = nil - case *map[int16]int: - *v = nil - case *map[int16]int8: - *v = nil - case *map[int16]int16: - *v = nil - case *map[int16]int32: - *v = nil - case *map[int16]int64: - *v = nil - case *map[int16]float32: - *v = nil - case *map[int16]float64: - *v = nil - case *map[int16]bool: - *v = nil - case *map[int32]interface{}: - *v = nil - case *map[int32]string: - *v = nil - case *map[int32]uint: - *v = nil - case *map[int32]uint8: - *v = nil - case *map[int32]uint16: - *v = nil - case *map[int32]uint32: - *v = nil - case *map[int32]uint64: - *v = nil - case *map[int32]uintptr: - *v = nil - case *map[int32]int: - *v = nil - case *map[int32]int8: - *v = nil - case *map[int32]int16: - *v = nil - case *map[int32]int32: - *v = nil - case *map[int32]int64: - *v = nil - case *map[int32]float32: - *v = nil - case *map[int32]float64: - *v = nil - case *map[int32]bool: - *v = nil case *map[int64]interface{}: *v = nil case *map[int64]string: *v = nil + case *map[int64][]byte: + *v = nil case *map[int64]uint: *v = nil case *map[int64]uint8: *v = nil - case *map[int64]uint16: - *v = nil - case *map[int64]uint32: - *v = nil case *map[int64]uint64: *v = nil case *map[int64]uintptr: *v = nil case *map[int64]int: *v = nil - case *map[int64]int8: - *v = nil - case *map[int64]int16: - *v = nil - case *map[int64]int32: - *v = nil case *map[int64]int64: *v = nil case *map[int64]float32: @@ -16282,38 +4768,6 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[int64]bool: *v = nil - case *map[bool]interface{}: - *v = nil - case *map[bool]string: - *v = nil - case *map[bool]uint: - *v = nil - case *map[bool]uint8: - *v = nil - case *map[bool]uint16: - *v = nil - case *map[bool]uint32: - *v = nil - case *map[bool]uint64: - *v = nil - case *map[bool]uintptr: - *v = nil - case *map[bool]int: - *v = nil - case *map[bool]int8: - *v = nil - case *map[bool]int16: - *v = nil - case *map[bool]int32: - *v = nil - case *map[bool]int64: - *v = nil - case *map[bool]float32: - *v = nil - case *map[bool]float64: - *v = nil - case *map[bool]bool: - *v = nil default: _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 return false @@ -16326,8 +4780,7 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { func (d *Decoder) fastpathDecSliceIntfR(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]interface{}) - v, changed := fastpathTV.DecSliceIntfV(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceIntfV(*vp, !array, d); changed { *vp = v } } else { @@ -16339,13 +4792,11 @@ func (d *Decoder) fastpathDecSliceIntfR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceIntfX(vp *[]interface{}, d *Decoder) { - v, changed := f.DecSliceIntfV(*vp, true, d) - if changed { + if v, changed := f.DecSliceIntfV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ []interface{}, changed bool) { - dd := d.d +func (fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ []interface{}, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -16359,7 +4810,6 @@ func (_ fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -16377,7 +4827,7 @@ func (_ fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) @@ -16387,7 +4837,6 @@ func (_ fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ v = make([]interface{}, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -16401,7 +4850,7 @@ func (_ fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = nil } else { d.decode(&v[uint(j)]) @@ -16417,15 +4866,13 @@ func (_ fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceStringR(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]string) - v, changed := fastpathTV.DecSliceStringV(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceStringV(*vp, !array, d); changed { *vp = v } } else { @@ -16437,13 +4884,11 @@ func (d *Decoder) fastpathDecSliceStringR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceStringX(vp *[]string, d *Decoder) { - v, changed := f.DecSliceStringV(*vp, true, d) - if changed { + if v, changed := f.DecSliceStringV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ []string, changed bool) { - dd := d.d +func (fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ []string, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -16457,7 +4902,6 @@ func (_ fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ [] slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -16475,7 +4919,7 @@ func (_ fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ [] } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) @@ -16485,7 +4929,6 @@ func (_ fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ [] v = make([]string, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -16499,10 +4942,10 @@ func (_ fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ [] slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = "" } else { - v[uint(j)] = dd.DecodeString() + v[uint(j)] = d.d.DecodeString() } } if canChange { @@ -16515,15 +4958,105 @@ func (_ fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ [] } } slh.End() - d.depthDecr() + return v, changed +} + +func (d *Decoder) fastpathDecSliceBytesR(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[][]byte) + if v, changed := fastpathTV.DecSliceBytesV(*vp, !array, d); changed { + *vp = v + } + } else { + v := rv2i(rv).([][]byte) + v2, changed := fastpathTV.DecSliceBytesV(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + } +} +func (f fastpathT) DecSliceBytesX(vp *[][]byte, d *Decoder) { + if v, changed := f.DecSliceBytesV(*vp, true, d); changed { + *vp = v + } +} +func (fastpathT) DecSliceBytesV(v [][]byte, canChange bool, d *Decoder) (_ [][]byte, changed bool) { + slh, containerLenS := d.decSliceHelperStart() + if containerLenS == 0 { + if canChange { + if v == nil { + v = [][]byte{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { + if containerLenS > cap(v) { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 24) + if xlen <= cap(v) { + v = v[:uint(xlen)] + } else { + v = make([][]byte, uint(xlen)) + } + changed = true + } else if containerLenS != len(v) { + v = v[:containerLenS] + changed = true + } + } + var j int + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 24) + } else { + xlen = 8 + } + v = make([][]byte, uint(xlen)) + changed = true + } + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, nil) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if d.d.TryDecodeAsNil() { + v[uint(j)] = nil + } else { + v[uint(j)] = d.d.DecodeBytes(nil, false) + } + } + if canChange { + if j < len(v) { + v = v[:uint(j)] + changed = true + } else if j == 0 && v == nil { + v = make([][]byte, 0) + changed = true + } + } + slh.End() return v, changed } func (d *Decoder) fastpathDecSliceFloat32R(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]float32) - v, changed := fastpathTV.DecSliceFloat32V(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceFloat32V(*vp, !array, d); changed { *vp = v } } else { @@ -16535,13 +5068,11 @@ func (d *Decoder) fastpathDecSliceFloat32R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceFloat32X(vp *[]float32, d *Decoder) { - v, changed := f.DecSliceFloat32V(*vp, true, d) - if changed { + if v, changed := f.DecSliceFloat32V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ []float32, changed bool) { - dd := d.d +func (fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ []float32, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -16555,7 +5086,6 @@ func (_ fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -16573,7 +5103,7 @@ func (_ fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) @@ -16583,7 +5113,6 @@ func (_ fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ v = make([]float32, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -16597,10 +5126,10 @@ func (_ fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = 0 } else { - v[uint(j)] = float32(chkOvf.Float32V(dd.DecodeFloat64())) + v[uint(j)] = float32(d.decodeFloat32()) } } if canChange { @@ -16613,15 +5142,13 @@ func (_ fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceFloat64R(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]float64) - v, changed := fastpathTV.DecSliceFloat64V(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceFloat64V(*vp, !array, d); changed { *vp = v } } else { @@ -16633,13 +5160,11 @@ func (d *Decoder) fastpathDecSliceFloat64R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceFloat64X(vp *[]float64, d *Decoder) { - v, changed := f.DecSliceFloat64V(*vp, true, d) - if changed { + if v, changed := f.DecSliceFloat64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ []float64, changed bool) { - dd := d.d +func (fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ []float64, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -16653,7 +5178,6 @@ func (_ fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -16671,7 +5195,7 @@ func (_ fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) @@ -16681,7 +5205,6 @@ func (_ fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ v = make([]float64, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -16695,10 +5218,10 @@ func (_ fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = 0 } else { - v[uint(j)] = dd.DecodeFloat64() + v[uint(j)] = d.d.DecodeFloat64() } } if canChange { @@ -16711,15 +5234,13 @@ func (_ fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceUintR(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]uint) - v, changed := fastpathTV.DecSliceUintV(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceUintV(*vp, !array, d); changed { *vp = v } } else { @@ -16731,13 +5252,11 @@ func (d *Decoder) fastpathDecSliceUintR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceUintX(vp *[]uint, d *Decoder) { - v, changed := f.DecSliceUintV(*vp, true, d) - if changed { + if v, changed := f.DecSliceUintV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint, changed bool) { - dd := d.d +func (fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -16751,7 +5270,6 @@ func (_ fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -16769,7 +5287,7 @@ func (_ fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) @@ -16779,7 +5297,6 @@ func (_ fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint v = make([]uint, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -16793,10 +5310,10 @@ func (_ fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = 0 } else { - v[uint(j)] = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + v[uint(j)] = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) } } if canChange { @@ -16809,15 +5326,13 @@ func (_ fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceUint8R(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]uint8) - v, changed := fastpathTV.DecSliceUint8V(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceUint8V(*vp, !array, d); changed { *vp = v } } else { @@ -16829,13 +5344,11 @@ func (d *Decoder) fastpathDecSliceUint8R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceUint8X(vp *[]uint8, d *Decoder) { - v, changed := f.DecSliceUint8V(*vp, true, d) - if changed { + if v, changed := f.DecSliceUint8V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []uint8, changed bool) { - dd := d.d +func (fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []uint8, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -16849,7 +5362,6 @@ func (_ fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []ui slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -16867,7 +5379,7 @@ func (_ fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []ui } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) @@ -16877,7 +5389,6 @@ func (_ fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []ui v = make([]uint8, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -16891,10 +5402,10 @@ func (_ fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []ui slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = 0 } else { - v[uint(j)] = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + v[uint(j)] = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) } } if canChange { @@ -16907,15 +5418,13 @@ func (_ fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []ui } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceUint16R(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]uint16) - v, changed := fastpathTV.DecSliceUint16V(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceUint16V(*vp, !array, d); changed { *vp = v } } else { @@ -16927,13 +5436,11 @@ func (d *Decoder) fastpathDecSliceUint16R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceUint16X(vp *[]uint16, d *Decoder) { - v, changed := f.DecSliceUint16V(*vp, true, d) - if changed { + if v, changed := f.DecSliceUint16V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ []uint16, changed bool) { - dd := d.d +func (fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ []uint16, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -16947,7 +5454,6 @@ func (_ fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ [] slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -16965,7 +5471,7 @@ func (_ fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ [] } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2) @@ -16975,7 +5481,6 @@ func (_ fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ [] v = make([]uint16, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -16989,10 +5494,10 @@ func (_ fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ [] slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = 0 } else { - v[uint(j)] = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + v[uint(j)] = uint16(chkOvf.UintV(d.d.DecodeUint64(), 16)) } } if canChange { @@ -17005,15 +5510,13 @@ func (_ fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ [] } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceUint32R(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]uint32) - v, changed := fastpathTV.DecSliceUint32V(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceUint32V(*vp, !array, d); changed { *vp = v } } else { @@ -17025,13 +5528,11 @@ func (d *Decoder) fastpathDecSliceUint32R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceUint32X(vp *[]uint32, d *Decoder) { - v, changed := f.DecSliceUint32V(*vp, true, d) - if changed { + if v, changed := f.DecSliceUint32V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ []uint32, changed bool) { - dd := d.d +func (fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ []uint32, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -17045,7 +5546,6 @@ func (_ fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ [] slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -17063,7 +5563,7 @@ func (_ fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ [] } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) @@ -17073,7 +5573,6 @@ func (_ fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ [] v = make([]uint32, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -17087,10 +5586,10 @@ func (_ fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ [] slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = 0 } else { - v[uint(j)] = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + v[uint(j)] = uint32(chkOvf.UintV(d.d.DecodeUint64(), 32)) } } if canChange { @@ -17103,15 +5602,13 @@ func (_ fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ [] } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceUint64R(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]uint64) - v, changed := fastpathTV.DecSliceUint64V(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceUint64V(*vp, !array, d); changed { *vp = v } } else { @@ -17123,13 +5620,11 @@ func (d *Decoder) fastpathDecSliceUint64R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceUint64X(vp *[]uint64, d *Decoder) { - v, changed := f.DecSliceUint64V(*vp, true, d) - if changed { + if v, changed := f.DecSliceUint64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ []uint64, changed bool) { - dd := d.d +func (fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ []uint64, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -17143,7 +5638,6 @@ func (_ fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ [] slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -17161,7 +5655,7 @@ func (_ fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ [] } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) @@ -17171,7 +5665,6 @@ func (_ fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ [] v = make([]uint64, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -17185,10 +5678,10 @@ func (_ fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ [] slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = 0 } else { - v[uint(j)] = dd.DecodeUint64() + v[uint(j)] = d.d.DecodeUint64() } } if canChange { @@ -17201,15 +5694,13 @@ func (_ fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ [] } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceUintptrR(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]uintptr) - v, changed := fastpathTV.DecSliceUintptrV(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceUintptrV(*vp, !array, d); changed { *vp = v } } else { @@ -17221,13 +5712,11 @@ func (d *Decoder) fastpathDecSliceUintptrR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceUintptrX(vp *[]uintptr, d *Decoder) { - v, changed := f.DecSliceUintptrV(*vp, true, d) - if changed { + if v, changed := f.DecSliceUintptrV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ []uintptr, changed bool) { - dd := d.d +func (fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ []uintptr, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -17241,7 +5730,6 @@ func (_ fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -17259,7 +5747,7 @@ func (_ fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) @@ -17269,7 +5757,6 @@ func (_ fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ v = make([]uintptr, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -17283,10 +5770,10 @@ func (_ fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = 0 } else { - v[uint(j)] = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + v[uint(j)] = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) } } if canChange { @@ -17299,15 +5786,13 @@ func (_ fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceIntR(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]int) - v, changed := fastpathTV.DecSliceIntV(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceIntV(*vp, !array, d); changed { *vp = v } } else { @@ -17319,13 +5804,11 @@ func (d *Decoder) fastpathDecSliceIntR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceIntX(vp *[]int, d *Decoder) { - v, changed := f.DecSliceIntV(*vp, true, d) - if changed { + if v, changed := f.DecSliceIntV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, changed bool) { - dd := d.d +func (fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -17339,7 +5822,6 @@ func (_ fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, c slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -17357,7 +5839,7 @@ func (_ fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, c } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) @@ -17367,7 +5849,6 @@ func (_ fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, c v = make([]int, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -17381,10 +5862,10 @@ func (_ fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, c slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = 0 } else { - v[uint(j)] = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + v[uint(j)] = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) } } if canChange { @@ -17397,15 +5878,13 @@ func (_ fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, c } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceInt8R(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]int8) - v, changed := fastpathTV.DecSliceInt8V(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceInt8V(*vp, !array, d); changed { *vp = v } } else { @@ -17417,13 +5896,11 @@ func (d *Decoder) fastpathDecSliceInt8R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceInt8X(vp *[]int8, d *Decoder) { - v, changed := f.DecSliceInt8V(*vp, true, d) - if changed { + if v, changed := f.DecSliceInt8V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8, changed bool) { - dd := d.d +func (fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -17437,7 +5914,6 @@ func (_ fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8 slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -17455,7 +5931,7 @@ func (_ fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8 } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) @@ -17465,7 +5941,6 @@ func (_ fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8 v = make([]int8, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -17479,10 +5954,10 @@ func (_ fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8 slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = 0 } else { - v[uint(j)] = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + v[uint(j)] = int8(chkOvf.IntV(d.d.DecodeInt64(), 8)) } } if canChange { @@ -17495,15 +5970,13 @@ func (_ fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8 } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceInt16R(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]int16) - v, changed := fastpathTV.DecSliceInt16V(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceInt16V(*vp, !array, d); changed { *vp = v } } else { @@ -17515,13 +5988,11 @@ func (d *Decoder) fastpathDecSliceInt16R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceInt16X(vp *[]int16, d *Decoder) { - v, changed := f.DecSliceInt16V(*vp, true, d) - if changed { + if v, changed := f.DecSliceInt16V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []int16, changed bool) { - dd := d.d +func (fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []int16, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -17535,7 +6006,6 @@ func (_ fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []in slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -17553,7 +6023,7 @@ func (_ fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []in } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2) @@ -17563,7 +6033,6 @@ func (_ fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []in v = make([]int16, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -17577,10 +6046,10 @@ func (_ fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []in slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = 0 } else { - v[uint(j)] = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + v[uint(j)] = int16(chkOvf.IntV(d.d.DecodeInt64(), 16)) } } if canChange { @@ -17593,15 +6062,13 @@ func (_ fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []in } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceInt32R(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]int32) - v, changed := fastpathTV.DecSliceInt32V(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceInt32V(*vp, !array, d); changed { *vp = v } } else { @@ -17613,13 +6080,11 @@ func (d *Decoder) fastpathDecSliceInt32R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceInt32X(vp *[]int32, d *Decoder) { - v, changed := f.DecSliceInt32V(*vp, true, d) - if changed { + if v, changed := f.DecSliceInt32V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []int32, changed bool) { - dd := d.d +func (fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []int32, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -17633,7 +6098,6 @@ func (_ fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []in slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -17651,7 +6115,7 @@ func (_ fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []in } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) @@ -17661,7 +6125,6 @@ func (_ fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []in v = make([]int32, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -17675,10 +6138,10 @@ func (_ fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []in slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = 0 } else { - v[uint(j)] = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + v[uint(j)] = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) } } if canChange { @@ -17691,15 +6154,13 @@ func (_ fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []in } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceInt64R(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]int64) - v, changed := fastpathTV.DecSliceInt64V(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceInt64V(*vp, !array, d); changed { *vp = v } } else { @@ -17711,13 +6172,11 @@ func (d *Decoder) fastpathDecSliceInt64R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceInt64X(vp *[]int64, d *Decoder) { - v, changed := f.DecSliceInt64V(*vp, true, d) - if changed { + if v, changed := f.DecSliceInt64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []int64, changed bool) { - dd := d.d +func (fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []int64, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -17731,7 +6190,6 @@ func (_ fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []in slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -17749,7 +6207,7 @@ func (_ fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []in } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) @@ -17759,7 +6217,6 @@ func (_ fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []in v = make([]int64, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -17773,10 +6230,10 @@ func (_ fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []in slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = 0 } else { - v[uint(j)] = dd.DecodeInt64() + v[uint(j)] = d.d.DecodeInt64() } } if canChange { @@ -17789,15 +6246,13 @@ func (_ fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []in } } slh.End() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecSliceBoolR(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]bool) - v, changed := fastpathTV.DecSliceBoolV(*vp, !array, d) - if changed { + if v, changed := fastpathTV.DecSliceBoolV(*vp, !array, d); changed { *vp = v } } else { @@ -17809,13 +6264,11 @@ func (d *Decoder) fastpathDecSliceBoolR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecSliceBoolX(vp *[]bool, d *Decoder) { - v, changed := f.DecSliceBoolV(*vp, true, d) - if changed { + if v, changed := f.DecSliceBoolV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool, changed bool) { - dd := d.d +func (fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool, changed bool) { slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -17829,7 +6282,6 @@ func (_ fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -17847,7 +6299,7 @@ func (_ fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) @@ -17857,7 +6309,6 @@ func (_ fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool v = make([]bool, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -17871,10 +6322,10 @@ func (_ fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = false } else { - v[uint(j)] = dd.DecodeBool() + v[uint(j)] = d.d.DecodeBool() } } if canChange { @@ -17887,1061 +6338,13 @@ func (_ fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool } } slh.End() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfIntfR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]interface{}) - v, changed := fastpathTV.DecMapIntfIntfV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfIntfV(rv2i(rv).(map[interface{}]interface{}), false, d) - } -} -func (f fastpathT) DecMapIntfIntfX(vp *map[interface{}]interface{}, d *Decoder) { - v, changed := f.DecMapIntfIntfV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfIntfV(v map[interface{}]interface{}, canChange bool, - d *Decoder) (_ map[interface{}]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 32) - v = make(map[interface{}]interface{}, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset - var mk interface{} - var mv interface{} - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfStringR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]string) - v, changed := fastpathTV.DecMapIntfStringV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfStringV(rv2i(rv).(map[interface{}]string), false, d) - } -} -func (f fastpathT) DecMapIntfStringX(vp *map[interface{}]string, d *Decoder) { - v, changed := f.DecMapIntfStringV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfStringV(v map[interface{}]string, canChange bool, - d *Decoder) (_ map[interface{}]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 32) - v = make(map[interface{}]string, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv string - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfUintR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]uint) - v, changed := fastpathTV.DecMapIntfUintV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfUintV(rv2i(rv).(map[interface{}]uint), false, d) - } -} -func (f fastpathT) DecMapIntfUintX(vp *map[interface{}]uint, d *Decoder) { - v, changed := f.DecMapIntfUintV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfUintV(v map[interface{}]uint, canChange bool, - d *Decoder) (_ map[interface{}]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[interface{}]uint, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfUint8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]uint8) - v, changed := fastpathTV.DecMapIntfUint8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfUint8V(rv2i(rv).(map[interface{}]uint8), false, d) - } -} -func (f fastpathT) DecMapIntfUint8X(vp *map[interface{}]uint8, d *Decoder) { - v, changed := f.DecMapIntfUint8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfUint8V(v map[interface{}]uint8, canChange bool, - d *Decoder) (_ map[interface{}]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) - v = make(map[interface{}]uint8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv uint8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfUint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]uint16) - v, changed := fastpathTV.DecMapIntfUint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfUint16V(rv2i(rv).(map[interface{}]uint16), false, d) - } -} -func (f fastpathT) DecMapIntfUint16X(vp *map[interface{}]uint16, d *Decoder) { - v, changed := f.DecMapIntfUint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfUint16V(v map[interface{}]uint16, canChange bool, - d *Decoder) (_ map[interface{}]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) - v = make(map[interface{}]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfUint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]uint32) - v, changed := fastpathTV.DecMapIntfUint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfUint32V(rv2i(rv).(map[interface{}]uint32), false, d) - } -} -func (f fastpathT) DecMapIntfUint32X(vp *map[interface{}]uint32, d *Decoder) { - v, changed := f.DecMapIntfUint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfUint32V(v map[interface{}]uint32, canChange bool, - d *Decoder) (_ map[interface{}]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) - v = make(map[interface{}]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfUint64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]uint64) - v, changed := fastpathTV.DecMapIntfUint64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfUint64V(rv2i(rv).(map[interface{}]uint64), false, d) - } -} -func (f fastpathT) DecMapIntfUint64X(vp *map[interface{}]uint64, d *Decoder) { - v, changed := f.DecMapIntfUint64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfUint64V(v map[interface{}]uint64, canChange bool, - d *Decoder) (_ map[interface{}]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[interface{}]uint64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv uint64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeUint64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfUintptrR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]uintptr) - v, changed := fastpathTV.DecMapIntfUintptrV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfUintptrV(rv2i(rv).(map[interface{}]uintptr), false, d) - } -} -func (f fastpathT) DecMapIntfUintptrX(vp *map[interface{}]uintptr, d *Decoder) { - v, changed := f.DecMapIntfUintptrV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfUintptrV(v map[interface{}]uintptr, canChange bool, - d *Decoder) (_ map[interface{}]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[interface{}]uintptr, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv uintptr - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfIntR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]int) - v, changed := fastpathTV.DecMapIntfIntV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfIntV(rv2i(rv).(map[interface{}]int), false, d) - } -} -func (f fastpathT) DecMapIntfIntX(vp *map[interface{}]int, d *Decoder) { - v, changed := f.DecMapIntfIntV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfIntV(v map[interface{}]int, canChange bool, - d *Decoder) (_ map[interface{}]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[interface{}]int, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv int - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfInt8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]int8) - v, changed := fastpathTV.DecMapIntfInt8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfInt8V(rv2i(rv).(map[interface{}]int8), false, d) - } -} -func (f fastpathT) DecMapIntfInt8X(vp *map[interface{}]int8, d *Decoder) { - v, changed := f.DecMapIntfInt8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfInt8V(v map[interface{}]int8, canChange bool, - d *Decoder) (_ map[interface{}]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) - v = make(map[interface{}]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfInt16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]int16) - v, changed := fastpathTV.DecMapIntfInt16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfInt16V(rv2i(rv).(map[interface{}]int16), false, d) - } -} -func (f fastpathT) DecMapIntfInt16X(vp *map[interface{}]int16, d *Decoder) { - v, changed := f.DecMapIntfInt16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfInt16V(v map[interface{}]int16, canChange bool, - d *Decoder) (_ map[interface{}]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) - v = make(map[interface{}]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfInt32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]int32) - v, changed := fastpathTV.DecMapIntfInt32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfInt32V(rv2i(rv).(map[interface{}]int32), false, d) - } -} -func (f fastpathT) DecMapIntfInt32X(vp *map[interface{}]int32, d *Decoder) { - v, changed := f.DecMapIntfInt32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfInt32V(v map[interface{}]int32, canChange bool, - d *Decoder) (_ map[interface{}]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) - v = make(map[interface{}]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfInt64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]int64) - v, changed := fastpathTV.DecMapIntfInt64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfInt64V(rv2i(rv).(map[interface{}]int64), false, d) - } -} -func (f fastpathT) DecMapIntfInt64X(vp *map[interface{}]int64, d *Decoder) { - v, changed := f.DecMapIntfInt64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfInt64V(v map[interface{}]int64, canChange bool, - d *Decoder) (_ map[interface{}]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[interface{}]int64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv int64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeInt64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfFloat32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]float32) - v, changed := fastpathTV.DecMapIntfFloat32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfFloat32V(rv2i(rv).(map[interface{}]float32), false, d) - } -} -func (f fastpathT) DecMapIntfFloat32X(vp *map[interface{}]float32, d *Decoder) { - v, changed := f.DecMapIntfFloat32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfFloat32V(v map[interface{}]float32, canChange bool, - d *Decoder) (_ map[interface{}]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) - v = make(map[interface{}]float32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfFloat64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]float64) - v, changed := fastpathTV.DecMapIntfFloat64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfFloat64V(rv2i(rv).(map[interface{}]float64), false, d) - } -} -func (f fastpathT) DecMapIntfFloat64X(vp *map[interface{}]float64, d *Decoder) { - v, changed := f.DecMapIntfFloat64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfFloat64V(v map[interface{}]float64, canChange bool, - d *Decoder) (_ map[interface{}]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[interface{}]float64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv float64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeFloat64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntfBoolR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[interface{}]bool) - v, changed := fastpathTV.DecMapIntfBoolV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntfBoolV(rv2i(rv).(map[interface{}]bool), false, d) - } -} -func (f fastpathT) DecMapIntfBoolX(vp *map[interface{}]bool, d *Decoder) { - v, changed := f.DecMapIntfBoolV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntfBoolV(v map[interface{}]bool, canChange bool, - d *Decoder) (_ map[interface{}]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) - v = make(map[interface{}]bool, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk interface{} - var mv bool - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() return v, changed } func (d *Decoder) fastpathDecMapStringIntfR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]interface{}) - v, changed := fastpathTV.DecMapStringIntfV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapStringIntfV(*vp, true, d); changed { *vp = v } } else { @@ -18949,38 +6352,30 @@ func (d *Decoder) fastpathDecMapStringIntfR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapStringIntfX(vp *map[string]interface{}, d *Decoder) { - v, changed := f.DecMapStringIntfV(*vp, true, d) - if changed { + if v, changed := f.DecMapStringIntfV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, canChange bool, +func (fastpathT) DecMapStringIntfV(v map[string]interface{}, canChange bool, d *Decoder) (_ map[string]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 32) - v = make(map[string]interface{}, xlen) + v = make(map[string]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 32)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk string var mv interface{} hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeString() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -18999,16 +6394,14 @@ func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, canChange bool, v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapStringStringR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]string) - v, changed := fastpathTV.DecMapStringStringV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapStringStringV(*vp, true, d); changed { *vp = v } } else { @@ -19016,37 +6409,29 @@ func (d *Decoder) fastpathDecMapStringStringR(f *codecFnInfo, rv reflect.Value) } } func (f fastpathT) DecMapStringStringX(vp *map[string]string, d *Decoder) { - v, changed := f.DecMapStringStringV(*vp, true, d) - if changed { + if v, changed := f.DecMapStringStringV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapStringStringV(v map[string]string, canChange bool, +func (fastpathT) DecMapStringStringV(v map[string]string, canChange bool, d *Decoder) (_ map[string]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 32) - v = make(map[string]string, xlen) + v = make(map[string]string, decInferLen(containerLen, d.h.MaxInitLen, 32)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk string var mv string hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeString() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -19055,21 +6440,76 @@ func (_ fastpathT) DecMapStringStringV(v map[string]string, canChange bool, } continue } - mv = dd.DecodeString() + mv = d.d.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() + return v, changed +} + +func (d *Decoder) fastpathDecMapStringBytesR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string][]byte) + if v, changed := fastpathTV.DecMapStringBytesV(*vp, true, d); changed { + *vp = v + } + } else { + fastpathTV.DecMapStringBytesV(rv2i(rv).(map[string][]byte), false, d) + } +} +func (f fastpathT) DecMapStringBytesX(vp *map[string][]byte, d *Decoder) { + if v, changed := f.DecMapStringBytesV(*vp, true, d); changed { + *vp = v + } +} +func (fastpathT) DecMapStringBytesV(v map[string][]byte, canChange bool, + d *Decoder) (_ map[string][]byte, changed bool) { + containerLen := d.mapStart() + if canChange && v == nil { + v = make(map[string][]byte, decInferLen(containerLen, d.h.MaxInitLen, 40)) + changed = true + } + if containerLen == 0 { + d.mapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset + var mk string + var mv []byte + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeString() + d.mapElemValue() + if d.d.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = nil + } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + mv = d.d.DecodeBytes(mv, false) + if v != nil { + v[mk] = mv + } + } + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapStringUintR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]uint) - v, changed := fastpathTV.DecMapStringUintV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapStringUintV(*vp, true, d); changed { *vp = v } } else { @@ -19077,37 +6517,29 @@ func (d *Decoder) fastpathDecMapStringUintR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapStringUintX(vp *map[string]uint, d *Decoder) { - v, changed := f.DecMapStringUintV(*vp, true, d) - if changed { + if v, changed := f.DecMapStringUintV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapStringUintV(v map[string]uint, canChange bool, +func (fastpathT) DecMapStringUintV(v map[string]uint, canChange bool, d *Decoder) (_ map[string]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[string]uint, xlen) + v = make(map[string]uint, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk string var mv uint hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeString() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -19116,21 +6548,19 @@ func (_ fastpathT) DecMapStringUintV(v map[string]uint, canChange bool, } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapStringUint8R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]uint8) - v, changed := fastpathTV.DecMapStringUint8V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapStringUint8V(*vp, true, d); changed { *vp = v } } else { @@ -19138,37 +6568,29 @@ func (d *Decoder) fastpathDecMapStringUint8R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapStringUint8X(vp *map[string]uint8, d *Decoder) { - v, changed := f.DecMapStringUint8V(*vp, true, d) - if changed { + if v, changed := f.DecMapStringUint8V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapStringUint8V(v map[string]uint8, canChange bool, +func (fastpathT) DecMapStringUint8V(v map[string]uint8, canChange bool, d *Decoder) (_ map[string]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) - v = make(map[string]uint8, xlen) + v = make(map[string]uint8, decInferLen(containerLen, d.h.MaxInitLen, 17)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk string var mv uint8 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeString() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -19177,143 +6599,19 @@ func (_ fastpathT) DecMapStringUint8V(v map[string]uint8, canChange bool, } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapStringUint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[string]uint16) - v, changed := fastpathTV.DecMapStringUint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapStringUint16V(rv2i(rv).(map[string]uint16), false, d) - } -} -func (f fastpathT) DecMapStringUint16X(vp *map[string]uint16, d *Decoder) { - v, changed := f.DecMapStringUint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapStringUint16V(v map[string]uint16, canChange bool, - d *Decoder) (_ map[string]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) - v = make(map[string]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk string - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapStringUint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[string]uint32) - v, changed := fastpathTV.DecMapStringUint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapStringUint32V(rv2i(rv).(map[string]uint32), false, d) - } -} -func (f fastpathT) DecMapStringUint32X(vp *map[string]uint32, d *Decoder) { - v, changed := f.DecMapStringUint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapStringUint32V(v map[string]uint32, canChange bool, - d *Decoder) (_ map[string]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) - v = make(map[string]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk string - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapStringUint64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]uint64) - v, changed := fastpathTV.DecMapStringUint64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapStringUint64V(*vp, true, d); changed { *vp = v } } else { @@ -19321,37 +6619,29 @@ func (d *Decoder) fastpathDecMapStringUint64R(f *codecFnInfo, rv reflect.Value) } } func (f fastpathT) DecMapStringUint64X(vp *map[string]uint64, d *Decoder) { - v, changed := f.DecMapStringUint64V(*vp, true, d) - if changed { + if v, changed := f.DecMapStringUint64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapStringUint64V(v map[string]uint64, canChange bool, +func (fastpathT) DecMapStringUint64V(v map[string]uint64, canChange bool, d *Decoder) (_ map[string]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[string]uint64, xlen) + v = make(map[string]uint64, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk string var mv uint64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeString() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -19360,21 +6650,19 @@ func (_ fastpathT) DecMapStringUint64V(v map[string]uint64, canChange bool, } continue } - mv = dd.DecodeUint64() + mv = d.d.DecodeUint64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapStringUintptrR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]uintptr) - v, changed := fastpathTV.DecMapStringUintptrV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapStringUintptrV(*vp, true, d); changed { *vp = v } } else { @@ -19382,37 +6670,29 @@ func (d *Decoder) fastpathDecMapStringUintptrR(f *codecFnInfo, rv reflect.Value) } } func (f fastpathT) DecMapStringUintptrX(vp *map[string]uintptr, d *Decoder) { - v, changed := f.DecMapStringUintptrV(*vp, true, d) - if changed { + if v, changed := f.DecMapStringUintptrV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapStringUintptrV(v map[string]uintptr, canChange bool, +func (fastpathT) DecMapStringUintptrV(v map[string]uintptr, canChange bool, d *Decoder) (_ map[string]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[string]uintptr, xlen) + v = make(map[string]uintptr, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk string var mv uintptr hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeString() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -19421,21 +6701,19 @@ func (_ fastpathT) DecMapStringUintptrV(v map[string]uintptr, canChange bool, } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapStringIntR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]int) - v, changed := fastpathTV.DecMapStringIntV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapStringIntV(*vp, true, d); changed { *vp = v } } else { @@ -19443,37 +6721,29 @@ func (d *Decoder) fastpathDecMapStringIntR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapStringIntX(vp *map[string]int, d *Decoder) { - v, changed := f.DecMapStringIntV(*vp, true, d) - if changed { + if v, changed := f.DecMapStringIntV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapStringIntV(v map[string]int, canChange bool, +func (fastpathT) DecMapStringIntV(v map[string]int, canChange bool, d *Decoder) (_ map[string]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[string]int, xlen) + v = make(map[string]int, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk string var mv int hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeString() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -19482,204 +6752,19 @@ func (_ fastpathT) DecMapStringIntV(v map[string]int, canChange bool, } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapStringInt8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[string]int8) - v, changed := fastpathTV.DecMapStringInt8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapStringInt8V(rv2i(rv).(map[string]int8), false, d) - } -} -func (f fastpathT) DecMapStringInt8X(vp *map[string]int8, d *Decoder) { - v, changed := f.DecMapStringInt8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapStringInt8V(v map[string]int8, canChange bool, - d *Decoder) (_ map[string]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) - v = make(map[string]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk string - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapStringInt16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[string]int16) - v, changed := fastpathTV.DecMapStringInt16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapStringInt16V(rv2i(rv).(map[string]int16), false, d) - } -} -func (f fastpathT) DecMapStringInt16X(vp *map[string]int16, d *Decoder) { - v, changed := f.DecMapStringInt16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapStringInt16V(v map[string]int16, canChange bool, - d *Decoder) (_ map[string]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) - v = make(map[string]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk string - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapStringInt32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[string]int32) - v, changed := fastpathTV.DecMapStringInt32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapStringInt32V(rv2i(rv).(map[string]int32), false, d) - } -} -func (f fastpathT) DecMapStringInt32X(vp *map[string]int32, d *Decoder) { - v, changed := f.DecMapStringInt32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapStringInt32V(v map[string]int32, canChange bool, - d *Decoder) (_ map[string]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) - v = make(map[string]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk string - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapStringInt64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]int64) - v, changed := fastpathTV.DecMapStringInt64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapStringInt64V(*vp, true, d); changed { *vp = v } } else { @@ -19687,37 +6772,29 @@ func (d *Decoder) fastpathDecMapStringInt64R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapStringInt64X(vp *map[string]int64, d *Decoder) { - v, changed := f.DecMapStringInt64V(*vp, true, d) - if changed { + if v, changed := f.DecMapStringInt64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapStringInt64V(v map[string]int64, canChange bool, +func (fastpathT) DecMapStringInt64V(v map[string]int64, canChange bool, d *Decoder) (_ map[string]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[string]int64, xlen) + v = make(map[string]int64, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk string var mv int64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeString() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -19726,21 +6803,19 @@ func (_ fastpathT) DecMapStringInt64V(v map[string]int64, canChange bool, } continue } - mv = dd.DecodeInt64() + mv = d.d.DecodeInt64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapStringFloat32R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]float32) - v, changed := fastpathTV.DecMapStringFloat32V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapStringFloat32V(*vp, true, d); changed { *vp = v } } else { @@ -19748,37 +6823,29 @@ func (d *Decoder) fastpathDecMapStringFloat32R(f *codecFnInfo, rv reflect.Value) } } func (f fastpathT) DecMapStringFloat32X(vp *map[string]float32, d *Decoder) { - v, changed := f.DecMapStringFloat32V(*vp, true, d) - if changed { + if v, changed := f.DecMapStringFloat32V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapStringFloat32V(v map[string]float32, canChange bool, +func (fastpathT) DecMapStringFloat32V(v map[string]float32, canChange bool, d *Decoder) (_ map[string]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) - v = make(map[string]float32, xlen) + v = make(map[string]float32, decInferLen(containerLen, d.h.MaxInitLen, 20)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk string var mv float32 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeString() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -19787,21 +6854,19 @@ func (_ fastpathT) DecMapStringFloat32V(v map[string]float32, canChange bool, } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(d.decodeFloat32()) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapStringFloat64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]float64) - v, changed := fastpathTV.DecMapStringFloat64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapStringFloat64V(*vp, true, d); changed { *vp = v } } else { @@ -19809,37 +6874,29 @@ func (d *Decoder) fastpathDecMapStringFloat64R(f *codecFnInfo, rv reflect.Value) } } func (f fastpathT) DecMapStringFloat64X(vp *map[string]float64, d *Decoder) { - v, changed := f.DecMapStringFloat64V(*vp, true, d) - if changed { + if v, changed := f.DecMapStringFloat64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapStringFloat64V(v map[string]float64, canChange bool, +func (fastpathT) DecMapStringFloat64V(v map[string]float64, canChange bool, d *Decoder) (_ map[string]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[string]float64, xlen) + v = make(map[string]float64, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk string var mv float64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeString() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -19848,21 +6905,19 @@ func (_ fastpathT) DecMapStringFloat64V(v map[string]float64, canChange bool, } continue } - mv = dd.DecodeFloat64() + mv = d.d.DecodeFloat64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapStringBoolR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]bool) - v, changed := fastpathTV.DecMapStringBoolV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapStringBoolV(*vp, true, d); changed { *vp = v } } else { @@ -19870,37 +6925,29 @@ func (d *Decoder) fastpathDecMapStringBoolR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapStringBoolX(vp *map[string]bool, d *Decoder) { - v, changed := f.DecMapStringBoolV(*vp, true, d) - if changed { + if v, changed := f.DecMapStringBoolV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapStringBoolV(v map[string]bool, canChange bool, +func (fastpathT) DecMapStringBoolV(v map[string]bool, canChange bool, d *Decoder) (_ map[string]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) - v = make(map[string]bool, xlen) + v = make(map[string]bool, decInferLen(containerLen, d.h.MaxInitLen, 17)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk string var mv bool hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeString() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeString() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -19909,1985 +6956,19 @@ func (_ fastpathT) DecMapStringBoolV(v map[string]bool, canChange bool, } continue } - mv = dd.DecodeBool() + mv = d.d.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32IntfR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]interface{}) - v, changed := fastpathTV.DecMapFloat32IntfV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32IntfV(rv2i(rv).(map[float32]interface{}), false, d) - } -} -func (f fastpathT) DecMapFloat32IntfX(vp *map[float32]interface{}, d *Decoder) { - v, changed := f.DecMapFloat32IntfV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32IntfV(v map[float32]interface{}, canChange bool, - d *Decoder) (_ map[float32]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) - v = make(map[float32]interface{}, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset - var mk float32 - var mv interface{} - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32StringR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]string) - v, changed := fastpathTV.DecMapFloat32StringV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32StringV(rv2i(rv).(map[float32]string), false, d) - } -} -func (f fastpathT) DecMapFloat32StringX(vp *map[float32]string, d *Decoder) { - v, changed := f.DecMapFloat32StringV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32StringV(v map[float32]string, canChange bool, - d *Decoder) (_ map[float32]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) - v = make(map[float32]string, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv string - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32UintR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]uint) - v, changed := fastpathTV.DecMapFloat32UintV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32UintV(rv2i(rv).(map[float32]uint), false, d) - } -} -func (f fastpathT) DecMapFloat32UintX(vp *map[float32]uint, d *Decoder) { - v, changed := f.DecMapFloat32UintV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32UintV(v map[float32]uint, canChange bool, - d *Decoder) (_ map[float32]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[float32]uint, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32Uint8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]uint8) - v, changed := fastpathTV.DecMapFloat32Uint8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32Uint8V(rv2i(rv).(map[float32]uint8), false, d) - } -} -func (f fastpathT) DecMapFloat32Uint8X(vp *map[float32]uint8, d *Decoder) { - v, changed := f.DecMapFloat32Uint8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32Uint8V(v map[float32]uint8, canChange bool, - d *Decoder) (_ map[float32]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[float32]uint8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv uint8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32Uint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]uint16) - v, changed := fastpathTV.DecMapFloat32Uint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32Uint16V(rv2i(rv).(map[float32]uint16), false, d) - } -} -func (f fastpathT) DecMapFloat32Uint16X(vp *map[float32]uint16, d *Decoder) { - v, changed := f.DecMapFloat32Uint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32Uint16V(v map[float32]uint16, canChange bool, - d *Decoder) (_ map[float32]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) - v = make(map[float32]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32Uint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]uint32) - v, changed := fastpathTV.DecMapFloat32Uint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32Uint32V(rv2i(rv).(map[float32]uint32), false, d) - } -} -func (f fastpathT) DecMapFloat32Uint32X(vp *map[float32]uint32, d *Decoder) { - v, changed := f.DecMapFloat32Uint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32Uint32V(v map[float32]uint32, canChange bool, - d *Decoder) (_ map[float32]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) - v = make(map[float32]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32Uint64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]uint64) - v, changed := fastpathTV.DecMapFloat32Uint64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32Uint64V(rv2i(rv).(map[float32]uint64), false, d) - } -} -func (f fastpathT) DecMapFloat32Uint64X(vp *map[float32]uint64, d *Decoder) { - v, changed := f.DecMapFloat32Uint64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32Uint64V(v map[float32]uint64, canChange bool, - d *Decoder) (_ map[float32]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[float32]uint64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv uint64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeUint64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32UintptrR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]uintptr) - v, changed := fastpathTV.DecMapFloat32UintptrV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32UintptrV(rv2i(rv).(map[float32]uintptr), false, d) - } -} -func (f fastpathT) DecMapFloat32UintptrX(vp *map[float32]uintptr, d *Decoder) { - v, changed := f.DecMapFloat32UintptrV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32UintptrV(v map[float32]uintptr, canChange bool, - d *Decoder) (_ map[float32]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[float32]uintptr, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv uintptr - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32IntR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]int) - v, changed := fastpathTV.DecMapFloat32IntV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32IntV(rv2i(rv).(map[float32]int), false, d) - } -} -func (f fastpathT) DecMapFloat32IntX(vp *map[float32]int, d *Decoder) { - v, changed := f.DecMapFloat32IntV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32IntV(v map[float32]int, canChange bool, - d *Decoder) (_ map[float32]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[float32]int, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv int - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32Int8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]int8) - v, changed := fastpathTV.DecMapFloat32Int8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32Int8V(rv2i(rv).(map[float32]int8), false, d) - } -} -func (f fastpathT) DecMapFloat32Int8X(vp *map[float32]int8, d *Decoder) { - v, changed := f.DecMapFloat32Int8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32Int8V(v map[float32]int8, canChange bool, - d *Decoder) (_ map[float32]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[float32]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32Int16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]int16) - v, changed := fastpathTV.DecMapFloat32Int16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32Int16V(rv2i(rv).(map[float32]int16), false, d) - } -} -func (f fastpathT) DecMapFloat32Int16X(vp *map[float32]int16, d *Decoder) { - v, changed := f.DecMapFloat32Int16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32Int16V(v map[float32]int16, canChange bool, - d *Decoder) (_ map[float32]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) - v = make(map[float32]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32Int32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]int32) - v, changed := fastpathTV.DecMapFloat32Int32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32Int32V(rv2i(rv).(map[float32]int32), false, d) - } -} -func (f fastpathT) DecMapFloat32Int32X(vp *map[float32]int32, d *Decoder) { - v, changed := f.DecMapFloat32Int32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32Int32V(v map[float32]int32, canChange bool, - d *Decoder) (_ map[float32]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) - v = make(map[float32]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32Int64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]int64) - v, changed := fastpathTV.DecMapFloat32Int64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32Int64V(rv2i(rv).(map[float32]int64), false, d) - } -} -func (f fastpathT) DecMapFloat32Int64X(vp *map[float32]int64, d *Decoder) { - v, changed := f.DecMapFloat32Int64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32Int64V(v map[float32]int64, canChange bool, - d *Decoder) (_ map[float32]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[float32]int64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv int64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeInt64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32Float32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]float32) - v, changed := fastpathTV.DecMapFloat32Float32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32Float32V(rv2i(rv).(map[float32]float32), false, d) - } -} -func (f fastpathT) DecMapFloat32Float32X(vp *map[float32]float32, d *Decoder) { - v, changed := f.DecMapFloat32Float32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32Float32V(v map[float32]float32, canChange bool, - d *Decoder) (_ map[float32]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) - v = make(map[float32]float32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32Float64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]float64) - v, changed := fastpathTV.DecMapFloat32Float64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32Float64V(rv2i(rv).(map[float32]float64), false, d) - } -} -func (f fastpathT) DecMapFloat32Float64X(vp *map[float32]float64, d *Decoder) { - v, changed := f.DecMapFloat32Float64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32Float64V(v map[float32]float64, canChange bool, - d *Decoder) (_ map[float32]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[float32]float64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv float64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeFloat64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat32BoolR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float32]bool) - v, changed := fastpathTV.DecMapFloat32BoolV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat32BoolV(rv2i(rv).(map[float32]bool), false, d) - } -} -func (f fastpathT) DecMapFloat32BoolX(vp *map[float32]bool, d *Decoder) { - v, changed := f.DecMapFloat32BoolV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat32BoolV(v map[float32]bool, canChange bool, - d *Decoder) (_ map[float32]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[float32]bool, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float32 - var mv bool - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64IntfR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]interface{}) - v, changed := fastpathTV.DecMapFloat64IntfV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64IntfV(rv2i(rv).(map[float64]interface{}), false, d) - } -} -func (f fastpathT) DecMapFloat64IntfX(vp *map[float64]interface{}, d *Decoder) { - v, changed := f.DecMapFloat64IntfV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64IntfV(v map[float64]interface{}, canChange bool, - d *Decoder) (_ map[float64]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[float64]interface{}, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset - var mk float64 - var mv interface{} - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64StringR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]string) - v, changed := fastpathTV.DecMapFloat64StringV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64StringV(rv2i(rv).(map[float64]string), false, d) - } -} -func (f fastpathT) DecMapFloat64StringX(vp *map[float64]string, d *Decoder) { - v, changed := f.DecMapFloat64StringV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64StringV(v map[float64]string, canChange bool, - d *Decoder) (_ map[float64]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[float64]string, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv string - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64UintR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]uint) - v, changed := fastpathTV.DecMapFloat64UintV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64UintV(rv2i(rv).(map[float64]uint), false, d) - } -} -func (f fastpathT) DecMapFloat64UintX(vp *map[float64]uint, d *Decoder) { - v, changed := f.DecMapFloat64UintV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64UintV(v map[float64]uint, canChange bool, - d *Decoder) (_ map[float64]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[float64]uint, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64Uint8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]uint8) - v, changed := fastpathTV.DecMapFloat64Uint8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64Uint8V(rv2i(rv).(map[float64]uint8), false, d) - } -} -func (f fastpathT) DecMapFloat64Uint8X(vp *map[float64]uint8, d *Decoder) { - v, changed := f.DecMapFloat64Uint8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64Uint8V(v map[float64]uint8, canChange bool, - d *Decoder) (_ map[float64]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[float64]uint8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv uint8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64Uint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]uint16) - v, changed := fastpathTV.DecMapFloat64Uint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64Uint16V(rv2i(rv).(map[float64]uint16), false, d) - } -} -func (f fastpathT) DecMapFloat64Uint16X(vp *map[float64]uint16, d *Decoder) { - v, changed := f.DecMapFloat64Uint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64Uint16V(v map[float64]uint16, canChange bool, - d *Decoder) (_ map[float64]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[float64]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64Uint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]uint32) - v, changed := fastpathTV.DecMapFloat64Uint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64Uint32V(rv2i(rv).(map[float64]uint32), false, d) - } -} -func (f fastpathT) DecMapFloat64Uint32X(vp *map[float64]uint32, d *Decoder) { - v, changed := f.DecMapFloat64Uint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64Uint32V(v map[float64]uint32, canChange bool, - d *Decoder) (_ map[float64]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[float64]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64Uint64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]uint64) - v, changed := fastpathTV.DecMapFloat64Uint64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64Uint64V(rv2i(rv).(map[float64]uint64), false, d) - } -} -func (f fastpathT) DecMapFloat64Uint64X(vp *map[float64]uint64, d *Decoder) { - v, changed := f.DecMapFloat64Uint64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64Uint64V(v map[float64]uint64, canChange bool, - d *Decoder) (_ map[float64]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[float64]uint64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv uint64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeUint64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64UintptrR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]uintptr) - v, changed := fastpathTV.DecMapFloat64UintptrV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64UintptrV(rv2i(rv).(map[float64]uintptr), false, d) - } -} -func (f fastpathT) DecMapFloat64UintptrX(vp *map[float64]uintptr, d *Decoder) { - v, changed := f.DecMapFloat64UintptrV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64UintptrV(v map[float64]uintptr, canChange bool, - d *Decoder) (_ map[float64]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[float64]uintptr, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv uintptr - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64IntR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]int) - v, changed := fastpathTV.DecMapFloat64IntV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64IntV(rv2i(rv).(map[float64]int), false, d) - } -} -func (f fastpathT) DecMapFloat64IntX(vp *map[float64]int, d *Decoder) { - v, changed := f.DecMapFloat64IntV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64IntV(v map[float64]int, canChange bool, - d *Decoder) (_ map[float64]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[float64]int, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv int - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64Int8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]int8) - v, changed := fastpathTV.DecMapFloat64Int8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64Int8V(rv2i(rv).(map[float64]int8), false, d) - } -} -func (f fastpathT) DecMapFloat64Int8X(vp *map[float64]int8, d *Decoder) { - v, changed := f.DecMapFloat64Int8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64Int8V(v map[float64]int8, canChange bool, - d *Decoder) (_ map[float64]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[float64]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64Int16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]int16) - v, changed := fastpathTV.DecMapFloat64Int16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64Int16V(rv2i(rv).(map[float64]int16), false, d) - } -} -func (f fastpathT) DecMapFloat64Int16X(vp *map[float64]int16, d *Decoder) { - v, changed := f.DecMapFloat64Int16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64Int16V(v map[float64]int16, canChange bool, - d *Decoder) (_ map[float64]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[float64]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64Int32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]int32) - v, changed := fastpathTV.DecMapFloat64Int32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64Int32V(rv2i(rv).(map[float64]int32), false, d) - } -} -func (f fastpathT) DecMapFloat64Int32X(vp *map[float64]int32, d *Decoder) { - v, changed := f.DecMapFloat64Int32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64Int32V(v map[float64]int32, canChange bool, - d *Decoder) (_ map[float64]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[float64]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64Int64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]int64) - v, changed := fastpathTV.DecMapFloat64Int64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64Int64V(rv2i(rv).(map[float64]int64), false, d) - } -} -func (f fastpathT) DecMapFloat64Int64X(vp *map[float64]int64, d *Decoder) { - v, changed := f.DecMapFloat64Int64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64Int64V(v map[float64]int64, canChange bool, - d *Decoder) (_ map[float64]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[float64]int64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv int64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeInt64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64Float32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]float32) - v, changed := fastpathTV.DecMapFloat64Float32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64Float32V(rv2i(rv).(map[float64]float32), false, d) - } -} -func (f fastpathT) DecMapFloat64Float32X(vp *map[float64]float32, d *Decoder) { - v, changed := f.DecMapFloat64Float32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64Float32V(v map[float64]float32, canChange bool, - d *Decoder) (_ map[float64]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[float64]float32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64Float64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]float64) - v, changed := fastpathTV.DecMapFloat64Float64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64Float64V(rv2i(rv).(map[float64]float64), false, d) - } -} -func (f fastpathT) DecMapFloat64Float64X(vp *map[float64]float64, d *Decoder) { - v, changed := f.DecMapFloat64Float64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64Float64V(v map[float64]float64, canChange bool, - d *Decoder) (_ map[float64]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[float64]float64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv float64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeFloat64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapFloat64BoolR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[float64]bool) - v, changed := fastpathTV.DecMapFloat64BoolV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapFloat64BoolV(rv2i(rv).(map[float64]bool), false, d) - } -} -func (f fastpathT) DecMapFloat64BoolX(vp *map[float64]bool, d *Decoder) { - v, changed := f.DecMapFloat64BoolV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapFloat64BoolV(v map[float64]bool, canChange bool, - d *Decoder) (_ map[float64]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[float64]bool, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk float64 - var mv bool - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeFloat64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUintIntfR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]interface{}) - v, changed := fastpathTV.DecMapUintIntfV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUintIntfV(*vp, true, d); changed { *vp = v } } else { @@ -21895,38 +6976,30 @@ func (d *Decoder) fastpathDecMapUintIntfR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUintIntfX(vp *map[uint]interface{}, d *Decoder) { - v, changed := f.DecMapUintIntfV(*vp, true, d) - if changed { + if v, changed := f.DecMapUintIntfV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, canChange bool, +func (fastpathT) DecMapUintIntfV(v map[uint]interface{}, canChange bool, d *Decoder) (_ map[uint]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[uint]interface{}, xlen) + v = make(map[uint]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk uint var mv interface{} hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -21945,16 +7018,14 @@ func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, canChange bool, v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUintStringR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]string) - v, changed := fastpathTV.DecMapUintStringV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUintStringV(*vp, true, d); changed { *vp = v } } else { @@ -21962,37 +7033,29 @@ func (d *Decoder) fastpathDecMapUintStringR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUintStringX(vp *map[uint]string, d *Decoder) { - v, changed := f.DecMapUintStringV(*vp, true, d) - if changed { + if v, changed := f.DecMapUintStringV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUintStringV(v map[uint]string, canChange bool, +func (fastpathT) DecMapUintStringV(v map[uint]string, canChange bool, d *Decoder) (_ map[uint]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[uint]string, xlen) + v = make(map[uint]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint var mv string hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -22001,21 +7064,76 @@ func (_ fastpathT) DecMapUintStringV(v map[uint]string, canChange bool, } continue } - mv = dd.DecodeString() + mv = d.d.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() + return v, changed +} + +func (d *Decoder) fastpathDecMapUintBytesR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint][]byte) + if v, changed := fastpathTV.DecMapUintBytesV(*vp, true, d); changed { + *vp = v + } + } else { + fastpathTV.DecMapUintBytesV(rv2i(rv).(map[uint][]byte), false, d) + } +} +func (f fastpathT) DecMapUintBytesX(vp *map[uint][]byte, d *Decoder) { + if v, changed := f.DecMapUintBytesV(*vp, true, d); changed { + *vp = v + } +} +func (fastpathT) DecMapUintBytesV(v map[uint][]byte, canChange bool, + d *Decoder) (_ map[uint][]byte, changed bool) { + containerLen := d.mapStart() + if canChange && v == nil { + v = make(map[uint][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) + changed = true + } + if containerLen == 0 { + d.mapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset + var mk uint + var mv []byte + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = nil + } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + mv = d.d.DecodeBytes(mv, false) + if v != nil { + v[mk] = mv + } + } + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUintUintR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]uint) - v, changed := fastpathTV.DecMapUintUintV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUintUintV(*vp, true, d); changed { *vp = v } } else { @@ -22023,37 +7141,29 @@ func (d *Decoder) fastpathDecMapUintUintR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUintUintX(vp *map[uint]uint, d *Decoder) { - v, changed := f.DecMapUintUintV(*vp, true, d) - if changed { + if v, changed := f.DecMapUintUintV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUintUintV(v map[uint]uint, canChange bool, +func (fastpathT) DecMapUintUintV(v map[uint]uint, canChange bool, d *Decoder) (_ map[uint]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uint]uint, xlen) + v = make(map[uint]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint var mv uint hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -22062,21 +7172,19 @@ func (_ fastpathT) DecMapUintUintV(v map[uint]uint, canChange bool, } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUintUint8R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]uint8) - v, changed := fastpathTV.DecMapUintUint8V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUintUint8V(*vp, true, d); changed { *vp = v } } else { @@ -22084,37 +7192,29 @@ func (d *Decoder) fastpathDecMapUintUint8R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUintUint8X(vp *map[uint]uint8, d *Decoder) { - v, changed := f.DecMapUintUint8V(*vp, true, d) - if changed { + if v, changed := f.DecMapUintUint8V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUintUint8V(v map[uint]uint8, canChange bool, +func (fastpathT) DecMapUintUint8V(v map[uint]uint8, canChange bool, d *Decoder) (_ map[uint]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uint]uint8, xlen) + v = make(map[uint]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint var mv uint8 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -22123,143 +7223,19 @@ func (_ fastpathT) DecMapUintUint8V(v map[uint]uint8, canChange bool, } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintUint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint]uint16) - v, changed := fastpathTV.DecMapUintUint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintUint16V(rv2i(rv).(map[uint]uint16), false, d) - } -} -func (f fastpathT) DecMapUintUint16X(vp *map[uint]uint16, d *Decoder) { - v, changed := f.DecMapUintUint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintUint16V(v map[uint]uint16, canChange bool, - d *Decoder) (_ map[uint]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[uint]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintUint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint]uint32) - v, changed := fastpathTV.DecMapUintUint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintUint32V(rv2i(rv).(map[uint]uint32), false, d) - } -} -func (f fastpathT) DecMapUintUint32X(vp *map[uint]uint32, d *Decoder) { - v, changed := f.DecMapUintUint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintUint32V(v map[uint]uint32, canChange bool, - d *Decoder) (_ map[uint]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uint]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUintUint64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]uint64) - v, changed := fastpathTV.DecMapUintUint64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUintUint64V(*vp, true, d); changed { *vp = v } } else { @@ -22267,37 +7243,29 @@ func (d *Decoder) fastpathDecMapUintUint64R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUintUint64X(vp *map[uint]uint64, d *Decoder) { - v, changed := f.DecMapUintUint64V(*vp, true, d) - if changed { + if v, changed := f.DecMapUintUint64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUintUint64V(v map[uint]uint64, canChange bool, +func (fastpathT) DecMapUintUint64V(v map[uint]uint64, canChange bool, d *Decoder) (_ map[uint]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uint]uint64, xlen) + v = make(map[uint]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint var mv uint64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -22306,21 +7274,19 @@ func (_ fastpathT) DecMapUintUint64V(v map[uint]uint64, canChange bool, } continue } - mv = dd.DecodeUint64() + mv = d.d.DecodeUint64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUintUintptrR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]uintptr) - v, changed := fastpathTV.DecMapUintUintptrV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUintUintptrV(*vp, true, d); changed { *vp = v } } else { @@ -22328,37 +7294,29 @@ func (d *Decoder) fastpathDecMapUintUintptrR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUintUintptrX(vp *map[uint]uintptr, d *Decoder) { - v, changed := f.DecMapUintUintptrV(*vp, true, d) - if changed { + if v, changed := f.DecMapUintUintptrV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUintUintptrV(v map[uint]uintptr, canChange bool, +func (fastpathT) DecMapUintUintptrV(v map[uint]uintptr, canChange bool, d *Decoder) (_ map[uint]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uint]uintptr, xlen) + v = make(map[uint]uintptr, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint var mv uintptr hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -22367,21 +7325,19 @@ func (_ fastpathT) DecMapUintUintptrV(v map[uint]uintptr, canChange bool, } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUintIntR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]int) - v, changed := fastpathTV.DecMapUintIntV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUintIntV(*vp, true, d); changed { *vp = v } } else { @@ -22389,37 +7345,29 @@ func (d *Decoder) fastpathDecMapUintIntR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUintIntX(vp *map[uint]int, d *Decoder) { - v, changed := f.DecMapUintIntV(*vp, true, d) - if changed { + if v, changed := f.DecMapUintIntV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUintIntV(v map[uint]int, canChange bool, +func (fastpathT) DecMapUintIntV(v map[uint]int, canChange bool, d *Decoder) (_ map[uint]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uint]int, xlen) + v = make(map[uint]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint var mv int hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -22428,204 +7376,19 @@ func (_ fastpathT) DecMapUintIntV(v map[uint]int, canChange bool, } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintInt8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint]int8) - v, changed := fastpathTV.DecMapUintInt8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintInt8V(rv2i(rv).(map[uint]int8), false, d) - } -} -func (f fastpathT) DecMapUintInt8X(vp *map[uint]int8, d *Decoder) { - v, changed := f.DecMapUintInt8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintInt8V(v map[uint]int8, canChange bool, - d *Decoder) (_ map[uint]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uint]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintInt16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint]int16) - v, changed := fastpathTV.DecMapUintInt16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintInt16V(rv2i(rv).(map[uint]int16), false, d) - } -} -func (f fastpathT) DecMapUintInt16X(vp *map[uint]int16, d *Decoder) { - v, changed := f.DecMapUintInt16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintInt16V(v map[uint]int16, canChange bool, - d *Decoder) (_ map[uint]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[uint]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintInt32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint]int32) - v, changed := fastpathTV.DecMapUintInt32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintInt32V(rv2i(rv).(map[uint]int32), false, d) - } -} -func (f fastpathT) DecMapUintInt32X(vp *map[uint]int32, d *Decoder) { - v, changed := f.DecMapUintInt32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintInt32V(v map[uint]int32, canChange bool, - d *Decoder) (_ map[uint]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uint]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUintInt64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]int64) - v, changed := fastpathTV.DecMapUintInt64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUintInt64V(*vp, true, d); changed { *vp = v } } else { @@ -22633,37 +7396,29 @@ func (d *Decoder) fastpathDecMapUintInt64R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUintInt64X(vp *map[uint]int64, d *Decoder) { - v, changed := f.DecMapUintInt64V(*vp, true, d) - if changed { + if v, changed := f.DecMapUintInt64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUintInt64V(v map[uint]int64, canChange bool, +func (fastpathT) DecMapUintInt64V(v map[uint]int64, canChange bool, d *Decoder) (_ map[uint]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uint]int64, xlen) + v = make(map[uint]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint var mv int64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -22672,21 +7427,19 @@ func (_ fastpathT) DecMapUintInt64V(v map[uint]int64, canChange bool, } continue } - mv = dd.DecodeInt64() + mv = d.d.DecodeInt64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUintFloat32R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]float32) - v, changed := fastpathTV.DecMapUintFloat32V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUintFloat32V(*vp, true, d); changed { *vp = v } } else { @@ -22694,37 +7447,29 @@ func (d *Decoder) fastpathDecMapUintFloat32R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUintFloat32X(vp *map[uint]float32, d *Decoder) { - v, changed := f.DecMapUintFloat32V(*vp, true, d) - if changed { + if v, changed := f.DecMapUintFloat32V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUintFloat32V(v map[uint]float32, canChange bool, +func (fastpathT) DecMapUintFloat32V(v map[uint]float32, canChange bool, d *Decoder) (_ map[uint]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uint]float32, xlen) + v = make(map[uint]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint var mv float32 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -22733,21 +7478,19 @@ func (_ fastpathT) DecMapUintFloat32V(v map[uint]float32, canChange bool, } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(d.decodeFloat32()) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUintFloat64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]float64) - v, changed := fastpathTV.DecMapUintFloat64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUintFloat64V(*vp, true, d); changed { *vp = v } } else { @@ -22755,37 +7498,29 @@ func (d *Decoder) fastpathDecMapUintFloat64R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUintFloat64X(vp *map[uint]float64, d *Decoder) { - v, changed := f.DecMapUintFloat64V(*vp, true, d) - if changed { + if v, changed := f.DecMapUintFloat64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUintFloat64V(v map[uint]float64, canChange bool, +func (fastpathT) DecMapUintFloat64V(v map[uint]float64, canChange bool, d *Decoder) (_ map[uint]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uint]float64, xlen) + v = make(map[uint]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint var mv float64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -22794,21 +7529,19 @@ func (_ fastpathT) DecMapUintFloat64V(v map[uint]float64, canChange bool, } continue } - mv = dd.DecodeFloat64() + mv = d.d.DecodeFloat64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUintBoolR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]bool) - v, changed := fastpathTV.DecMapUintBoolV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUintBoolV(*vp, true, d); changed { *vp = v } } else { @@ -22816,37 +7549,29 @@ func (d *Decoder) fastpathDecMapUintBoolR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUintBoolX(vp *map[uint]bool, d *Decoder) { - v, changed := f.DecMapUintBoolV(*vp, true, d) - if changed { + if v, changed := f.DecMapUintBoolV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUintBoolV(v map[uint]bool, canChange bool, +func (fastpathT) DecMapUintBoolV(v map[uint]bool, canChange bool, d *Decoder) (_ map[uint]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uint]bool, xlen) + v = make(map[uint]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint var mv bool hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -22855,21 +7580,19 @@ func (_ fastpathT) DecMapUintBoolV(v map[uint]bool, canChange bool, } continue } - mv = dd.DecodeBool() + mv = d.d.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint8IntfR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]interface{}) - v, changed := fastpathTV.DecMapUint8IntfV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint8IntfV(*vp, true, d); changed { *vp = v } } else { @@ -22877,38 +7600,30 @@ func (d *Decoder) fastpathDecMapUint8IntfR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint8IntfX(vp *map[uint8]interface{}, d *Decoder) { - v, changed := f.DecMapUint8IntfV(*vp, true, d) - if changed { + if v, changed := f.DecMapUint8IntfV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, canChange bool, +func (fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, canChange bool, d *Decoder) (_ map[uint8]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) - v = make(map[uint8]interface{}, xlen) + v = make(map[uint8]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 17)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk uint8 var mv interface{} hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -22927,16 +7642,14 @@ func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, canChange bool, v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint8StringR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]string) - v, changed := fastpathTV.DecMapUint8StringV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint8StringV(*vp, true, d); changed { *vp = v } } else { @@ -22944,37 +7657,29 @@ func (d *Decoder) fastpathDecMapUint8StringR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint8StringX(vp *map[uint8]string, d *Decoder) { - v, changed := f.DecMapUint8StringV(*vp, true, d) - if changed { + if v, changed := f.DecMapUint8StringV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint8StringV(v map[uint8]string, canChange bool, +func (fastpathT) DecMapUint8StringV(v map[uint8]string, canChange bool, d *Decoder) (_ map[uint8]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) - v = make(map[uint8]string, xlen) + v = make(map[uint8]string, decInferLen(containerLen, d.h.MaxInitLen, 17)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint8 var mv string hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -22983,21 +7688,76 @@ func (_ fastpathT) DecMapUint8StringV(v map[uint8]string, canChange bool, } continue } - mv = dd.DecodeString() + mv = d.d.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() + return v, changed +} + +func (d *Decoder) fastpathDecMapUint8BytesR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8][]byte) + if v, changed := fastpathTV.DecMapUint8BytesV(*vp, true, d); changed { + *vp = v + } + } else { + fastpathTV.DecMapUint8BytesV(rv2i(rv).(map[uint8][]byte), false, d) + } +} +func (f fastpathT) DecMapUint8BytesX(vp *map[uint8][]byte, d *Decoder) { + if v, changed := f.DecMapUint8BytesV(*vp, true, d); changed { + *vp = v + } +} +func (fastpathT) DecMapUint8BytesV(v map[uint8][]byte, canChange bool, + d *Decoder) (_ map[uint8][]byte, changed bool) { + containerLen := d.mapStart() + if canChange && v == nil { + v = make(map[uint8][]byte, decInferLen(containerLen, d.h.MaxInitLen, 25)) + changed = true + } + if containerLen == 0 { + d.mapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset + var mk uint8 + var mv []byte + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = nil + } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + mv = d.d.DecodeBytes(mv, false) + if v != nil { + v[mk] = mv + } + } + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint8UintR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]uint) - v, changed := fastpathTV.DecMapUint8UintV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint8UintV(*vp, true, d); changed { *vp = v } } else { @@ -23005,37 +7765,29 @@ func (d *Decoder) fastpathDecMapUint8UintR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint8UintX(vp *map[uint8]uint, d *Decoder) { - v, changed := f.DecMapUint8UintV(*vp, true, d) - if changed { + if v, changed := f.DecMapUint8UintV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint8UintV(v map[uint8]uint, canChange bool, +func (fastpathT) DecMapUint8UintV(v map[uint8]uint, canChange bool, d *Decoder) (_ map[uint8]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uint8]uint, xlen) + v = make(map[uint8]uint, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint8 var mv uint hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -23044,21 +7796,19 @@ func (_ fastpathT) DecMapUint8UintV(v map[uint8]uint, canChange bool, } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]uint8) - v, changed := fastpathTV.DecMapUint8Uint8V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint8Uint8V(*vp, true, d); changed { *vp = v } } else { @@ -23066,37 +7816,29 @@ func (d *Decoder) fastpathDecMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint8Uint8X(vp *map[uint8]uint8, d *Decoder) { - v, changed := f.DecMapUint8Uint8V(*vp, true, d) - if changed { + if v, changed := f.DecMapUint8Uint8V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, canChange bool, +func (fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, canChange bool, d *Decoder) (_ map[uint8]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) - v = make(map[uint8]uint8, xlen) + v = make(map[uint8]uint8, decInferLen(containerLen, d.h.MaxInitLen, 2)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint8 var mv uint8 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -23105,143 +7847,19 @@ func (_ fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, canChange bool, } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint8Uint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint8]uint16) - v, changed := fastpathTV.DecMapUint8Uint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint8Uint16V(rv2i(rv).(map[uint8]uint16), false, d) - } -} -func (f fastpathT) DecMapUint8Uint16X(vp *map[uint8]uint16, d *Decoder) { - v, changed := f.DecMapUint8Uint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint8Uint16V(v map[uint8]uint16, canChange bool, - d *Decoder) (_ map[uint8]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) - v = make(map[uint8]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint8 - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint8Uint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint8]uint32) - v, changed := fastpathTV.DecMapUint8Uint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint8Uint32V(rv2i(rv).(map[uint8]uint32), false, d) - } -} -func (f fastpathT) DecMapUint8Uint32X(vp *map[uint8]uint32, d *Decoder) { - v, changed := f.DecMapUint8Uint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint8Uint32V(v map[uint8]uint32, canChange bool, - d *Decoder) (_ map[uint8]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[uint8]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint8 - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]uint64) - v, changed := fastpathTV.DecMapUint8Uint64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint8Uint64V(*vp, true, d); changed { *vp = v } } else { @@ -23249,37 +7867,29 @@ func (d *Decoder) fastpathDecMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint8Uint64X(vp *map[uint8]uint64, d *Decoder) { - v, changed := f.DecMapUint8Uint64V(*vp, true, d) - if changed { + if v, changed := f.DecMapUint8Uint64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, canChange bool, +func (fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, canChange bool, d *Decoder) (_ map[uint8]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uint8]uint64, xlen) + v = make(map[uint8]uint64, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint8 var mv uint64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -23288,21 +7898,19 @@ func (_ fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, canChange bool, } continue } - mv = dd.DecodeUint64() + mv = d.d.DecodeUint64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint8UintptrR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]uintptr) - v, changed := fastpathTV.DecMapUint8UintptrV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint8UintptrV(*vp, true, d); changed { *vp = v } } else { @@ -23310,37 +7918,29 @@ func (d *Decoder) fastpathDecMapUint8UintptrR(f *codecFnInfo, rv reflect.Value) } } func (f fastpathT) DecMapUint8UintptrX(vp *map[uint8]uintptr, d *Decoder) { - v, changed := f.DecMapUint8UintptrV(*vp, true, d) - if changed { + if v, changed := f.DecMapUint8UintptrV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, canChange bool, +func (fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, canChange bool, d *Decoder) (_ map[uint8]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uint8]uintptr, xlen) + v = make(map[uint8]uintptr, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint8 var mv uintptr hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -23349,21 +7949,19 @@ func (_ fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, canChange bool, } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint8IntR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]int) - v, changed := fastpathTV.DecMapUint8IntV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint8IntV(*vp, true, d); changed { *vp = v } } else { @@ -23371,37 +7969,29 @@ func (d *Decoder) fastpathDecMapUint8IntR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint8IntX(vp *map[uint8]int, d *Decoder) { - v, changed := f.DecMapUint8IntV(*vp, true, d) - if changed { + if v, changed := f.DecMapUint8IntV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint8IntV(v map[uint8]int, canChange bool, +func (fastpathT) DecMapUint8IntV(v map[uint8]int, canChange bool, d *Decoder) (_ map[uint8]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uint8]int, xlen) + v = make(map[uint8]int, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint8 var mv int hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -23410,204 +8000,19 @@ func (_ fastpathT) DecMapUint8IntV(v map[uint8]int, canChange bool, } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint8Int8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint8]int8) - v, changed := fastpathTV.DecMapUint8Int8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint8Int8V(rv2i(rv).(map[uint8]int8), false, d) - } -} -func (f fastpathT) DecMapUint8Int8X(vp *map[uint8]int8, d *Decoder) { - v, changed := f.DecMapUint8Int8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint8Int8V(v map[uint8]int8, canChange bool, - d *Decoder) (_ map[uint8]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) - v = make(map[uint8]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint8 - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint8Int16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint8]int16) - v, changed := fastpathTV.DecMapUint8Int16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint8Int16V(rv2i(rv).(map[uint8]int16), false, d) - } -} -func (f fastpathT) DecMapUint8Int16X(vp *map[uint8]int16, d *Decoder) { - v, changed := f.DecMapUint8Int16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint8Int16V(v map[uint8]int16, canChange bool, - d *Decoder) (_ map[uint8]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) - v = make(map[uint8]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint8 - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint8Int32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint8]int32) - v, changed := fastpathTV.DecMapUint8Int32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint8Int32V(rv2i(rv).(map[uint8]int32), false, d) - } -} -func (f fastpathT) DecMapUint8Int32X(vp *map[uint8]int32, d *Decoder) { - v, changed := f.DecMapUint8Int32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint8Int32V(v map[uint8]int32, canChange bool, - d *Decoder) (_ map[uint8]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[uint8]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint8 - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint8Int64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]int64) - v, changed := fastpathTV.DecMapUint8Int64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint8Int64V(*vp, true, d); changed { *vp = v } } else { @@ -23615,37 +8020,29 @@ func (d *Decoder) fastpathDecMapUint8Int64R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint8Int64X(vp *map[uint8]int64, d *Decoder) { - v, changed := f.DecMapUint8Int64V(*vp, true, d) - if changed { + if v, changed := f.DecMapUint8Int64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint8Int64V(v map[uint8]int64, canChange bool, +func (fastpathT) DecMapUint8Int64V(v map[uint8]int64, canChange bool, d *Decoder) (_ map[uint8]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uint8]int64, xlen) + v = make(map[uint8]int64, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint8 var mv int64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -23654,21 +8051,19 @@ func (_ fastpathT) DecMapUint8Int64V(v map[uint8]int64, canChange bool, } continue } - mv = dd.DecodeInt64() + mv = d.d.DecodeInt64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint8Float32R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]float32) - v, changed := fastpathTV.DecMapUint8Float32V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint8Float32V(*vp, true, d); changed { *vp = v } } else { @@ -23676,37 +8071,29 @@ func (d *Decoder) fastpathDecMapUint8Float32R(f *codecFnInfo, rv reflect.Value) } } func (f fastpathT) DecMapUint8Float32X(vp *map[uint8]float32, d *Decoder) { - v, changed := f.DecMapUint8Float32V(*vp, true, d) - if changed { + if v, changed := f.DecMapUint8Float32V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint8Float32V(v map[uint8]float32, canChange bool, +func (fastpathT) DecMapUint8Float32V(v map[uint8]float32, canChange bool, d *Decoder) (_ map[uint8]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[uint8]float32, xlen) + v = make(map[uint8]float32, decInferLen(containerLen, d.h.MaxInitLen, 5)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint8 var mv float32 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -23715,21 +8102,19 @@ func (_ fastpathT) DecMapUint8Float32V(v map[uint8]float32, canChange bool, } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(d.decodeFloat32()) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint8Float64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]float64) - v, changed := fastpathTV.DecMapUint8Float64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint8Float64V(*vp, true, d); changed { *vp = v } } else { @@ -23737,37 +8122,29 @@ func (d *Decoder) fastpathDecMapUint8Float64R(f *codecFnInfo, rv reflect.Value) } } func (f fastpathT) DecMapUint8Float64X(vp *map[uint8]float64, d *Decoder) { - v, changed := f.DecMapUint8Float64V(*vp, true, d) - if changed { + if v, changed := f.DecMapUint8Float64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint8Float64V(v map[uint8]float64, canChange bool, +func (fastpathT) DecMapUint8Float64V(v map[uint8]float64, canChange bool, d *Decoder) (_ map[uint8]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uint8]float64, xlen) + v = make(map[uint8]float64, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint8 var mv float64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -23776,21 +8153,19 @@ func (_ fastpathT) DecMapUint8Float64V(v map[uint8]float64, canChange bool, } continue } - mv = dd.DecodeFloat64() + mv = d.d.DecodeFloat64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint8BoolR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]bool) - v, changed := fastpathTV.DecMapUint8BoolV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint8BoolV(*vp, true, d); changed { *vp = v } } else { @@ -23798,37 +8173,29 @@ func (d *Decoder) fastpathDecMapUint8BoolR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint8BoolX(vp *map[uint8]bool, d *Decoder) { - v, changed := f.DecMapUint8BoolV(*vp, true, d) - if changed { + if v, changed := f.DecMapUint8BoolV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint8BoolV(v map[uint8]bool, canChange bool, +func (fastpathT) DecMapUint8BoolV(v map[uint8]bool, canChange bool, d *Decoder) (_ map[uint8]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) - v = make(map[uint8]bool, xlen) + v = make(map[uint8]bool, decInferLen(containerLen, d.h.MaxInitLen, 2)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint8 var mv bool hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -23837,1985 +8204,19 @@ func (_ fastpathT) DecMapUint8BoolV(v map[uint8]bool, canChange bool, } continue } - mv = dd.DecodeBool() + mv = d.d.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16IntfR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]interface{}) - v, changed := fastpathTV.DecMapUint16IntfV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16IntfV(rv2i(rv).(map[uint16]interface{}), false, d) - } -} -func (f fastpathT) DecMapUint16IntfX(vp *map[uint16]interface{}, d *Decoder) { - v, changed := f.DecMapUint16IntfV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16IntfV(v map[uint16]interface{}, canChange bool, - d *Decoder) (_ map[uint16]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) - v = make(map[uint16]interface{}, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset - var mk uint16 - var mv interface{} - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16StringR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]string) - v, changed := fastpathTV.DecMapUint16StringV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16StringV(rv2i(rv).(map[uint16]string), false, d) - } -} -func (f fastpathT) DecMapUint16StringX(vp *map[uint16]string, d *Decoder) { - v, changed := f.DecMapUint16StringV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16StringV(v map[uint16]string, canChange bool, - d *Decoder) (_ map[uint16]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) - v = make(map[uint16]string, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv string - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16UintR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]uint) - v, changed := fastpathTV.DecMapUint16UintV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16UintV(rv2i(rv).(map[uint16]uint), false, d) - } -} -func (f fastpathT) DecMapUint16UintX(vp *map[uint16]uint, d *Decoder) { - v, changed := f.DecMapUint16UintV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16UintV(v map[uint16]uint, canChange bool, - d *Decoder) (_ map[uint16]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[uint16]uint, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16Uint8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]uint8) - v, changed := fastpathTV.DecMapUint16Uint8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16Uint8V(rv2i(rv).(map[uint16]uint8), false, d) - } -} -func (f fastpathT) DecMapUint16Uint8X(vp *map[uint16]uint8, d *Decoder) { - v, changed := f.DecMapUint16Uint8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16Uint8V(v map[uint16]uint8, canChange bool, - d *Decoder) (_ map[uint16]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) - v = make(map[uint16]uint8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv uint8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16Uint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]uint16) - v, changed := fastpathTV.DecMapUint16Uint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16Uint16V(rv2i(rv).(map[uint16]uint16), false, d) - } -} -func (f fastpathT) DecMapUint16Uint16X(vp *map[uint16]uint16, d *Decoder) { - v, changed := f.DecMapUint16Uint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16Uint16V(v map[uint16]uint16, canChange bool, - d *Decoder) (_ map[uint16]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 4) - v = make(map[uint16]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16Uint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]uint32) - v, changed := fastpathTV.DecMapUint16Uint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16Uint32V(rv2i(rv).(map[uint16]uint32), false, d) - } -} -func (f fastpathT) DecMapUint16Uint32X(vp *map[uint16]uint32, d *Decoder) { - v, changed := f.DecMapUint16Uint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16Uint32V(v map[uint16]uint32, canChange bool, - d *Decoder) (_ map[uint16]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) - v = make(map[uint16]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16Uint64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]uint64) - v, changed := fastpathTV.DecMapUint16Uint64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16Uint64V(rv2i(rv).(map[uint16]uint64), false, d) - } -} -func (f fastpathT) DecMapUint16Uint64X(vp *map[uint16]uint64, d *Decoder) { - v, changed := f.DecMapUint16Uint64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16Uint64V(v map[uint16]uint64, canChange bool, - d *Decoder) (_ map[uint16]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[uint16]uint64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv uint64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeUint64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16UintptrR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]uintptr) - v, changed := fastpathTV.DecMapUint16UintptrV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16UintptrV(rv2i(rv).(map[uint16]uintptr), false, d) - } -} -func (f fastpathT) DecMapUint16UintptrX(vp *map[uint16]uintptr, d *Decoder) { - v, changed := f.DecMapUint16UintptrV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16UintptrV(v map[uint16]uintptr, canChange bool, - d *Decoder) (_ map[uint16]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[uint16]uintptr, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv uintptr - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16IntR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]int) - v, changed := fastpathTV.DecMapUint16IntV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16IntV(rv2i(rv).(map[uint16]int), false, d) - } -} -func (f fastpathT) DecMapUint16IntX(vp *map[uint16]int, d *Decoder) { - v, changed := f.DecMapUint16IntV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16IntV(v map[uint16]int, canChange bool, - d *Decoder) (_ map[uint16]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[uint16]int, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv int - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16Int8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]int8) - v, changed := fastpathTV.DecMapUint16Int8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16Int8V(rv2i(rv).(map[uint16]int8), false, d) - } -} -func (f fastpathT) DecMapUint16Int8X(vp *map[uint16]int8, d *Decoder) { - v, changed := f.DecMapUint16Int8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16Int8V(v map[uint16]int8, canChange bool, - d *Decoder) (_ map[uint16]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) - v = make(map[uint16]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16Int16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]int16) - v, changed := fastpathTV.DecMapUint16Int16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16Int16V(rv2i(rv).(map[uint16]int16), false, d) - } -} -func (f fastpathT) DecMapUint16Int16X(vp *map[uint16]int16, d *Decoder) { - v, changed := f.DecMapUint16Int16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16Int16V(v map[uint16]int16, canChange bool, - d *Decoder) (_ map[uint16]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 4) - v = make(map[uint16]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16Int32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]int32) - v, changed := fastpathTV.DecMapUint16Int32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16Int32V(rv2i(rv).(map[uint16]int32), false, d) - } -} -func (f fastpathT) DecMapUint16Int32X(vp *map[uint16]int32, d *Decoder) { - v, changed := f.DecMapUint16Int32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16Int32V(v map[uint16]int32, canChange bool, - d *Decoder) (_ map[uint16]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) - v = make(map[uint16]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16Int64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]int64) - v, changed := fastpathTV.DecMapUint16Int64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16Int64V(rv2i(rv).(map[uint16]int64), false, d) - } -} -func (f fastpathT) DecMapUint16Int64X(vp *map[uint16]int64, d *Decoder) { - v, changed := f.DecMapUint16Int64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16Int64V(v map[uint16]int64, canChange bool, - d *Decoder) (_ map[uint16]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[uint16]int64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv int64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeInt64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16Float32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]float32) - v, changed := fastpathTV.DecMapUint16Float32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16Float32V(rv2i(rv).(map[uint16]float32), false, d) - } -} -func (f fastpathT) DecMapUint16Float32X(vp *map[uint16]float32, d *Decoder) { - v, changed := f.DecMapUint16Float32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16Float32V(v map[uint16]float32, canChange bool, - d *Decoder) (_ map[uint16]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) - v = make(map[uint16]float32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16Float64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]float64) - v, changed := fastpathTV.DecMapUint16Float64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16Float64V(rv2i(rv).(map[uint16]float64), false, d) - } -} -func (f fastpathT) DecMapUint16Float64X(vp *map[uint16]float64, d *Decoder) { - v, changed := f.DecMapUint16Float64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16Float64V(v map[uint16]float64, canChange bool, - d *Decoder) (_ map[uint16]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[uint16]float64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv float64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeFloat64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint16BoolR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint16]bool) - v, changed := fastpathTV.DecMapUint16BoolV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint16BoolV(rv2i(rv).(map[uint16]bool), false, d) - } -} -func (f fastpathT) DecMapUint16BoolX(vp *map[uint16]bool, d *Decoder) { - v, changed := f.DecMapUint16BoolV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint16BoolV(v map[uint16]bool, canChange bool, - d *Decoder) (_ map[uint16]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) - v = make(map[uint16]bool, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint16 - var mv bool - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32IntfR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]interface{}) - v, changed := fastpathTV.DecMapUint32IntfV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32IntfV(rv2i(rv).(map[uint32]interface{}), false, d) - } -} -func (f fastpathT) DecMapUint32IntfX(vp *map[uint32]interface{}, d *Decoder) { - v, changed := f.DecMapUint32IntfV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32IntfV(v map[uint32]interface{}, canChange bool, - d *Decoder) (_ map[uint32]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) - v = make(map[uint32]interface{}, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset - var mk uint32 - var mv interface{} - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32StringR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]string) - v, changed := fastpathTV.DecMapUint32StringV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32StringV(rv2i(rv).(map[uint32]string), false, d) - } -} -func (f fastpathT) DecMapUint32StringX(vp *map[uint32]string, d *Decoder) { - v, changed := f.DecMapUint32StringV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32StringV(v map[uint32]string, canChange bool, - d *Decoder) (_ map[uint32]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) - v = make(map[uint32]string, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv string - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32UintR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]uint) - v, changed := fastpathTV.DecMapUint32UintV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32UintV(rv2i(rv).(map[uint32]uint), false, d) - } -} -func (f fastpathT) DecMapUint32UintX(vp *map[uint32]uint, d *Decoder) { - v, changed := f.DecMapUint32UintV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32UintV(v map[uint32]uint, canChange bool, - d *Decoder) (_ map[uint32]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uint32]uint, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32Uint8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]uint8) - v, changed := fastpathTV.DecMapUint32Uint8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32Uint8V(rv2i(rv).(map[uint32]uint8), false, d) - } -} -func (f fastpathT) DecMapUint32Uint8X(vp *map[uint32]uint8, d *Decoder) { - v, changed := f.DecMapUint32Uint8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32Uint8V(v map[uint32]uint8, canChange bool, - d *Decoder) (_ map[uint32]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[uint32]uint8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv uint8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32Uint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]uint16) - v, changed := fastpathTV.DecMapUint32Uint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32Uint16V(rv2i(rv).(map[uint32]uint16), false, d) - } -} -func (f fastpathT) DecMapUint32Uint16X(vp *map[uint32]uint16, d *Decoder) { - v, changed := f.DecMapUint32Uint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32Uint16V(v map[uint32]uint16, canChange bool, - d *Decoder) (_ map[uint32]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) - v = make(map[uint32]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32Uint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]uint32) - v, changed := fastpathTV.DecMapUint32Uint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32Uint32V(rv2i(rv).(map[uint32]uint32), false, d) - } -} -func (f fastpathT) DecMapUint32Uint32X(vp *map[uint32]uint32, d *Decoder) { - v, changed := f.DecMapUint32Uint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32Uint32V(v map[uint32]uint32, canChange bool, - d *Decoder) (_ map[uint32]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) - v = make(map[uint32]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32Uint64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]uint64) - v, changed := fastpathTV.DecMapUint32Uint64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32Uint64V(rv2i(rv).(map[uint32]uint64), false, d) - } -} -func (f fastpathT) DecMapUint32Uint64X(vp *map[uint32]uint64, d *Decoder) { - v, changed := f.DecMapUint32Uint64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32Uint64V(v map[uint32]uint64, canChange bool, - d *Decoder) (_ map[uint32]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uint32]uint64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv uint64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeUint64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32UintptrR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]uintptr) - v, changed := fastpathTV.DecMapUint32UintptrV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32UintptrV(rv2i(rv).(map[uint32]uintptr), false, d) - } -} -func (f fastpathT) DecMapUint32UintptrX(vp *map[uint32]uintptr, d *Decoder) { - v, changed := f.DecMapUint32UintptrV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32UintptrV(v map[uint32]uintptr, canChange bool, - d *Decoder) (_ map[uint32]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uint32]uintptr, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv uintptr - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32IntR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]int) - v, changed := fastpathTV.DecMapUint32IntV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32IntV(rv2i(rv).(map[uint32]int), false, d) - } -} -func (f fastpathT) DecMapUint32IntX(vp *map[uint32]int, d *Decoder) { - v, changed := f.DecMapUint32IntV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32IntV(v map[uint32]int, canChange bool, - d *Decoder) (_ map[uint32]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uint32]int, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv int - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32Int8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]int8) - v, changed := fastpathTV.DecMapUint32Int8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32Int8V(rv2i(rv).(map[uint32]int8), false, d) - } -} -func (f fastpathT) DecMapUint32Int8X(vp *map[uint32]int8, d *Decoder) { - v, changed := f.DecMapUint32Int8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32Int8V(v map[uint32]int8, canChange bool, - d *Decoder) (_ map[uint32]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[uint32]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32Int16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]int16) - v, changed := fastpathTV.DecMapUint32Int16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32Int16V(rv2i(rv).(map[uint32]int16), false, d) - } -} -func (f fastpathT) DecMapUint32Int16X(vp *map[uint32]int16, d *Decoder) { - v, changed := f.DecMapUint32Int16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32Int16V(v map[uint32]int16, canChange bool, - d *Decoder) (_ map[uint32]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) - v = make(map[uint32]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32Int32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]int32) - v, changed := fastpathTV.DecMapUint32Int32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32Int32V(rv2i(rv).(map[uint32]int32), false, d) - } -} -func (f fastpathT) DecMapUint32Int32X(vp *map[uint32]int32, d *Decoder) { - v, changed := f.DecMapUint32Int32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32Int32V(v map[uint32]int32, canChange bool, - d *Decoder) (_ map[uint32]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) - v = make(map[uint32]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32Int64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]int64) - v, changed := fastpathTV.DecMapUint32Int64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32Int64V(rv2i(rv).(map[uint32]int64), false, d) - } -} -func (f fastpathT) DecMapUint32Int64X(vp *map[uint32]int64, d *Decoder) { - v, changed := f.DecMapUint32Int64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32Int64V(v map[uint32]int64, canChange bool, - d *Decoder) (_ map[uint32]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uint32]int64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv int64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeInt64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32Float32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]float32) - v, changed := fastpathTV.DecMapUint32Float32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32Float32V(rv2i(rv).(map[uint32]float32), false, d) - } -} -func (f fastpathT) DecMapUint32Float32X(vp *map[uint32]float32, d *Decoder) { - v, changed := f.DecMapUint32Float32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32Float32V(v map[uint32]float32, canChange bool, - d *Decoder) (_ map[uint32]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) - v = make(map[uint32]float32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32Float64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]float64) - v, changed := fastpathTV.DecMapUint32Float64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32Float64V(rv2i(rv).(map[uint32]float64), false, d) - } -} -func (f fastpathT) DecMapUint32Float64X(vp *map[uint32]float64, d *Decoder) { - v, changed := f.DecMapUint32Float64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32Float64V(v map[uint32]float64, canChange bool, - d *Decoder) (_ map[uint32]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uint32]float64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv float64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeFloat64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint32BoolR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint32]bool) - v, changed := fastpathTV.DecMapUint32BoolV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint32BoolV(rv2i(rv).(map[uint32]bool), false, d) - } -} -func (f fastpathT) DecMapUint32BoolX(vp *map[uint32]bool, d *Decoder) { - v, changed := f.DecMapUint32BoolV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint32BoolV(v map[uint32]bool, canChange bool, - d *Decoder) (_ map[uint32]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[uint32]bool, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint32 - var mv bool - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint64IntfR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]interface{}) - v, changed := fastpathTV.DecMapUint64IntfV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint64IntfV(*vp, true, d); changed { *vp = v } } else { @@ -25823,38 +8224,30 @@ func (d *Decoder) fastpathDecMapUint64IntfR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint64IntfX(vp *map[uint64]interface{}, d *Decoder) { - v, changed := f.DecMapUint64IntfV(*vp, true, d) - if changed { + if v, changed := f.DecMapUint64IntfV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, canChange bool, +func (fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, canChange bool, d *Decoder) (_ map[uint64]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[uint64]interface{}, xlen) + v = make(map[uint64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk uint64 var mv interface{} hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeUint64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -25873,16 +8266,14 @@ func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, canChange bool, v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint64StringR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]string) - v, changed := fastpathTV.DecMapUint64StringV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint64StringV(*vp, true, d); changed { *vp = v } } else { @@ -25890,37 +8281,29 @@ func (d *Decoder) fastpathDecMapUint64StringR(f *codecFnInfo, rv reflect.Value) } } func (f fastpathT) DecMapUint64StringX(vp *map[uint64]string, d *Decoder) { - v, changed := f.DecMapUint64StringV(*vp, true, d) - if changed { + if v, changed := f.DecMapUint64StringV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint64StringV(v map[uint64]string, canChange bool, +func (fastpathT) DecMapUint64StringV(v map[uint64]string, canChange bool, d *Decoder) (_ map[uint64]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[uint64]string, xlen) + v = make(map[uint64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint64 var mv string hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeUint64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -25929,21 +8312,76 @@ func (_ fastpathT) DecMapUint64StringV(v map[uint64]string, canChange bool, } continue } - mv = dd.DecodeString() + mv = d.d.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() + return v, changed +} + +func (d *Decoder) fastpathDecMapUint64BytesR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64][]byte) + if v, changed := fastpathTV.DecMapUint64BytesV(*vp, true, d); changed { + *vp = v + } + } else { + fastpathTV.DecMapUint64BytesV(rv2i(rv).(map[uint64][]byte), false, d) + } +} +func (f fastpathT) DecMapUint64BytesX(vp *map[uint64][]byte, d *Decoder) { + if v, changed := f.DecMapUint64BytesV(*vp, true, d); changed { + *vp = v + } +} +func (fastpathT) DecMapUint64BytesV(v map[uint64][]byte, canChange bool, + d *Decoder) (_ map[uint64][]byte, changed bool) { + containerLen := d.mapStart() + if canChange && v == nil { + v = make(map[uint64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) + changed = true + } + if containerLen == 0 { + d.mapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset + var mk uint64 + var mv []byte + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeUint64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = nil + } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + mv = d.d.DecodeBytes(mv, false) + if v != nil { + v[mk] = mv + } + } + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint64UintR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]uint) - v, changed := fastpathTV.DecMapUint64UintV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint64UintV(*vp, true, d); changed { *vp = v } } else { @@ -25951,37 +8389,29 @@ func (d *Decoder) fastpathDecMapUint64UintR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint64UintX(vp *map[uint64]uint, d *Decoder) { - v, changed := f.DecMapUint64UintV(*vp, true, d) - if changed { + if v, changed := f.DecMapUint64UintV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint64UintV(v map[uint64]uint, canChange bool, +func (fastpathT) DecMapUint64UintV(v map[uint64]uint, canChange bool, d *Decoder) (_ map[uint64]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uint64]uint, xlen) + v = make(map[uint64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint64 var mv uint hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeUint64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -25990,21 +8420,19 @@ func (_ fastpathT) DecMapUint64UintV(v map[uint64]uint, canChange bool, } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]uint8) - v, changed := fastpathTV.DecMapUint64Uint8V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint64Uint8V(*vp, true, d); changed { *vp = v } } else { @@ -26012,37 +8440,29 @@ func (d *Decoder) fastpathDecMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint64Uint8X(vp *map[uint64]uint8, d *Decoder) { - v, changed := f.DecMapUint64Uint8V(*vp, true, d) - if changed { + if v, changed := f.DecMapUint64Uint8V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, canChange bool, +func (fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, canChange bool, d *Decoder) (_ map[uint64]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uint64]uint8, xlen) + v = make(map[uint64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint64 var mv uint8 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeUint64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -26051,143 +8471,19 @@ func (_ fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, canChange bool, } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint64Uint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint64]uint16) - v, changed := fastpathTV.DecMapUint64Uint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint64Uint16V(rv2i(rv).(map[uint64]uint16), false, d) - } -} -func (f fastpathT) DecMapUint64Uint16X(vp *map[uint64]uint16, d *Decoder) { - v, changed := f.DecMapUint64Uint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint64Uint16V(v map[uint64]uint16, canChange bool, - d *Decoder) (_ map[uint64]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[uint64]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint64 - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint64Uint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint64]uint32) - v, changed := fastpathTV.DecMapUint64Uint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint64Uint32V(rv2i(rv).(map[uint64]uint32), false, d) - } -} -func (f fastpathT) DecMapUint64Uint32X(vp *map[uint64]uint32, d *Decoder) { - v, changed := f.DecMapUint64Uint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint64Uint32V(v map[uint64]uint32, canChange bool, - d *Decoder) (_ map[uint64]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uint64]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint64 - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint64Uint64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]uint64) - v, changed := fastpathTV.DecMapUint64Uint64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint64Uint64V(*vp, true, d); changed { *vp = v } } else { @@ -26195,37 +8491,29 @@ func (d *Decoder) fastpathDecMapUint64Uint64R(f *codecFnInfo, rv reflect.Value) } } func (f fastpathT) DecMapUint64Uint64X(vp *map[uint64]uint64, d *Decoder) { - v, changed := f.DecMapUint64Uint64V(*vp, true, d) - if changed { + if v, changed := f.DecMapUint64Uint64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, canChange bool, +func (fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, canChange bool, d *Decoder) (_ map[uint64]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uint64]uint64, xlen) + v = make(map[uint64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint64 var mv uint64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeUint64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -26234,21 +8522,19 @@ func (_ fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, canChange bool, } continue } - mv = dd.DecodeUint64() + mv = d.d.DecodeUint64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint64UintptrR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]uintptr) - v, changed := fastpathTV.DecMapUint64UintptrV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint64UintptrV(*vp, true, d); changed { *vp = v } } else { @@ -26256,37 +8542,29 @@ func (d *Decoder) fastpathDecMapUint64UintptrR(f *codecFnInfo, rv reflect.Value) } } func (f fastpathT) DecMapUint64UintptrX(vp *map[uint64]uintptr, d *Decoder) { - v, changed := f.DecMapUint64UintptrV(*vp, true, d) - if changed { + if v, changed := f.DecMapUint64UintptrV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, canChange bool, +func (fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, canChange bool, d *Decoder) (_ map[uint64]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uint64]uintptr, xlen) + v = make(map[uint64]uintptr, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint64 var mv uintptr hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeUint64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -26295,21 +8573,19 @@ func (_ fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, canChange bool, } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint64IntR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]int) - v, changed := fastpathTV.DecMapUint64IntV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint64IntV(*vp, true, d); changed { *vp = v } } else { @@ -26317,37 +8593,29 @@ func (d *Decoder) fastpathDecMapUint64IntR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint64IntX(vp *map[uint64]int, d *Decoder) { - v, changed := f.DecMapUint64IntV(*vp, true, d) - if changed { + if v, changed := f.DecMapUint64IntV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint64IntV(v map[uint64]int, canChange bool, +func (fastpathT) DecMapUint64IntV(v map[uint64]int, canChange bool, d *Decoder) (_ map[uint64]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uint64]int, xlen) + v = make(map[uint64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint64 var mv int hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeUint64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -26356,204 +8624,19 @@ func (_ fastpathT) DecMapUint64IntV(v map[uint64]int, canChange bool, } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint64Int8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint64]int8) - v, changed := fastpathTV.DecMapUint64Int8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint64Int8V(rv2i(rv).(map[uint64]int8), false, d) - } -} -func (f fastpathT) DecMapUint64Int8X(vp *map[uint64]int8, d *Decoder) { - v, changed := f.DecMapUint64Int8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint64Int8V(v map[uint64]int8, canChange bool, - d *Decoder) (_ map[uint64]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uint64]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint64 - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint64Int16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint64]int16) - v, changed := fastpathTV.DecMapUint64Int16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint64Int16V(rv2i(rv).(map[uint64]int16), false, d) - } -} -func (f fastpathT) DecMapUint64Int16X(vp *map[uint64]int16, d *Decoder) { - v, changed := f.DecMapUint64Int16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint64Int16V(v map[uint64]int16, canChange bool, - d *Decoder) (_ map[uint64]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[uint64]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint64 - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUint64Int32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uint64]int32) - v, changed := fastpathTV.DecMapUint64Int32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUint64Int32V(rv2i(rv).(map[uint64]int32), false, d) - } -} -func (f fastpathT) DecMapUint64Int32X(vp *map[uint64]int32, d *Decoder) { - v, changed := f.DecMapUint64Int32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUint64Int32V(v map[uint64]int32, canChange bool, - d *Decoder) (_ map[uint64]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uint64]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uint64 - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint64Int64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]int64) - v, changed := fastpathTV.DecMapUint64Int64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint64Int64V(*vp, true, d); changed { *vp = v } } else { @@ -26561,37 +8644,29 @@ func (d *Decoder) fastpathDecMapUint64Int64R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint64Int64X(vp *map[uint64]int64, d *Decoder) { - v, changed := f.DecMapUint64Int64V(*vp, true, d) - if changed { + if v, changed := f.DecMapUint64Int64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint64Int64V(v map[uint64]int64, canChange bool, +func (fastpathT) DecMapUint64Int64V(v map[uint64]int64, canChange bool, d *Decoder) (_ map[uint64]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uint64]int64, xlen) + v = make(map[uint64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint64 var mv int64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeUint64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -26600,21 +8675,19 @@ func (_ fastpathT) DecMapUint64Int64V(v map[uint64]int64, canChange bool, } continue } - mv = dd.DecodeInt64() + mv = d.d.DecodeInt64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint64Float32R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]float32) - v, changed := fastpathTV.DecMapUint64Float32V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint64Float32V(*vp, true, d); changed { *vp = v } } else { @@ -26622,37 +8695,29 @@ func (d *Decoder) fastpathDecMapUint64Float32R(f *codecFnInfo, rv reflect.Value) } } func (f fastpathT) DecMapUint64Float32X(vp *map[uint64]float32, d *Decoder) { - v, changed := f.DecMapUint64Float32V(*vp, true, d) - if changed { + if v, changed := f.DecMapUint64Float32V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint64Float32V(v map[uint64]float32, canChange bool, +func (fastpathT) DecMapUint64Float32V(v map[uint64]float32, canChange bool, d *Decoder) (_ map[uint64]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uint64]float32, xlen) + v = make(map[uint64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint64 var mv float32 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeUint64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -26661,21 +8726,19 @@ func (_ fastpathT) DecMapUint64Float32V(v map[uint64]float32, canChange bool, } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(d.decodeFloat32()) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint64Float64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]float64) - v, changed := fastpathTV.DecMapUint64Float64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint64Float64V(*vp, true, d); changed { *vp = v } } else { @@ -26683,37 +8746,29 @@ func (d *Decoder) fastpathDecMapUint64Float64R(f *codecFnInfo, rv reflect.Value) } } func (f fastpathT) DecMapUint64Float64X(vp *map[uint64]float64, d *Decoder) { - v, changed := f.DecMapUint64Float64V(*vp, true, d) - if changed { + if v, changed := f.DecMapUint64Float64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint64Float64V(v map[uint64]float64, canChange bool, +func (fastpathT) DecMapUint64Float64V(v map[uint64]float64, canChange bool, d *Decoder) (_ map[uint64]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uint64]float64, xlen) + v = make(map[uint64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint64 var mv float64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeUint64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -26722,21 +8777,19 @@ func (_ fastpathT) DecMapUint64Float64V(v map[uint64]float64, canChange bool, } continue } - mv = dd.DecodeFloat64() + mv = d.d.DecodeFloat64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapUint64BoolR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]bool) - v, changed := fastpathTV.DecMapUint64BoolV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapUint64BoolV(*vp, true, d); changed { *vp = v } } else { @@ -26744,37 +8797,29 @@ func (d *Decoder) fastpathDecMapUint64BoolR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapUint64BoolX(vp *map[uint64]bool, d *Decoder) { - v, changed := f.DecMapUint64BoolV(*vp, true, d) - if changed { + if v, changed := f.DecMapUint64BoolV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapUint64BoolV(v map[uint64]bool, canChange bool, +func (fastpathT) DecMapUint64BoolV(v map[uint64]bool, canChange bool, d *Decoder) (_ map[uint64]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uint64]bool, xlen) + v = make(map[uint64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk uint64 var mv bool hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeUint64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeUint64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -26783,1003 +8828,19 @@ func (_ fastpathT) DecMapUint64BoolV(v map[uint64]bool, canChange bool, } continue } - mv = dd.DecodeBool() + mv = d.d.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrIntfR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]interface{}) - v, changed := fastpathTV.DecMapUintptrIntfV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrIntfV(rv2i(rv).(map[uintptr]interface{}), false, d) - } -} -func (f fastpathT) DecMapUintptrIntfX(vp *map[uintptr]interface{}, d *Decoder) { - v, changed := f.DecMapUintptrIntfV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrIntfV(v map[uintptr]interface{}, canChange bool, - d *Decoder) (_ map[uintptr]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[uintptr]interface{}, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset - var mk uintptr - var mv interface{} - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrStringR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]string) - v, changed := fastpathTV.DecMapUintptrStringV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrStringV(rv2i(rv).(map[uintptr]string), false, d) - } -} -func (f fastpathT) DecMapUintptrStringX(vp *map[uintptr]string, d *Decoder) { - v, changed := f.DecMapUintptrStringV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrStringV(v map[uintptr]string, canChange bool, - d *Decoder) (_ map[uintptr]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[uintptr]string, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv string - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrUintR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]uint) - v, changed := fastpathTV.DecMapUintptrUintV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrUintV(rv2i(rv).(map[uintptr]uint), false, d) - } -} -func (f fastpathT) DecMapUintptrUintX(vp *map[uintptr]uint, d *Decoder) { - v, changed := f.DecMapUintptrUintV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrUintV(v map[uintptr]uint, canChange bool, - d *Decoder) (_ map[uintptr]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uintptr]uint, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrUint8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]uint8) - v, changed := fastpathTV.DecMapUintptrUint8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrUint8V(rv2i(rv).(map[uintptr]uint8), false, d) - } -} -func (f fastpathT) DecMapUintptrUint8X(vp *map[uintptr]uint8, d *Decoder) { - v, changed := f.DecMapUintptrUint8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrUint8V(v map[uintptr]uint8, canChange bool, - d *Decoder) (_ map[uintptr]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uintptr]uint8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv uint8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrUint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]uint16) - v, changed := fastpathTV.DecMapUintptrUint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrUint16V(rv2i(rv).(map[uintptr]uint16), false, d) - } -} -func (f fastpathT) DecMapUintptrUint16X(vp *map[uintptr]uint16, d *Decoder) { - v, changed := f.DecMapUintptrUint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrUint16V(v map[uintptr]uint16, canChange bool, - d *Decoder) (_ map[uintptr]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[uintptr]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrUint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]uint32) - v, changed := fastpathTV.DecMapUintptrUint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrUint32V(rv2i(rv).(map[uintptr]uint32), false, d) - } -} -func (f fastpathT) DecMapUintptrUint32X(vp *map[uintptr]uint32, d *Decoder) { - v, changed := f.DecMapUintptrUint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrUint32V(v map[uintptr]uint32, canChange bool, - d *Decoder) (_ map[uintptr]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uintptr]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrUint64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]uint64) - v, changed := fastpathTV.DecMapUintptrUint64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrUint64V(rv2i(rv).(map[uintptr]uint64), false, d) - } -} -func (f fastpathT) DecMapUintptrUint64X(vp *map[uintptr]uint64, d *Decoder) { - v, changed := f.DecMapUintptrUint64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrUint64V(v map[uintptr]uint64, canChange bool, - d *Decoder) (_ map[uintptr]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uintptr]uint64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv uint64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeUint64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrUintptrR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]uintptr) - v, changed := fastpathTV.DecMapUintptrUintptrV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrUintptrV(rv2i(rv).(map[uintptr]uintptr), false, d) - } -} -func (f fastpathT) DecMapUintptrUintptrX(vp *map[uintptr]uintptr, d *Decoder) { - v, changed := f.DecMapUintptrUintptrV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrUintptrV(v map[uintptr]uintptr, canChange bool, - d *Decoder) (_ map[uintptr]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uintptr]uintptr, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv uintptr - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrIntR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]int) - v, changed := fastpathTV.DecMapUintptrIntV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrIntV(rv2i(rv).(map[uintptr]int), false, d) - } -} -func (f fastpathT) DecMapUintptrIntX(vp *map[uintptr]int, d *Decoder) { - v, changed := f.DecMapUintptrIntV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrIntV(v map[uintptr]int, canChange bool, - d *Decoder) (_ map[uintptr]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uintptr]int, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv int - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrInt8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]int8) - v, changed := fastpathTV.DecMapUintptrInt8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrInt8V(rv2i(rv).(map[uintptr]int8), false, d) - } -} -func (f fastpathT) DecMapUintptrInt8X(vp *map[uintptr]int8, d *Decoder) { - v, changed := f.DecMapUintptrInt8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrInt8V(v map[uintptr]int8, canChange bool, - d *Decoder) (_ map[uintptr]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uintptr]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrInt16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]int16) - v, changed := fastpathTV.DecMapUintptrInt16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrInt16V(rv2i(rv).(map[uintptr]int16), false, d) - } -} -func (f fastpathT) DecMapUintptrInt16X(vp *map[uintptr]int16, d *Decoder) { - v, changed := f.DecMapUintptrInt16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrInt16V(v map[uintptr]int16, canChange bool, - d *Decoder) (_ map[uintptr]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[uintptr]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrInt32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]int32) - v, changed := fastpathTV.DecMapUintptrInt32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrInt32V(rv2i(rv).(map[uintptr]int32), false, d) - } -} -func (f fastpathT) DecMapUintptrInt32X(vp *map[uintptr]int32, d *Decoder) { - v, changed := f.DecMapUintptrInt32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrInt32V(v map[uintptr]int32, canChange bool, - d *Decoder) (_ map[uintptr]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uintptr]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrInt64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]int64) - v, changed := fastpathTV.DecMapUintptrInt64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrInt64V(rv2i(rv).(map[uintptr]int64), false, d) - } -} -func (f fastpathT) DecMapUintptrInt64X(vp *map[uintptr]int64, d *Decoder) { - v, changed := f.DecMapUintptrInt64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrInt64V(v map[uintptr]int64, canChange bool, - d *Decoder) (_ map[uintptr]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uintptr]int64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv int64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeInt64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrFloat32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]float32) - v, changed := fastpathTV.DecMapUintptrFloat32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrFloat32V(rv2i(rv).(map[uintptr]float32), false, d) - } -} -func (f fastpathT) DecMapUintptrFloat32X(vp *map[uintptr]float32, d *Decoder) { - v, changed := f.DecMapUintptrFloat32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrFloat32V(v map[uintptr]float32, canChange bool, - d *Decoder) (_ map[uintptr]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[uintptr]float32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrFloat64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]float64) - v, changed := fastpathTV.DecMapUintptrFloat64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrFloat64V(rv2i(rv).(map[uintptr]float64), false, d) - } -} -func (f fastpathT) DecMapUintptrFloat64X(vp *map[uintptr]float64, d *Decoder) { - v, changed := f.DecMapUintptrFloat64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrFloat64V(v map[uintptr]float64, canChange bool, - d *Decoder) (_ map[uintptr]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[uintptr]float64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv float64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeFloat64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapUintptrBoolR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[uintptr]bool) - v, changed := fastpathTV.DecMapUintptrBoolV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapUintptrBoolV(rv2i(rv).(map[uintptr]bool), false, d) - } -} -func (f fastpathT) DecMapUintptrBoolX(vp *map[uintptr]bool, d *Decoder) { - v, changed := f.DecMapUintptrBoolV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapUintptrBoolV(v map[uintptr]bool, canChange bool, - d *Decoder) (_ map[uintptr]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[uintptr]bool, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk uintptr - var mv bool - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapIntIntfR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]interface{}) - v, changed := fastpathTV.DecMapIntIntfV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapIntIntfV(*vp, true, d); changed { *vp = v } } else { @@ -27787,38 +8848,30 @@ func (d *Decoder) fastpathDecMapIntIntfR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapIntIntfX(vp *map[int]interface{}, d *Decoder) { - v, changed := f.DecMapIntIntfV(*vp, true, d) - if changed { + if v, changed := f.DecMapIntIntfV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, canChange bool, +func (fastpathT) DecMapIntIntfV(v map[int]interface{}, canChange bool, d *Decoder) (_ map[int]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[int]interface{}, xlen) + v = make(map[int]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk int var mv interface{} hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -27837,16 +8890,14 @@ func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, canChange bool, v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapIntStringR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]string) - v, changed := fastpathTV.DecMapIntStringV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapIntStringV(*vp, true, d); changed { *vp = v } } else { @@ -27854,37 +8905,29 @@ func (d *Decoder) fastpathDecMapIntStringR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapIntStringX(vp *map[int]string, d *Decoder) { - v, changed := f.DecMapIntStringV(*vp, true, d) - if changed { + if v, changed := f.DecMapIntStringV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapIntStringV(v map[int]string, canChange bool, +func (fastpathT) DecMapIntStringV(v map[int]string, canChange bool, d *Decoder) (_ map[int]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[int]string, xlen) + v = make(map[int]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk int var mv string hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -27893,21 +8936,76 @@ func (_ fastpathT) DecMapIntStringV(v map[int]string, canChange bool, } continue } - mv = dd.DecodeString() + mv = d.d.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() + return v, changed +} + +func (d *Decoder) fastpathDecMapIntBytesR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int][]byte) + if v, changed := fastpathTV.DecMapIntBytesV(*vp, true, d); changed { + *vp = v + } + } else { + fastpathTV.DecMapIntBytesV(rv2i(rv).(map[int][]byte), false, d) + } +} +func (f fastpathT) DecMapIntBytesX(vp *map[int][]byte, d *Decoder) { + if v, changed := f.DecMapIntBytesV(*vp, true, d); changed { + *vp = v + } +} +func (fastpathT) DecMapIntBytesV(v map[int][]byte, canChange bool, + d *Decoder) (_ map[int][]byte, changed bool) { + containerLen := d.mapStart() + if canChange && v == nil { + v = make(map[int][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) + changed = true + } + if containerLen == 0 { + d.mapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset + var mk int + var mv []byte + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = nil + } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + mv = d.d.DecodeBytes(mv, false) + if v != nil { + v[mk] = mv + } + } + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapIntUintR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]uint) - v, changed := fastpathTV.DecMapIntUintV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapIntUintV(*vp, true, d); changed { *vp = v } } else { @@ -27915,37 +9013,29 @@ func (d *Decoder) fastpathDecMapIntUintR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapIntUintX(vp *map[int]uint, d *Decoder) { - v, changed := f.DecMapIntUintV(*vp, true, d) - if changed { + if v, changed := f.DecMapIntUintV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapIntUintV(v map[int]uint, canChange bool, +func (fastpathT) DecMapIntUintV(v map[int]uint, canChange bool, d *Decoder) (_ map[int]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[int]uint, xlen) + v = make(map[int]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk int var mv uint hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -27954,21 +9044,19 @@ func (_ fastpathT) DecMapIntUintV(v map[int]uint, canChange bool, } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapIntUint8R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]uint8) - v, changed := fastpathTV.DecMapIntUint8V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapIntUint8V(*vp, true, d); changed { *vp = v } } else { @@ -27976,37 +9064,29 @@ func (d *Decoder) fastpathDecMapIntUint8R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapIntUint8X(vp *map[int]uint8, d *Decoder) { - v, changed := f.DecMapIntUint8V(*vp, true, d) - if changed { + if v, changed := f.DecMapIntUint8V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapIntUint8V(v map[int]uint8, canChange bool, +func (fastpathT) DecMapIntUint8V(v map[int]uint8, canChange bool, d *Decoder) (_ map[int]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[int]uint8, xlen) + v = make(map[int]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk int var mv uint8 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -28015,143 +9095,19 @@ func (_ fastpathT) DecMapIntUint8V(v map[int]uint8, canChange bool, } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntUint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int]uint16) - v, changed := fastpathTV.DecMapIntUint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntUint16V(rv2i(rv).(map[int]uint16), false, d) - } -} -func (f fastpathT) DecMapIntUint16X(vp *map[int]uint16, d *Decoder) { - v, changed := f.DecMapIntUint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntUint16V(v map[int]uint16, canChange bool, - d *Decoder) (_ map[int]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[int]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntUint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int]uint32) - v, changed := fastpathTV.DecMapIntUint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntUint32V(rv2i(rv).(map[int]uint32), false, d) - } -} -func (f fastpathT) DecMapIntUint32X(vp *map[int]uint32, d *Decoder) { - v, changed := f.DecMapIntUint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntUint32V(v map[int]uint32, canChange bool, - d *Decoder) (_ map[int]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[int]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapIntUint64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]uint64) - v, changed := fastpathTV.DecMapIntUint64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapIntUint64V(*vp, true, d); changed { *vp = v } } else { @@ -28159,37 +9115,29 @@ func (d *Decoder) fastpathDecMapIntUint64R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapIntUint64X(vp *map[int]uint64, d *Decoder) { - v, changed := f.DecMapIntUint64V(*vp, true, d) - if changed { + if v, changed := f.DecMapIntUint64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapIntUint64V(v map[int]uint64, canChange bool, +func (fastpathT) DecMapIntUint64V(v map[int]uint64, canChange bool, d *Decoder) (_ map[int]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[int]uint64, xlen) + v = make(map[int]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk int var mv uint64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -28198,21 +9146,19 @@ func (_ fastpathT) DecMapIntUint64V(v map[int]uint64, canChange bool, } continue } - mv = dd.DecodeUint64() + mv = d.d.DecodeUint64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapIntUintptrR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]uintptr) - v, changed := fastpathTV.DecMapIntUintptrV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapIntUintptrV(*vp, true, d); changed { *vp = v } } else { @@ -28220,37 +9166,29 @@ func (d *Decoder) fastpathDecMapIntUintptrR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapIntUintptrX(vp *map[int]uintptr, d *Decoder) { - v, changed := f.DecMapIntUintptrV(*vp, true, d) - if changed { + if v, changed := f.DecMapIntUintptrV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapIntUintptrV(v map[int]uintptr, canChange bool, +func (fastpathT) DecMapIntUintptrV(v map[int]uintptr, canChange bool, d *Decoder) (_ map[int]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[int]uintptr, xlen) + v = make(map[int]uintptr, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk int var mv uintptr hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -28259,21 +9197,19 @@ func (_ fastpathT) DecMapIntUintptrV(v map[int]uintptr, canChange bool, } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapIntIntR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]int) - v, changed := fastpathTV.DecMapIntIntV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapIntIntV(*vp, true, d); changed { *vp = v } } else { @@ -28281,37 +9217,29 @@ func (d *Decoder) fastpathDecMapIntIntR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapIntIntX(vp *map[int]int, d *Decoder) { - v, changed := f.DecMapIntIntV(*vp, true, d) - if changed { + if v, changed := f.DecMapIntIntV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapIntIntV(v map[int]int, canChange bool, +func (fastpathT) DecMapIntIntV(v map[int]int, canChange bool, d *Decoder) (_ map[int]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[int]int, xlen) + v = make(map[int]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk int var mv int hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -28320,204 +9248,19 @@ func (_ fastpathT) DecMapIntIntV(v map[int]int, canChange bool, } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntInt8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int]int8) - v, changed := fastpathTV.DecMapIntInt8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntInt8V(rv2i(rv).(map[int]int8), false, d) - } -} -func (f fastpathT) DecMapIntInt8X(vp *map[int]int8, d *Decoder) { - v, changed := f.DecMapIntInt8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntInt8V(v map[int]int8, canChange bool, - d *Decoder) (_ map[int]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[int]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntInt16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int]int16) - v, changed := fastpathTV.DecMapIntInt16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntInt16V(rv2i(rv).(map[int]int16), false, d) - } -} -func (f fastpathT) DecMapIntInt16X(vp *map[int]int16, d *Decoder) { - v, changed := f.DecMapIntInt16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntInt16V(v map[int]int16, canChange bool, - d *Decoder) (_ map[int]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[int]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapIntInt32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int]int32) - v, changed := fastpathTV.DecMapIntInt32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapIntInt32V(rv2i(rv).(map[int]int32), false, d) - } -} -func (f fastpathT) DecMapIntInt32X(vp *map[int]int32, d *Decoder) { - v, changed := f.DecMapIntInt32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapIntInt32V(v map[int]int32, canChange bool, - d *Decoder) (_ map[int]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[int]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapIntInt64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]int64) - v, changed := fastpathTV.DecMapIntInt64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapIntInt64V(*vp, true, d); changed { *vp = v } } else { @@ -28525,37 +9268,29 @@ func (d *Decoder) fastpathDecMapIntInt64R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapIntInt64X(vp *map[int]int64, d *Decoder) { - v, changed := f.DecMapIntInt64V(*vp, true, d) - if changed { + if v, changed := f.DecMapIntInt64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapIntInt64V(v map[int]int64, canChange bool, +func (fastpathT) DecMapIntInt64V(v map[int]int64, canChange bool, d *Decoder) (_ map[int]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[int]int64, xlen) + v = make(map[int]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk int var mv int64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -28564,21 +9299,19 @@ func (_ fastpathT) DecMapIntInt64V(v map[int]int64, canChange bool, } continue } - mv = dd.DecodeInt64() + mv = d.d.DecodeInt64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapIntFloat32R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]float32) - v, changed := fastpathTV.DecMapIntFloat32V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapIntFloat32V(*vp, true, d); changed { *vp = v } } else { @@ -28586,37 +9319,29 @@ func (d *Decoder) fastpathDecMapIntFloat32R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapIntFloat32X(vp *map[int]float32, d *Decoder) { - v, changed := f.DecMapIntFloat32V(*vp, true, d) - if changed { + if v, changed := f.DecMapIntFloat32V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapIntFloat32V(v map[int]float32, canChange bool, +func (fastpathT) DecMapIntFloat32V(v map[int]float32, canChange bool, d *Decoder) (_ map[int]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[int]float32, xlen) + v = make(map[int]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk int var mv float32 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -28625,21 +9350,19 @@ func (_ fastpathT) DecMapIntFloat32V(v map[int]float32, canChange bool, } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(d.decodeFloat32()) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapIntFloat64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]float64) - v, changed := fastpathTV.DecMapIntFloat64V(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapIntFloat64V(*vp, true, d); changed { *vp = v } } else { @@ -28647,37 +9370,29 @@ func (d *Decoder) fastpathDecMapIntFloat64R(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapIntFloat64X(vp *map[int]float64, d *Decoder) { - v, changed := f.DecMapIntFloat64V(*vp, true, d) - if changed { + if v, changed := f.DecMapIntFloat64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapIntFloat64V(v map[int]float64, canChange bool, +func (fastpathT) DecMapIntFloat64V(v map[int]float64, canChange bool, d *Decoder) (_ map[int]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[int]float64, xlen) + v = make(map[int]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk int var mv float64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -28686,21 +9401,19 @@ func (_ fastpathT) DecMapIntFloat64V(v map[int]float64, canChange bool, } continue } - mv = dd.DecodeFloat64() + mv = d.d.DecodeFloat64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapIntBoolR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]bool) - v, changed := fastpathTV.DecMapIntBoolV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapIntBoolV(*vp, true, d); changed { *vp = v } } else { @@ -28708,37 +9421,29 @@ func (d *Decoder) fastpathDecMapIntBoolR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapIntBoolX(vp *map[int]bool, d *Decoder) { - v, changed := f.DecMapIntBoolV(*vp, true, d) - if changed { + if v, changed := f.DecMapIntBoolV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapIntBoolV(v map[int]bool, canChange bool, +func (fastpathT) DecMapIntBoolV(v map[int]bool, canChange bool, d *Decoder) (_ map[int]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[int]bool, xlen) + v = make(map[int]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk int var mv bool hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -28747,2967 +9452,19 @@ func (_ fastpathT) DecMapIntBoolV(v map[int]bool, canChange bool, } continue } - mv = dd.DecodeBool() + mv = d.d.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8IntfR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]interface{}) - v, changed := fastpathTV.DecMapInt8IntfV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8IntfV(rv2i(rv).(map[int8]interface{}), false, d) - } -} -func (f fastpathT) DecMapInt8IntfX(vp *map[int8]interface{}, d *Decoder) { - v, changed := f.DecMapInt8IntfV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8IntfV(v map[int8]interface{}, canChange bool, - d *Decoder) (_ map[int8]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) - v = make(map[int8]interface{}, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset - var mk int8 - var mv interface{} - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8StringR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]string) - v, changed := fastpathTV.DecMapInt8StringV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8StringV(rv2i(rv).(map[int8]string), false, d) - } -} -func (f fastpathT) DecMapInt8StringX(vp *map[int8]string, d *Decoder) { - v, changed := f.DecMapInt8StringV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8StringV(v map[int8]string, canChange bool, - d *Decoder) (_ map[int8]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) - v = make(map[int8]string, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv string - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8UintR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]uint) - v, changed := fastpathTV.DecMapInt8UintV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8UintV(rv2i(rv).(map[int8]uint), false, d) - } -} -func (f fastpathT) DecMapInt8UintX(vp *map[int8]uint, d *Decoder) { - v, changed := f.DecMapInt8UintV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8UintV(v map[int8]uint, canChange bool, - d *Decoder) (_ map[int8]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[int8]uint, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8Uint8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]uint8) - v, changed := fastpathTV.DecMapInt8Uint8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8Uint8V(rv2i(rv).(map[int8]uint8), false, d) - } -} -func (f fastpathT) DecMapInt8Uint8X(vp *map[int8]uint8, d *Decoder) { - v, changed := f.DecMapInt8Uint8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8Uint8V(v map[int8]uint8, canChange bool, - d *Decoder) (_ map[int8]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) - v = make(map[int8]uint8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv uint8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8Uint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]uint16) - v, changed := fastpathTV.DecMapInt8Uint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8Uint16V(rv2i(rv).(map[int8]uint16), false, d) - } -} -func (f fastpathT) DecMapInt8Uint16X(vp *map[int8]uint16, d *Decoder) { - v, changed := f.DecMapInt8Uint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8Uint16V(v map[int8]uint16, canChange bool, - d *Decoder) (_ map[int8]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) - v = make(map[int8]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8Uint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]uint32) - v, changed := fastpathTV.DecMapInt8Uint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8Uint32V(rv2i(rv).(map[int8]uint32), false, d) - } -} -func (f fastpathT) DecMapInt8Uint32X(vp *map[int8]uint32, d *Decoder) { - v, changed := f.DecMapInt8Uint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8Uint32V(v map[int8]uint32, canChange bool, - d *Decoder) (_ map[int8]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[int8]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8Uint64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]uint64) - v, changed := fastpathTV.DecMapInt8Uint64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8Uint64V(rv2i(rv).(map[int8]uint64), false, d) - } -} -func (f fastpathT) DecMapInt8Uint64X(vp *map[int8]uint64, d *Decoder) { - v, changed := f.DecMapInt8Uint64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8Uint64V(v map[int8]uint64, canChange bool, - d *Decoder) (_ map[int8]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[int8]uint64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv uint64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeUint64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8UintptrR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]uintptr) - v, changed := fastpathTV.DecMapInt8UintptrV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8UintptrV(rv2i(rv).(map[int8]uintptr), false, d) - } -} -func (f fastpathT) DecMapInt8UintptrX(vp *map[int8]uintptr, d *Decoder) { - v, changed := f.DecMapInt8UintptrV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8UintptrV(v map[int8]uintptr, canChange bool, - d *Decoder) (_ map[int8]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[int8]uintptr, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv uintptr - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8IntR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]int) - v, changed := fastpathTV.DecMapInt8IntV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8IntV(rv2i(rv).(map[int8]int), false, d) - } -} -func (f fastpathT) DecMapInt8IntX(vp *map[int8]int, d *Decoder) { - v, changed := f.DecMapInt8IntV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8IntV(v map[int8]int, canChange bool, - d *Decoder) (_ map[int8]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[int8]int, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv int - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8Int8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]int8) - v, changed := fastpathTV.DecMapInt8Int8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8Int8V(rv2i(rv).(map[int8]int8), false, d) - } -} -func (f fastpathT) DecMapInt8Int8X(vp *map[int8]int8, d *Decoder) { - v, changed := f.DecMapInt8Int8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8Int8V(v map[int8]int8, canChange bool, - d *Decoder) (_ map[int8]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) - v = make(map[int8]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8Int16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]int16) - v, changed := fastpathTV.DecMapInt8Int16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8Int16V(rv2i(rv).(map[int8]int16), false, d) - } -} -func (f fastpathT) DecMapInt8Int16X(vp *map[int8]int16, d *Decoder) { - v, changed := f.DecMapInt8Int16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8Int16V(v map[int8]int16, canChange bool, - d *Decoder) (_ map[int8]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) - v = make(map[int8]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8Int32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]int32) - v, changed := fastpathTV.DecMapInt8Int32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8Int32V(rv2i(rv).(map[int8]int32), false, d) - } -} -func (f fastpathT) DecMapInt8Int32X(vp *map[int8]int32, d *Decoder) { - v, changed := f.DecMapInt8Int32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8Int32V(v map[int8]int32, canChange bool, - d *Decoder) (_ map[int8]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[int8]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8Int64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]int64) - v, changed := fastpathTV.DecMapInt8Int64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8Int64V(rv2i(rv).(map[int8]int64), false, d) - } -} -func (f fastpathT) DecMapInt8Int64X(vp *map[int8]int64, d *Decoder) { - v, changed := f.DecMapInt8Int64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8Int64V(v map[int8]int64, canChange bool, - d *Decoder) (_ map[int8]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[int8]int64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv int64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeInt64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8Float32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]float32) - v, changed := fastpathTV.DecMapInt8Float32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8Float32V(rv2i(rv).(map[int8]float32), false, d) - } -} -func (f fastpathT) DecMapInt8Float32X(vp *map[int8]float32, d *Decoder) { - v, changed := f.DecMapInt8Float32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8Float32V(v map[int8]float32, canChange bool, - d *Decoder) (_ map[int8]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[int8]float32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8Float64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]float64) - v, changed := fastpathTV.DecMapInt8Float64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8Float64V(rv2i(rv).(map[int8]float64), false, d) - } -} -func (f fastpathT) DecMapInt8Float64X(vp *map[int8]float64, d *Decoder) { - v, changed := f.DecMapInt8Float64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8Float64V(v map[int8]float64, canChange bool, - d *Decoder) (_ map[int8]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[int8]float64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv float64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeFloat64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt8BoolR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int8]bool) - v, changed := fastpathTV.DecMapInt8BoolV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt8BoolV(rv2i(rv).(map[int8]bool), false, d) - } -} -func (f fastpathT) DecMapInt8BoolX(vp *map[int8]bool, d *Decoder) { - v, changed := f.DecMapInt8BoolV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt8BoolV(v map[int8]bool, canChange bool, - d *Decoder) (_ map[int8]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) - v = make(map[int8]bool, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int8 - var mv bool - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16IntfR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]interface{}) - v, changed := fastpathTV.DecMapInt16IntfV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16IntfV(rv2i(rv).(map[int16]interface{}), false, d) - } -} -func (f fastpathT) DecMapInt16IntfX(vp *map[int16]interface{}, d *Decoder) { - v, changed := f.DecMapInt16IntfV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16IntfV(v map[int16]interface{}, canChange bool, - d *Decoder) (_ map[int16]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) - v = make(map[int16]interface{}, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset - var mk int16 - var mv interface{} - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16StringR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]string) - v, changed := fastpathTV.DecMapInt16StringV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16StringV(rv2i(rv).(map[int16]string), false, d) - } -} -func (f fastpathT) DecMapInt16StringX(vp *map[int16]string, d *Decoder) { - v, changed := f.DecMapInt16StringV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16StringV(v map[int16]string, canChange bool, - d *Decoder) (_ map[int16]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) - v = make(map[int16]string, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv string - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16UintR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]uint) - v, changed := fastpathTV.DecMapInt16UintV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16UintV(rv2i(rv).(map[int16]uint), false, d) - } -} -func (f fastpathT) DecMapInt16UintX(vp *map[int16]uint, d *Decoder) { - v, changed := f.DecMapInt16UintV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16UintV(v map[int16]uint, canChange bool, - d *Decoder) (_ map[int16]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[int16]uint, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16Uint8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]uint8) - v, changed := fastpathTV.DecMapInt16Uint8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16Uint8V(rv2i(rv).(map[int16]uint8), false, d) - } -} -func (f fastpathT) DecMapInt16Uint8X(vp *map[int16]uint8, d *Decoder) { - v, changed := f.DecMapInt16Uint8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16Uint8V(v map[int16]uint8, canChange bool, - d *Decoder) (_ map[int16]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) - v = make(map[int16]uint8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv uint8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16Uint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]uint16) - v, changed := fastpathTV.DecMapInt16Uint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16Uint16V(rv2i(rv).(map[int16]uint16), false, d) - } -} -func (f fastpathT) DecMapInt16Uint16X(vp *map[int16]uint16, d *Decoder) { - v, changed := f.DecMapInt16Uint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16Uint16V(v map[int16]uint16, canChange bool, - d *Decoder) (_ map[int16]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 4) - v = make(map[int16]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16Uint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]uint32) - v, changed := fastpathTV.DecMapInt16Uint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16Uint32V(rv2i(rv).(map[int16]uint32), false, d) - } -} -func (f fastpathT) DecMapInt16Uint32X(vp *map[int16]uint32, d *Decoder) { - v, changed := f.DecMapInt16Uint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16Uint32V(v map[int16]uint32, canChange bool, - d *Decoder) (_ map[int16]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) - v = make(map[int16]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16Uint64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]uint64) - v, changed := fastpathTV.DecMapInt16Uint64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16Uint64V(rv2i(rv).(map[int16]uint64), false, d) - } -} -func (f fastpathT) DecMapInt16Uint64X(vp *map[int16]uint64, d *Decoder) { - v, changed := f.DecMapInt16Uint64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16Uint64V(v map[int16]uint64, canChange bool, - d *Decoder) (_ map[int16]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[int16]uint64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv uint64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeUint64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16UintptrR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]uintptr) - v, changed := fastpathTV.DecMapInt16UintptrV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16UintptrV(rv2i(rv).(map[int16]uintptr), false, d) - } -} -func (f fastpathT) DecMapInt16UintptrX(vp *map[int16]uintptr, d *Decoder) { - v, changed := f.DecMapInt16UintptrV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16UintptrV(v map[int16]uintptr, canChange bool, - d *Decoder) (_ map[int16]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[int16]uintptr, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv uintptr - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16IntR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]int) - v, changed := fastpathTV.DecMapInt16IntV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16IntV(rv2i(rv).(map[int16]int), false, d) - } -} -func (f fastpathT) DecMapInt16IntX(vp *map[int16]int, d *Decoder) { - v, changed := f.DecMapInt16IntV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16IntV(v map[int16]int, canChange bool, - d *Decoder) (_ map[int16]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[int16]int, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv int - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16Int8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]int8) - v, changed := fastpathTV.DecMapInt16Int8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16Int8V(rv2i(rv).(map[int16]int8), false, d) - } -} -func (f fastpathT) DecMapInt16Int8X(vp *map[int16]int8, d *Decoder) { - v, changed := f.DecMapInt16Int8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16Int8V(v map[int16]int8, canChange bool, - d *Decoder) (_ map[int16]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) - v = make(map[int16]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16Int16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]int16) - v, changed := fastpathTV.DecMapInt16Int16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16Int16V(rv2i(rv).(map[int16]int16), false, d) - } -} -func (f fastpathT) DecMapInt16Int16X(vp *map[int16]int16, d *Decoder) { - v, changed := f.DecMapInt16Int16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16Int16V(v map[int16]int16, canChange bool, - d *Decoder) (_ map[int16]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 4) - v = make(map[int16]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16Int32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]int32) - v, changed := fastpathTV.DecMapInt16Int32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16Int32V(rv2i(rv).(map[int16]int32), false, d) - } -} -func (f fastpathT) DecMapInt16Int32X(vp *map[int16]int32, d *Decoder) { - v, changed := f.DecMapInt16Int32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16Int32V(v map[int16]int32, canChange bool, - d *Decoder) (_ map[int16]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) - v = make(map[int16]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16Int64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]int64) - v, changed := fastpathTV.DecMapInt16Int64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16Int64V(rv2i(rv).(map[int16]int64), false, d) - } -} -func (f fastpathT) DecMapInt16Int64X(vp *map[int16]int64, d *Decoder) { - v, changed := f.DecMapInt16Int64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16Int64V(v map[int16]int64, canChange bool, - d *Decoder) (_ map[int16]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[int16]int64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv int64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeInt64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16Float32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]float32) - v, changed := fastpathTV.DecMapInt16Float32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16Float32V(rv2i(rv).(map[int16]float32), false, d) - } -} -func (f fastpathT) DecMapInt16Float32X(vp *map[int16]float32, d *Decoder) { - v, changed := f.DecMapInt16Float32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16Float32V(v map[int16]float32, canChange bool, - d *Decoder) (_ map[int16]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) - v = make(map[int16]float32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16Float64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]float64) - v, changed := fastpathTV.DecMapInt16Float64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16Float64V(rv2i(rv).(map[int16]float64), false, d) - } -} -func (f fastpathT) DecMapInt16Float64X(vp *map[int16]float64, d *Decoder) { - v, changed := f.DecMapInt16Float64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16Float64V(v map[int16]float64, canChange bool, - d *Decoder) (_ map[int16]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[int16]float64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv float64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeFloat64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt16BoolR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int16]bool) - v, changed := fastpathTV.DecMapInt16BoolV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt16BoolV(rv2i(rv).(map[int16]bool), false, d) - } -} -func (f fastpathT) DecMapInt16BoolX(vp *map[int16]bool, d *Decoder) { - v, changed := f.DecMapInt16BoolV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt16BoolV(v map[int16]bool, canChange bool, - d *Decoder) (_ map[int16]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) - v = make(map[int16]bool, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int16 - var mv bool - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32IntfR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]interface{}) - v, changed := fastpathTV.DecMapInt32IntfV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32IntfV(rv2i(rv).(map[int32]interface{}), false, d) - } -} -func (f fastpathT) DecMapInt32IntfX(vp *map[int32]interface{}, d *Decoder) { - v, changed := f.DecMapInt32IntfV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, canChange bool, - d *Decoder) (_ map[int32]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) - v = make(map[int32]interface{}, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset - var mk int32 - var mv interface{} - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32StringR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]string) - v, changed := fastpathTV.DecMapInt32StringV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32StringV(rv2i(rv).(map[int32]string), false, d) - } -} -func (f fastpathT) DecMapInt32StringX(vp *map[int32]string, d *Decoder) { - v, changed := f.DecMapInt32StringV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32StringV(v map[int32]string, canChange bool, - d *Decoder) (_ map[int32]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) - v = make(map[int32]string, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv string - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32UintR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]uint) - v, changed := fastpathTV.DecMapInt32UintV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32UintV(rv2i(rv).(map[int32]uint), false, d) - } -} -func (f fastpathT) DecMapInt32UintX(vp *map[int32]uint, d *Decoder) { - v, changed := f.DecMapInt32UintV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32UintV(v map[int32]uint, canChange bool, - d *Decoder) (_ map[int32]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[int32]uint, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32Uint8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]uint8) - v, changed := fastpathTV.DecMapInt32Uint8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32Uint8V(rv2i(rv).(map[int32]uint8), false, d) - } -} -func (f fastpathT) DecMapInt32Uint8X(vp *map[int32]uint8, d *Decoder) { - v, changed := f.DecMapInt32Uint8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32Uint8V(v map[int32]uint8, canChange bool, - d *Decoder) (_ map[int32]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[int32]uint8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv uint8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32Uint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]uint16) - v, changed := fastpathTV.DecMapInt32Uint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32Uint16V(rv2i(rv).(map[int32]uint16), false, d) - } -} -func (f fastpathT) DecMapInt32Uint16X(vp *map[int32]uint16, d *Decoder) { - v, changed := f.DecMapInt32Uint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32Uint16V(v map[int32]uint16, canChange bool, - d *Decoder) (_ map[int32]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) - v = make(map[int32]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32Uint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]uint32) - v, changed := fastpathTV.DecMapInt32Uint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32Uint32V(rv2i(rv).(map[int32]uint32), false, d) - } -} -func (f fastpathT) DecMapInt32Uint32X(vp *map[int32]uint32, d *Decoder) { - v, changed := f.DecMapInt32Uint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32Uint32V(v map[int32]uint32, canChange bool, - d *Decoder) (_ map[int32]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) - v = make(map[int32]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32Uint64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]uint64) - v, changed := fastpathTV.DecMapInt32Uint64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32Uint64V(rv2i(rv).(map[int32]uint64), false, d) - } -} -func (f fastpathT) DecMapInt32Uint64X(vp *map[int32]uint64, d *Decoder) { - v, changed := f.DecMapInt32Uint64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32Uint64V(v map[int32]uint64, canChange bool, - d *Decoder) (_ map[int32]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[int32]uint64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv uint64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeUint64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32UintptrR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]uintptr) - v, changed := fastpathTV.DecMapInt32UintptrV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32UintptrV(rv2i(rv).(map[int32]uintptr), false, d) - } -} -func (f fastpathT) DecMapInt32UintptrX(vp *map[int32]uintptr, d *Decoder) { - v, changed := f.DecMapInt32UintptrV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32UintptrV(v map[int32]uintptr, canChange bool, - d *Decoder) (_ map[int32]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[int32]uintptr, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv uintptr - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32IntR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]int) - v, changed := fastpathTV.DecMapInt32IntV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32IntV(rv2i(rv).(map[int32]int), false, d) - } -} -func (f fastpathT) DecMapInt32IntX(vp *map[int32]int, d *Decoder) { - v, changed := f.DecMapInt32IntV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32IntV(v map[int32]int, canChange bool, - d *Decoder) (_ map[int32]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[int32]int, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv int - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32Int8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]int8) - v, changed := fastpathTV.DecMapInt32Int8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32Int8V(rv2i(rv).(map[int32]int8), false, d) - } -} -func (f fastpathT) DecMapInt32Int8X(vp *map[int32]int8, d *Decoder) { - v, changed := f.DecMapInt32Int8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32Int8V(v map[int32]int8, canChange bool, - d *Decoder) (_ map[int32]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[int32]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32Int16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]int16) - v, changed := fastpathTV.DecMapInt32Int16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32Int16V(rv2i(rv).(map[int32]int16), false, d) - } -} -func (f fastpathT) DecMapInt32Int16X(vp *map[int32]int16, d *Decoder) { - v, changed := f.DecMapInt32Int16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32Int16V(v map[int32]int16, canChange bool, - d *Decoder) (_ map[int32]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) - v = make(map[int32]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32Int32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]int32) - v, changed := fastpathTV.DecMapInt32Int32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32Int32V(rv2i(rv).(map[int32]int32), false, d) - } -} -func (f fastpathT) DecMapInt32Int32X(vp *map[int32]int32, d *Decoder) { - v, changed := f.DecMapInt32Int32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32Int32V(v map[int32]int32, canChange bool, - d *Decoder) (_ map[int32]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) - v = make(map[int32]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32Int64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]int64) - v, changed := fastpathTV.DecMapInt32Int64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32Int64V(rv2i(rv).(map[int32]int64), false, d) - } -} -func (f fastpathT) DecMapInt32Int64X(vp *map[int32]int64, d *Decoder) { - v, changed := f.DecMapInt32Int64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32Int64V(v map[int32]int64, canChange bool, - d *Decoder) (_ map[int32]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[int32]int64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv int64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeInt64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32Float32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]float32) - v, changed := fastpathTV.DecMapInt32Float32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32Float32V(rv2i(rv).(map[int32]float32), false, d) - } -} -func (f fastpathT) DecMapInt32Float32X(vp *map[int32]float32, d *Decoder) { - v, changed := f.DecMapInt32Float32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32Float32V(v map[int32]float32, canChange bool, - d *Decoder) (_ map[int32]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) - v = make(map[int32]float32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32Float64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]float64) - v, changed := fastpathTV.DecMapInt32Float64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32Float64V(rv2i(rv).(map[int32]float64), false, d) - } -} -func (f fastpathT) DecMapInt32Float64X(vp *map[int32]float64, d *Decoder) { - v, changed := f.DecMapInt32Float64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32Float64V(v map[int32]float64, canChange bool, - d *Decoder) (_ map[int32]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[int32]float64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv float64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeFloat64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt32BoolR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int32]bool) - v, changed := fastpathTV.DecMapInt32BoolV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt32BoolV(rv2i(rv).(map[int32]bool), false, d) - } -} -func (f fastpathT) DecMapInt32BoolX(vp *map[int32]bool, d *Decoder) { - v, changed := f.DecMapInt32BoolV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt32BoolV(v map[int32]bool, canChange bool, - d *Decoder) (_ map[int32]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[int32]bool, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int32 - var mv bool - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapInt64IntfR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int64]interface{}) - v, changed := fastpathTV.DecMapInt64IntfV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapInt64IntfV(*vp, true, d); changed { *vp = v } } else { @@ -31715,38 +9472,30 @@ func (d *Decoder) fastpathDecMapInt64IntfR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapInt64IntfX(vp *map[int64]interface{}, d *Decoder) { - v, changed := f.DecMapInt64IntfV(*vp, true, d) - if changed { + if v, changed := f.DecMapInt64IntfV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, canChange bool, +func (fastpathT) DecMapInt64IntfV(v map[int64]interface{}, canChange bool, d *Decoder) (_ map[int64]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[int64]interface{}, xlen) + v = make(map[int64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk int64 var mv interface{} hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeInt64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -31765,16 +9514,14 @@ func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, canChange bool, v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } func (d *Decoder) fastpathDecMapInt64StringR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int64]string) - v, changed := fastpathTV.DecMapInt64StringV(*vp, true, d) - if changed { + if v, changed := fastpathTV.DecMapInt64StringV(*vp, true, d); changed { *vp = v } } else { @@ -31782,37 +9529,29 @@ func (d *Decoder) fastpathDecMapInt64StringR(f *codecFnInfo, rv reflect.Value) { } } func (f fastpathT) DecMapInt64StringX(vp *map[int64]string, d *Decoder) { - v, changed := f.DecMapInt64StringV(*vp, true, d) - if changed { + if v, changed := f.DecMapInt64StringV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapInt64StringV(v map[int64]string, canChange bool, +func (fastpathT) DecMapInt64StringV(v map[int64]string, canChange bool, d *Decoder) (_ map[int64]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) - v = make(map[int64]string, xlen) + v = make(map[int64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() var mk int64 var mv string hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeInt64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -31821,914 +9560,50 @@ func (_ fastpathT) DecMapInt64StringV(v map[int64]string, canChange bool, } continue } - mv = dd.DecodeString() + mv = d.d.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } -func (d *Decoder) fastpathDecMapInt64UintR(f *codecFnInfo, rv reflect.Value) { +func (d *Decoder) fastpathDecMapInt64BytesR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]uint) - v, changed := fastpathTV.DecMapInt64UintV(*vp, true, d) - if changed { + vp := rv2i(rv).(*map[int64][]byte) + if v, changed := fastpathTV.DecMapInt64BytesV(*vp, true, d); changed { *vp = v } } else { - fastpathTV.DecMapInt64UintV(rv2i(rv).(map[int64]uint), false, d) + fastpathTV.DecMapInt64BytesV(rv2i(rv).(map[int64][]byte), false, d) } } -func (f fastpathT) DecMapInt64UintX(vp *map[int64]uint, d *Decoder) { - v, changed := f.DecMapInt64UintV(*vp, true, d) - if changed { +func (f fastpathT) DecMapInt64BytesX(vp *map[int64][]byte, d *Decoder) { + if v, changed := f.DecMapInt64BytesV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapInt64UintV(v map[int64]uint, canChange bool, - d *Decoder) (_ map[int64]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() +func (fastpathT) DecMapInt64BytesV(v map[int64][]byte, canChange bool, + d *Decoder) (_ map[int64][]byte, changed bool) { + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[int64]uint, xlen) + v = make(map[int64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() + mapGet := v != nil && !d.h.MapValueReset var mk int64 - var mv uint + var mv []byte hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt64Uint8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]uint8) - v, changed := fastpathTV.DecMapInt64Uint8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt64Uint8V(rv2i(rv).(map[int64]uint8), false, d) - } -} -func (f fastpathT) DecMapInt64Uint8X(vp *map[int64]uint8, d *Decoder) { - v, changed := f.DecMapInt64Uint8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt64Uint8V(v map[int64]uint8, canChange bool, - d *Decoder) (_ map[int64]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[int64]uint8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int64 - var mv uint8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt64Uint16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]uint16) - v, changed := fastpathTV.DecMapInt64Uint16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt64Uint16V(rv2i(rv).(map[int64]uint16), false, d) - } -} -func (f fastpathT) DecMapInt64Uint16X(vp *map[int64]uint16, d *Decoder) { - v, changed := f.DecMapInt64Uint16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt64Uint16V(v map[int64]uint16, canChange bool, - d *Decoder) (_ map[int64]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[int64]uint16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int64 - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt64Uint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]uint32) - v, changed := fastpathTV.DecMapInt64Uint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt64Uint32V(rv2i(rv).(map[int64]uint32), false, d) - } -} -func (f fastpathT) DecMapInt64Uint32X(vp *map[int64]uint32, d *Decoder) { - v, changed := f.DecMapInt64Uint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt64Uint32V(v map[int64]uint32, canChange bool, - d *Decoder) (_ map[int64]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[int64]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int64 - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt64Uint64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]uint64) - v, changed := fastpathTV.DecMapInt64Uint64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt64Uint64V(rv2i(rv).(map[int64]uint64), false, d) - } -} -func (f fastpathT) DecMapInt64Uint64X(vp *map[int64]uint64, d *Decoder) { - v, changed := f.DecMapInt64Uint64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt64Uint64V(v map[int64]uint64, canChange bool, - d *Decoder) (_ map[int64]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[int64]uint64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int64 - var mv uint64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeUint64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt64UintptrR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]uintptr) - v, changed := fastpathTV.DecMapInt64UintptrV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt64UintptrV(rv2i(rv).(map[int64]uintptr), false, d) - } -} -func (f fastpathT) DecMapInt64UintptrX(vp *map[int64]uintptr, d *Decoder) { - v, changed := f.DecMapInt64UintptrV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, canChange bool, - d *Decoder) (_ map[int64]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[int64]uintptr, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int64 - var mv uintptr - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt64IntR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]int) - v, changed := fastpathTV.DecMapInt64IntV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt64IntV(rv2i(rv).(map[int64]int), false, d) - } -} -func (f fastpathT) DecMapInt64IntX(vp *map[int64]int, d *Decoder) { - v, changed := f.DecMapInt64IntV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt64IntV(v map[int64]int, canChange bool, - d *Decoder) (_ map[int64]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[int64]int, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int64 - var mv int - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt64Int8R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]int8) - v, changed := fastpathTV.DecMapInt64Int8V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt64Int8V(rv2i(rv).(map[int64]int8), false, d) - } -} -func (f fastpathT) DecMapInt64Int8X(vp *map[int64]int8, d *Decoder) { - v, changed := f.DecMapInt64Int8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt64Int8V(v map[int64]int8, canChange bool, - d *Decoder) (_ map[int64]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[int64]int8, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int64 - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt64Int16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]int16) - v, changed := fastpathTV.DecMapInt64Int16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt64Int16V(rv2i(rv).(map[int64]int16), false, d) - } -} -func (f fastpathT) DecMapInt64Int16X(vp *map[int64]int16, d *Decoder) { - v, changed := f.DecMapInt64Int16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt64Int16V(v map[int64]int16, canChange bool, - d *Decoder) (_ map[int64]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) - v = make(map[int64]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int64 - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt64Int32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]int32) - v, changed := fastpathTV.DecMapInt64Int32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt64Int32V(rv2i(rv).(map[int64]int32), false, d) - } -} -func (f fastpathT) DecMapInt64Int32X(vp *map[int64]int32, d *Decoder) { - v, changed := f.DecMapInt64Int32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt64Int32V(v map[int64]int32, canChange bool, - d *Decoder) (_ map[int64]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[int64]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int64 - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt64Int64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]int64) - v, changed := fastpathTV.DecMapInt64Int64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt64Int64V(rv2i(rv).(map[int64]int64), false, d) - } -} -func (f fastpathT) DecMapInt64Int64X(vp *map[int64]int64, d *Decoder) { - v, changed := f.DecMapInt64Int64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt64Int64V(v map[int64]int64, canChange bool, - d *Decoder) (_ map[int64]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[int64]int64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int64 - var mv int64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeInt64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt64Float32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]float32) - v, changed := fastpathTV.DecMapInt64Float32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt64Float32V(rv2i(rv).(map[int64]float32), false, d) - } -} -func (f fastpathT) DecMapInt64Float32X(vp *map[int64]float32, d *Decoder) { - v, changed := f.DecMapInt64Float32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt64Float32V(v map[int64]float32, canChange bool, - d *Decoder) (_ map[int64]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) - v = make(map[int64]float32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int64 - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt64Float64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]float64) - v, changed := fastpathTV.DecMapInt64Float64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt64Float64V(rv2i(rv).(map[int64]float64), false, d) - } -} -func (f fastpathT) DecMapInt64Float64X(vp *map[int64]float64, d *Decoder) { - v, changed := f.DecMapInt64Float64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt64Float64V(v map[int64]float64, canChange bool, - d *Decoder) (_ map[int64]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) - v = make(map[int64]float64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int64 - var mv float64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = dd.DecodeFloat64() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapInt64BoolR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[int64]bool) - v, changed := fastpathTV.DecMapInt64BoolV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapInt64BoolV(rv2i(rv).(map[int64]bool), false, d) - } -} -func (f fastpathT) DecMapInt64BoolX(vp *map[int64]bool, d *Decoder) { - v, changed := f.DecMapInt64BoolV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapInt64BoolV(v map[int64]bool, canChange bool, - d *Decoder) (_ map[int64]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[int64]bool, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk int64 - var mv bool - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeInt64() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapBoolIntfR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]interface{}) - v, changed := fastpathTV.DecMapBoolIntfV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapBoolIntfV(rv2i(rv).(map[bool]interface{}), false, d) - } -} -func (f fastpathT) DecMapBoolIntfX(vp *map[bool]interface{}, d *Decoder) { - v, changed := f.DecMapBoolIntfV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, canChange bool, - d *Decoder) (_ map[bool]interface{}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) - v = make(map[bool]interface{}, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset - var mk bool - var mv interface{} - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeInt64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -32742,120 +9617,49 @@ func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, canChange bool, } else { mv = nil } - d.decode(&mv) + mv = d.d.DecodeBytes(mv, false) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } -func (d *Decoder) fastpathDecMapBoolStringR(f *codecFnInfo, rv reflect.Value) { +func (d *Decoder) fastpathDecMapInt64UintR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]string) - v, changed := fastpathTV.DecMapBoolStringV(*vp, true, d) - if changed { + vp := rv2i(rv).(*map[int64]uint) + if v, changed := fastpathTV.DecMapInt64UintV(*vp, true, d); changed { *vp = v } } else { - fastpathTV.DecMapBoolStringV(rv2i(rv).(map[bool]string), false, d) + fastpathTV.DecMapInt64UintV(rv2i(rv).(map[int64]uint), false, d) } } -func (f fastpathT) DecMapBoolStringX(vp *map[bool]string, d *Decoder) { - v, changed := f.DecMapBoolStringV(*vp, true, d) - if changed { +func (f fastpathT) DecMapInt64UintX(vp *map[int64]uint, d *Decoder) { + if v, changed := f.DecMapInt64UintV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapBoolStringV(v map[bool]string, canChange bool, - d *Decoder) (_ map[bool]string, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() +func (fastpathT) DecMapInt64UintV(v map[int64]uint, canChange bool, + d *Decoder) (_ map[int64]uint, changed bool) { + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) - v = make(map[bool]string, xlen) + v = make(map[int64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() - var mk bool - var mv string - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapBoolUintR(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]uint) - v, changed := fastpathTV.DecMapBoolUintV(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapBoolUintV(rv2i(rv).(map[bool]uint), false, d) - } -} -func (f fastpathT) DecMapBoolUintX(vp *map[bool]uint, d *Decoder) { - v, changed := f.DecMapBoolUintV(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, canChange bool, - d *Decoder) (_ map[bool]uint, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[bool]uint, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk bool + var mk int64 var mv uint hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeInt64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -32864,59 +9668,49 @@ func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, canChange bool, } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } -func (d *Decoder) fastpathDecMapBoolUint8R(f *codecFnInfo, rv reflect.Value) { +func (d *Decoder) fastpathDecMapInt64Uint8R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]uint8) - v, changed := fastpathTV.DecMapBoolUint8V(*vp, true, d) - if changed { + vp := rv2i(rv).(*map[int64]uint8) + if v, changed := fastpathTV.DecMapInt64Uint8V(*vp, true, d); changed { *vp = v } } else { - fastpathTV.DecMapBoolUint8V(rv2i(rv).(map[bool]uint8), false, d) + fastpathTV.DecMapInt64Uint8V(rv2i(rv).(map[int64]uint8), false, d) } } -func (f fastpathT) DecMapBoolUint8X(vp *map[bool]uint8, d *Decoder) { - v, changed := f.DecMapBoolUint8V(*vp, true, d) - if changed { +func (f fastpathT) DecMapInt64Uint8X(vp *map[int64]uint8, d *Decoder) { + if v, changed := f.DecMapInt64Uint8V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapBoolUint8V(v map[bool]uint8, canChange bool, - d *Decoder) (_ map[bool]uint8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() +func (fastpathT) DecMapInt64Uint8V(v map[int64]uint8, canChange bool, + d *Decoder) (_ map[int64]uint8, changed bool) { + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) - v = make(map[bool]uint8, xlen) + v = make(map[int64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() - var mk bool + var mk int64 var mv uint8 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeInt64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -32925,181 +9719,49 @@ func (_ fastpathT) DecMapBoolUint8V(v map[bool]uint8, canChange bool, } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } -func (d *Decoder) fastpathDecMapBoolUint16R(f *codecFnInfo, rv reflect.Value) { +func (d *Decoder) fastpathDecMapInt64Uint64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]uint16) - v, changed := fastpathTV.DecMapBoolUint16V(*vp, true, d) - if changed { + vp := rv2i(rv).(*map[int64]uint64) + if v, changed := fastpathTV.DecMapInt64Uint64V(*vp, true, d); changed { *vp = v } } else { - fastpathTV.DecMapBoolUint16V(rv2i(rv).(map[bool]uint16), false, d) + fastpathTV.DecMapInt64Uint64V(rv2i(rv).(map[int64]uint64), false, d) } } -func (f fastpathT) DecMapBoolUint16X(vp *map[bool]uint16, d *Decoder) { - v, changed := f.DecMapBoolUint16V(*vp, true, d) - if changed { +func (f fastpathT) DecMapInt64Uint64X(vp *map[int64]uint64, d *Decoder) { + if v, changed := f.DecMapInt64Uint64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapBoolUint16V(v map[bool]uint16, canChange bool, - d *Decoder) (_ map[bool]uint16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() +func (fastpathT) DecMapInt64Uint64V(v map[int64]uint64, canChange bool, + d *Decoder) (_ map[int64]uint64, changed bool) { + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) - v = make(map[bool]uint16, xlen) + v = make(map[int64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() - var mk bool - var mv uint16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapBoolUint32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]uint32) - v, changed := fastpathTV.DecMapBoolUint32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapBoolUint32V(rv2i(rv).(map[bool]uint32), false, d) - } -} -func (f fastpathT) DecMapBoolUint32X(vp *map[bool]uint32, d *Decoder) { - v, changed := f.DecMapBoolUint32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapBoolUint32V(v map[bool]uint32, canChange bool, - d *Decoder) (_ map[bool]uint32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[bool]uint32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk bool - var mv uint32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapBoolUint64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]uint64) - v, changed := fastpathTV.DecMapBoolUint64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapBoolUint64V(rv2i(rv).(map[bool]uint64), false, d) - } -} -func (f fastpathT) DecMapBoolUint64X(vp *map[bool]uint64, d *Decoder) { - v, changed := f.DecMapBoolUint64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapBoolUint64V(v map[bool]uint64, canChange bool, - d *Decoder) (_ map[bool]uint64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[bool]uint64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk bool + var mk int64 var mv uint64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeInt64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -33108,59 +9770,49 @@ func (_ fastpathT) DecMapBoolUint64V(v map[bool]uint64, canChange bool, } continue } - mv = dd.DecodeUint64() + mv = d.d.DecodeUint64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } -func (d *Decoder) fastpathDecMapBoolUintptrR(f *codecFnInfo, rv reflect.Value) { +func (d *Decoder) fastpathDecMapInt64UintptrR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]uintptr) - v, changed := fastpathTV.DecMapBoolUintptrV(*vp, true, d) - if changed { + vp := rv2i(rv).(*map[int64]uintptr) + if v, changed := fastpathTV.DecMapInt64UintptrV(*vp, true, d); changed { *vp = v } } else { - fastpathTV.DecMapBoolUintptrV(rv2i(rv).(map[bool]uintptr), false, d) + fastpathTV.DecMapInt64UintptrV(rv2i(rv).(map[int64]uintptr), false, d) } } -func (f fastpathT) DecMapBoolUintptrX(vp *map[bool]uintptr, d *Decoder) { - v, changed := f.DecMapBoolUintptrV(*vp, true, d) - if changed { +func (f fastpathT) DecMapInt64UintptrX(vp *map[int64]uintptr, d *Decoder) { + if v, changed := f.DecMapInt64UintptrV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, canChange bool, - d *Decoder) (_ map[bool]uintptr, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() +func (fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, canChange bool, + d *Decoder) (_ map[int64]uintptr, changed bool) { + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[bool]uintptr, xlen) + v = make(map[int64]uintptr, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() - var mk bool + var mk int64 var mv uintptr hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeInt64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -33169,59 +9821,49 @@ func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, canChange bool, } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } -func (d *Decoder) fastpathDecMapBoolIntR(f *codecFnInfo, rv reflect.Value) { +func (d *Decoder) fastpathDecMapInt64IntR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]int) - v, changed := fastpathTV.DecMapBoolIntV(*vp, true, d) - if changed { + vp := rv2i(rv).(*map[int64]int) + if v, changed := fastpathTV.DecMapInt64IntV(*vp, true, d); changed { *vp = v } } else { - fastpathTV.DecMapBoolIntV(rv2i(rv).(map[bool]int), false, d) + fastpathTV.DecMapInt64IntV(rv2i(rv).(map[int64]int), false, d) } } -func (f fastpathT) DecMapBoolIntX(vp *map[bool]int, d *Decoder) { - v, changed := f.DecMapBoolIntV(*vp, true, d) - if changed { +func (f fastpathT) DecMapInt64IntX(vp *map[int64]int, d *Decoder) { + if v, changed := f.DecMapInt64IntV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapBoolIntV(v map[bool]int, canChange bool, - d *Decoder) (_ map[bool]int, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() +func (fastpathT) DecMapInt64IntV(v map[int64]int, canChange bool, + d *Decoder) (_ map[int64]int, changed bool) { + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[bool]int, xlen) + v = make(map[int64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() - var mk bool + var mk int64 var mv int hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeInt64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -33230,242 +9872,49 @@ func (_ fastpathT) DecMapBoolIntV(v map[bool]int, canChange bool, } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } -func (d *Decoder) fastpathDecMapBoolInt8R(f *codecFnInfo, rv reflect.Value) { +func (d *Decoder) fastpathDecMapInt64Int64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]int8) - v, changed := fastpathTV.DecMapBoolInt8V(*vp, true, d) - if changed { + vp := rv2i(rv).(*map[int64]int64) + if v, changed := fastpathTV.DecMapInt64Int64V(*vp, true, d); changed { *vp = v } } else { - fastpathTV.DecMapBoolInt8V(rv2i(rv).(map[bool]int8), false, d) + fastpathTV.DecMapInt64Int64V(rv2i(rv).(map[int64]int64), false, d) } } -func (f fastpathT) DecMapBoolInt8X(vp *map[bool]int8, d *Decoder) { - v, changed := f.DecMapBoolInt8V(*vp, true, d) - if changed { +func (f fastpathT) DecMapInt64Int64X(vp *map[int64]int64, d *Decoder) { + if v, changed := f.DecMapInt64Int64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapBoolInt8V(v map[bool]int8, canChange bool, - d *Decoder) (_ map[bool]int8, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() +func (fastpathT) DecMapInt64Int64V(v map[int64]int64, canChange bool, + d *Decoder) (_ map[int64]int64, changed bool) { + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) - v = make(map[bool]int8, xlen) + v = make(map[int64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() - var mk bool - var mv int8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapBoolInt16R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]int16) - v, changed := fastpathTV.DecMapBoolInt16V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapBoolInt16V(rv2i(rv).(map[bool]int16), false, d) - } -} -func (f fastpathT) DecMapBoolInt16X(vp *map[bool]int16, d *Decoder) { - v, changed := f.DecMapBoolInt16V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapBoolInt16V(v map[bool]int16, canChange bool, - d *Decoder) (_ map[bool]int16, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) - v = make(map[bool]int16, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk bool - var mv int16 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapBoolInt32R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]int32) - v, changed := fastpathTV.DecMapBoolInt32V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapBoolInt32V(rv2i(rv).(map[bool]int32), false, d) - } -} -func (f fastpathT) DecMapBoolInt32X(vp *map[bool]int32, d *Decoder) { - v, changed := f.DecMapBoolInt32V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapBoolInt32V(v map[bool]int32, canChange bool, - d *Decoder) (_ map[bool]int32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[bool]int32, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk bool - var mv int32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) - if v != nil { - v[mk] = mv - } - } - dd.ReadMapEnd() - d.depthDecr() - return v, changed -} - -func (d *Decoder) fastpathDecMapBoolInt64R(f *codecFnInfo, rv reflect.Value) { - if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]int64) - v, changed := fastpathTV.DecMapBoolInt64V(*vp, true, d) - if changed { - *vp = v - } - } else { - fastpathTV.DecMapBoolInt64V(rv2i(rv).(map[bool]int64), false, d) - } -} -func (f fastpathT) DecMapBoolInt64X(vp *map[bool]int64, d *Decoder) { - v, changed := f.DecMapBoolInt64V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, canChange bool, - d *Decoder) (_ map[bool]int64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() - if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[bool]int64, xlen) - changed = true - } - if containerLen == 0 { - dd.ReadMapEnd() - return v, changed - } - d.depthIncr() - var mk bool + var mk int64 var mv int64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeInt64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -33474,59 +9923,49 @@ func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, canChange bool, } continue } - mv = dd.DecodeInt64() + mv = d.d.DecodeInt64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } -func (d *Decoder) fastpathDecMapBoolFloat32R(f *codecFnInfo, rv reflect.Value) { +func (d *Decoder) fastpathDecMapInt64Float32R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]float32) - v, changed := fastpathTV.DecMapBoolFloat32V(*vp, true, d) - if changed { + vp := rv2i(rv).(*map[int64]float32) + if v, changed := fastpathTV.DecMapInt64Float32V(*vp, true, d); changed { *vp = v } } else { - fastpathTV.DecMapBoolFloat32V(rv2i(rv).(map[bool]float32), false, d) + fastpathTV.DecMapInt64Float32V(rv2i(rv).(map[int64]float32), false, d) } } -func (f fastpathT) DecMapBoolFloat32X(vp *map[bool]float32, d *Decoder) { - v, changed := f.DecMapBoolFloat32V(*vp, true, d) - if changed { +func (f fastpathT) DecMapInt64Float32X(vp *map[int64]float32, d *Decoder) { + if v, changed := f.DecMapInt64Float32V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, canChange bool, - d *Decoder) (_ map[bool]float32, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() +func (fastpathT) DecMapInt64Float32V(v map[int64]float32, canChange bool, + d *Decoder) (_ map[int64]float32, changed bool) { + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) - v = make(map[bool]float32, xlen) + v = make(map[int64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() - var mk bool + var mk int64 var mv float32 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeInt64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -33535,59 +9974,49 @@ func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, canChange bool, } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(d.decodeFloat32()) if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } -func (d *Decoder) fastpathDecMapBoolFloat64R(f *codecFnInfo, rv reflect.Value) { +func (d *Decoder) fastpathDecMapInt64Float64R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]float64) - v, changed := fastpathTV.DecMapBoolFloat64V(*vp, true, d) - if changed { + vp := rv2i(rv).(*map[int64]float64) + if v, changed := fastpathTV.DecMapInt64Float64V(*vp, true, d); changed { *vp = v } } else { - fastpathTV.DecMapBoolFloat64V(rv2i(rv).(map[bool]float64), false, d) + fastpathTV.DecMapInt64Float64V(rv2i(rv).(map[int64]float64), false, d) } } -func (f fastpathT) DecMapBoolFloat64X(vp *map[bool]float64, d *Decoder) { - v, changed := f.DecMapBoolFloat64V(*vp, true, d) - if changed { +func (f fastpathT) DecMapInt64Float64X(vp *map[int64]float64, d *Decoder) { + if v, changed := f.DecMapInt64Float64V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, canChange bool, - d *Decoder) (_ map[bool]float64, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() +func (fastpathT) DecMapInt64Float64V(v map[int64]float64, canChange bool, + d *Decoder) (_ map[int64]float64, changed bool) { + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) - v = make(map[bool]float64, xlen) + v = make(map[int64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() - var mk bool + var mk int64 var mv float64 hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeInt64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -33596,59 +10025,49 @@ func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, canChange bool, } continue } - mv = dd.DecodeFloat64() + mv = d.d.DecodeFloat64() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } -func (d *Decoder) fastpathDecMapBoolBoolR(f *codecFnInfo, rv reflect.Value) { +func (d *Decoder) fastpathDecMapInt64BoolR(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*map[bool]bool) - v, changed := fastpathTV.DecMapBoolBoolV(*vp, true, d) - if changed { + vp := rv2i(rv).(*map[int64]bool) + if v, changed := fastpathTV.DecMapInt64BoolV(*vp, true, d); changed { *vp = v } } else { - fastpathTV.DecMapBoolBoolV(rv2i(rv).(map[bool]bool), false, d) + fastpathTV.DecMapInt64BoolV(rv2i(rv).(map[int64]bool), false, d) } } -func (f fastpathT) DecMapBoolBoolX(vp *map[bool]bool, d *Decoder) { - v, changed := f.DecMapBoolBoolV(*vp, true, d) - if changed { +func (f fastpathT) DecMapInt64BoolX(vp *map[int64]bool, d *Decoder) { + if v, changed := f.DecMapInt64BoolV(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) DecMapBoolBoolV(v map[bool]bool, canChange bool, - d *Decoder) (_ map[bool]bool, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators() - containerLen := dd.ReadMapStart() +func (fastpathT) DecMapInt64BoolV(v map[int64]bool, canChange bool, + d *Decoder) (_ map[int64]bool, changed bool) { + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) - v = make(map[bool]bool, xlen) + v = make(map[int64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() - var mk bool + var mk int64 var mv bool hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { - dd.ReadMapElemKey() - } - mk = dd.DecodeBool() - if esep { - dd.ReadMapElemValue() - } - if dd.TryDecodeAsNil() { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() + mk = d.d.DecodeInt64() + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil { } else if d.h.DeleteOnNilMapValue { delete(v, mk) @@ -33657,12 +10076,11 @@ func (_ fastpathT) DecMapBoolBoolV(v map[bool]bool, canChange bool, } continue } - mv = dd.DecodeBool() + mv = d.d.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } diff --git a/backend/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl b/backend/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl index 7617c435..b3b464ed 100644 --- a/backend/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl +++ b/backend/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl @@ -10,7 +10,7 @@ package codec // Fast path functions try to create a fast path encode or decode implementation // for common maps and slices. // -// We define the functions and register then in this single file +// We define the functions and register them in this single file // so as not to pollute the encode.go and decode.go, and create a dependency in there. // This file can be omitted without causing a build failure. // @@ -18,9 +18,10 @@ package codec // - Many calls bypass reflection altogether // // Currently support -// - slice of all builtin types, -// - map of all builtin types to string or interface value -// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8) +// - slice of all builtin types (numeric, bool, string, []byte) +// - maps of builtin types to builtin or interface{} type, EXCEPT FOR +// keys of type uintptr, int8/16/32, uint16/32, float32/64, bool, interface{} +// AND values of type type int8/16/32, uint16/32 // This should provide adequate "typical" implementations. // // Note that fast track decode functions must handle values for which an address cannot be obtained. @@ -187,34 +188,35 @@ func (e *Encoder) {{ .MethodNamePfx "fastpathEnc" false }}R(f *codecFnInfo, rv r fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv2i(rv).([]{{ .Elem }}), e) } } -func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v []{{ .Elem }}, e *Encoder) { - if v == nil { e.e.EncodeNil(); return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteArrayStart(len(v)) - for _, v2 := range v { - if esep { ee.WriteArrayElem() } - {{ encmd .Elem "v2"}} - } - ee.WriteArrayEnd() -} -func (_ fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) +func (fastpathT) {{ .MethodNamePfx "Enc" false }}V(v []{{ .Elem }}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.WriteMapStart(len(v) / 2) - for j, v2 := range v { - if esep { + e.arrayStart(len(v)) + for j := range v { + e.arrayElem() + {{ encmd .Elem "v[j]"}} + } + e.arrayEnd() +} +func (fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, e *Encoder) { + if v == nil { + e.e.EncodeNil() + } else if len(v)%2 == 1 { + e.errorf(fastpathMapBySliceErrMsg, len(v)) + } else { + e.mapStart(len(v) / 2) + for j := range v { if j%2 == 0 { - ee.WriteMapElemKey() + e.mapElemKey() } else { - ee.WriteMapElemValue() + e.mapElemValue() } - } - {{ encmd .Elem "v2"}} + {{ encmd .Elem "v[j]"}} + } + e.mapEnd() } - ee.WriteMapEnd() } {{end}}{{end}}{{end}} @@ -222,17 +224,16 @@ func (_ fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, e *En func (e *Encoder) {{ .MethodNamePfx "fastpathEnc" false }}R(f *codecFnInfo, rv reflect.Value) { fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv2i(rv).(map[{{ .MapKey }}]{{ .Elem }}), e) } -func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, e *Encoder) { +func (fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, e *Encoder) { if v == nil { e.e.EncodeNil(); return } - ee, esep := e.e, e.hh.hasElemSeparators() - ee.WriteMapStart(len(v)) - if e.h.Canonical { - {{if eq .MapKey "interface{}"}}{{/* out of band - */}}var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding + e.mapStart(len(v)) + if e.h.Canonical { {{/* need to figure out .NoCanonical */}} + {{if eq .MapKey "interface{}"}}{{/* out of band */ -}} + var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) - v2 := make([]bytesI, len(v)) + v2 := make([]bytesIntf, len(v)) var i, l uint - var vp *bytesI {{/* put loop variables outside. seems currently needed for better perf */}} + var vp *bytesIntf {{/* put loop variables outside. seems currently needed for better perf */}} for k2 := range v { l = uint(len(mksv)) e2.MustEncode(k2) @@ -241,34 +242,34 @@ func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Ele vp.i = k2 i++ } - sort.Sort(bytesISlice(v2)) + sort.Sort(bytesIntfSlice(v2)) for j := range v2 { - if esep { ee.WriteMapElemKey() } + e.mapElemKey() e.asis(v2[j].v) - if esep { ee.WriteMapElemValue() } + e.mapElemValue() e.encode(v[v2[j].i]) } {{else}}{{ $x := sorttype .MapKey true}}v2 := make([]{{ $x }}, len(v)) var i uint for k := range v { - v2[i] = {{ $x }}(k) + v2[i] = {{if eq $x .MapKey}}k{{else}}{{ $x }}(k){{end}} i++ } sort.Sort({{ sorttype .MapKey false}}(v2)) for _, k2 := range v2 { - if esep { ee.WriteMapElemKey() } - {{if eq .MapKey "string"}} if e.h.StringToRaw {ee.EncodeStringBytesRaw(bytesView(k2))} else {ee.EncodeStringEnc(cUTF8, k2)} {{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}} - if esep { ee.WriteMapElemValue() } - {{ $y := printf "v[%s(k2)]" .MapKey }}{{ encmd .Elem $y }} + e.mapElemKey() + {{if eq .MapKey "string"}} if e.h.StringToRaw {e.e.EncodeStringBytesRaw(bytesView(k2))} else {e.e.EncodeStringEnc(cUTF8, k2)} {{else}}{{ $y := printf "%s(k2)" .MapKey }}{{if eq $x .MapKey }}{{ $y = "k2" }}{{end}}{{ encmd .MapKey $y }}{{end}} + e.mapElemValue() + {{ $y := printf "v[%s(k2)]" .MapKey }}{{if eq $x .MapKey }}{{ $y = "v[k2]" }}{{end}}{{ encmd .Elem $y }} } {{end}} - } else { + } else { for k2, v2 := range v { - if esep { ee.WriteMapElemKey() } - {{if eq .MapKey "string"}} if e.h.StringToRaw {ee.EncodeStringBytesRaw(bytesView(k2))} else {ee.EncodeStringEnc(cUTF8, k2)} {{else}}{{ encmd .MapKey "k2"}}{{end}} - if esep { ee.WriteMapElemValue() } + e.mapElemKey() + {{if eq .MapKey "string"}} if e.h.StringToRaw {e.e.EncodeStringBytesRaw(bytesView(k2))} else {e.e.EncodeStringEnc(cUTF8, k2)} {{else}}{{ encmd .MapKey "k2"}}{{end}} + e.mapElemValue() {{ encmd .Elem "v2"}} } } - ee.WriteMapEnd() + e.mapEnd() } {{end}}{{end}}{{end}} @@ -339,8 +340,7 @@ Slices can change if they func (d *Decoder) {{ .MethodNamePfx "fastpathDec" false }}R(f *codecFnInfo, rv reflect.Value) { if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]{{ .Elem }}) - v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, !array, d) - if changed { *vp = v } + if v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, !array, d); changed { *vp = v } } else { v := rv2i(rv).([]{{ .Elem }}) v2, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, !array, d) @@ -350,13 +350,12 @@ func (d *Decoder) {{ .MethodNamePfx "fastpathDec" false }}R(f *codecFnInfo, rv r } } func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *[]{{ .Elem }}, d *Decoder) { - v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d) - if changed { *vp = v } + if v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange bool, d *Decoder) (_ []{{ .Elem }}, changed bool) { - dd := d.d{{/* - // if dd.isContainerType(valueTypeNil) { dd.TryDecodeAsNil() - */}} +func (fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange bool, d *Decoder) (_ []{{ .Elem }}, changed bool) { + {{/* dd := d.d + // if d.d.isContainerType(valueTypeNil) { d.d.TryDecodeAsNil() } + */ -}} slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -366,7 +365,6 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange slh.End() return v, changed } - d.depthIncr() hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -384,7 +382,7 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange } } var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 && len(v) == 0 && canChange { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, {{ .Size }}) @@ -394,7 +392,7 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange v = make([]{{ .Elem }}, uint(xlen)) changed = true } - // if indefinite, etc, then expand the slice if necessary + {{/* // if indefinite, etc, then expand the slice if necessary */ -}} var decodeIntoBlank bool if j >= len(v) { if canChange { @@ -408,7 +406,7 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { + } else if d.d.TryDecodeAsNil() { v[uint(j)] = {{ zerocmd .Elem }} } else { {{ if eq .Elem "interface{}" }}d.decode(&v[uint(j)]){{ else }}v[uint(j)] = {{ decmd .Elem }}{{ end }} @@ -424,7 +422,6 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange } } slh.End() - d.depthDecr() return v, changed } {{end}}{{end}}{{end}} @@ -438,54 +435,59 @@ Maps can change if they are func (d *Decoder) {{ .MethodNamePfx "fastpathDec" false }}R(f *codecFnInfo, rv reflect.Value) { if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[{{ .MapKey }}]{{ .Elem }}) - v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d); - if changed { *vp = v } + if v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d); changed { *vp = v } } else { fastpathTV.{{ .MethodNamePfx "Dec" false }}V(rv2i(rv).(map[{{ .MapKey }}]{{ .Elem }}), false, d) } } func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *map[{{ .MapKey }}]{{ .Elem }}, d *Decoder) { - v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d) - if changed { *vp = v } + if v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d); changed { *vp = v } } -func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, canChange bool, +func (fastpathT) {{ .MethodNamePfx "Dec" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, canChange bool, d *Decoder) (_ map[{{ .MapKey }}]{{ .Elem }}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators(){{/* - // if dd.isContainerType(valueTypeNil) {dd.TryDecodeAsNil() - */}} - containerLen := dd.ReadMapStart() + {{/* + // if d.d.isContainerType(valueTypeNil) {d.d.TryDecodeAsNil() + */ -}} + containerLen := d.mapStart() if canChange && v == nil { - xlen := decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }}) - v = make(map[{{ .MapKey }}]{{ .Elem }}, xlen) + v = make(map[{{ .MapKey }}]{{ .Elem }}, decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }})) changed = true } if containerLen == 0 { - dd.ReadMapEnd() + d.mapEnd() return v, changed } - d.depthIncr() - {{ if eq .Elem "interface{}" }}mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset - {{end}}var mk {{ .MapKey }} + {{if eq .Elem "interface{}" }}mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + {{else if eq .Elem "bytes" "[]byte" }}mapGet := v != nil && !d.h.MapValueReset + {{end -}} + var mk {{ .MapKey }} var mv {{ .Elem }} hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - if esep { dd.ReadMapElemKey() } + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + d.mapElemKey() {{ if eq .MapKey "interface{}" }}mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) {{/* // maps cannot have []byte as key. switch to string. */}} }{{ else }}mk = {{ decmd .MapKey }}{{ end }} - if esep { dd.ReadMapElemValue() } - if dd.TryDecodeAsNil() { + d.mapElemValue() + if d.d.TryDecodeAsNil() { if v == nil {} else if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = {{ zerocmd .Elem }} } continue } - {{ if eq .Elem "interface{}" }}if mapGet { mv = v[mk] } else { mv = nil } - d.decode(&mv){{ else }}mv = {{ decmd .Elem }}{{ end }} + {{ if eq .Elem "interface{}" "[]byte" "bytes" -}} + if mapGet { mv = v[mk] } else { mv = nil } + {{ end -}} + {{ if eq .Elem "interface{}" -}} + d.decode(&mv) + {{ else if eq .Elem "[]byte" "bytes" -}} + mv = d.d.DecodeBytes(mv, false) + {{ else -}} + mv = {{ decmd .Elem }} + {{ end -}} if v != nil { v[mk] = mv } } - dd.ReadMapEnd() - d.depthDecr() + d.mapEnd() return v, changed } {{end}}{{end}}{{end}} diff --git a/backend/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl b/backend/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl index 790e914e..8d182760 100644 --- a/backend/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl +++ b/backend/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl @@ -12,7 +12,8 @@ if {{var "l"}} == 0 { } {{else if isChan }}if {{var "v"}} == nil { {{var "v"}} = make({{ .CTyp }}, 0) {{var "c"}} = true - } {{end}} + } + {{end -}} } else { {{var "hl"}} := {{var "l"}} > 0 var {{var "rl"}} int @@ -30,9 +31,10 @@ if {{var "l"}} == 0 { {{var "v"}} = {{var "v"}}[:{{var "l"}}] {{var "c"}} = true } - } {{end}} + } + {{end -}} var {{var "j"}} int - // var {{var "dn"}} bool + {{/* // var {{var "dn"}} bool */ -}} for {{var "j"}} = 0; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ { // bounds-check-elimination {{if not isArray}} if {{var "j"}} == 0 && {{var "v"}} == nil { if {{var "hl"}} { @@ -42,27 +44,28 @@ if {{var "l"}} == 0 { } {{var "v"}} = make({{if isSlice}}[]{{ .Typ }}{{else if isChan}}{{.CTyp}}{{end}}, {{var "rl"}}) {{var "c"}} = true - }{{end}} + } + {{end -}} {{var "h"}}.ElemContainerState({{var "j"}}) - {{/* {{var "dn"}} = r.TryDecodeAsNil() */}}{{/* commented out, as decLineVar handles this already each time */}} + {{/* {{var "dn"}} = r.TryDecodeAsNil() */}}{{/* commented out, as decLineVar handles this already each time */ -}} {{if isChan}}{{ $x := printf "%[1]vvcx%[2]v" .TempVar .Rand }}var {{$x}} {{ .Typ }} - {{ decLineVar $x }} + {{ decLineVar $x -}} {{var "v"}} <- {{ $x }} // println(">>>> sending ", {{ $x }}, " into ", {{var "v"}}) // TODO: remove this - {{else}}{{/* // if indefinite, etc, then expand the slice if necessary */}} + {{else}}{{/* // if indefinite, etc, then expand the slice if necessary */ -}} var {{var "db"}} bool if {{var "j"}} >= len({{var "v"}}) { {{if isSlice }} {{var "v"}} = append({{var "v"}}, {{ zero }}) {{var "c"}} = true {{else}} z.DecArrayCannotExpand(len(v), {{var "j"}}+1); {{var "db"}} = true - {{end}} + {{end -}} } if {{var "db"}} { z.DecSwallow() } else { - {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} + {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x -}} } - {{end}} + {{end -}} } {{if isSlice}} if {{var "j"}} < len({{var "v"}}) { {{var "v"}} = {{var "v"}}[:{{var "j"}}] @@ -70,9 +73,11 @@ if {{var "l"}} == 0 { } else if {{var "j"}} == 0 && {{var "v"}} == nil { {{var "v"}} = make([]{{ .Typ }}, 0) {{var "c"}} = true - } {{end}} + } + {{end -}} } {{var "h"}}.End() {{if not isArray }}if {{var "c"}} { *{{ .Varname }} = {{var "v"}} -}{{end}} +} +{{end -}} diff --git a/backend/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl b/backend/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl index 8323b549..2df0103c 100644 --- a/backend/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl +++ b/backend/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl @@ -1,5 +1,5 @@ {{var "v"}} := *{{ .Varname }} -{{var "l"}} := r.ReadMapStart() +{{var "l"}} := z.DecReadMapStart() {{var "bh"}} := z.DecBasicHandle() if {{var "v"}} == nil { {{var "rl"}} := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }}) @@ -17,21 +17,29 @@ if {{var "bh"}}.MapValueReset { if {{var "l"}} != 0 { {{var "hl"}} := {{var "l"}} > 0 for {{var "j"}} := 0; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ { - r.ReadMapElemKey() {{/* z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) */}} - {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }} -{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { + z.DecReadMapElemKey() {{/* z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) */}} + {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x -}} + {{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */ -}} + if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { {{var "mk"}} = string({{var "bv"}}) - }{{ end }}{{if decElemKindPtr}} - {{var "ms"}} = true{{end}} + } + {{ end -}} + {{if decElemKindPtr -}} + {{var "ms"}} = true + {{end -}} if {{var "mg"}} { - {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}] + {{if decElemKindPtr -}} + {{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}] if {{var "mok"}} { {{var "ms"}} = false - } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}} + } + {{else -}} + {{var "mv"}} = {{var "v"}}[{{var "mk"}}] + {{end -}} } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}} - r.ReadMapElemValue() {{/* z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) */}} + z.DecReadMapElemValue() {{/* z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) */}} {{var "mdn"}} = false - {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ $y := printf "%vmdn%v" .TempVar .Rand }}{{ decLineVar $x $y }} + {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ $y := printf "%vmdn%v" .TempVar .Rand }}{{ decLineVar $x $y -}} if {{var "mdn"}} { if {{ var "bh" }}.DeleteOnNilMapValue { delete({{var "v"}}, {{var "mk"}}) } else { {{var "v"}}[{{var "mk"}}] = {{decElemZero}} } } else if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { @@ -39,4 +47,4 @@ if {{var "l"}} != 0 { } } } // else len==0: TODO: Should we clear map entries? -r.ReadMapEnd() {{/* z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) */}} +z.DecReadMapEnd() {{/* z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) */}} diff --git a/backend/vendor/github.com/ugorji/go/codec/gen-helper.generated.go b/backend/vendor/github.com/ugorji/go/codec/gen-helper.generated.go index 2a7d1aab..d9d0ed68 100644 --- a/backend/vendor/github.com/ugorji/go/codec/gen-helper.generated.go +++ b/backend/vendor/github.com/ugorji/go/codec/gen-helper.generated.go @@ -13,17 +13,11 @@ import ( ) // GenVersion is the current version of codecgen. -const GenVersion = 10 +const GenVersion = 12 // This file is used to generate helper code for codecgen. // The values here i.e. genHelper(En|De)coder are not to be used directly by // library users. They WILL change continuously and without notice. -// -// To help enforce this, we create an unexported type with exported members. -// The only way to get the type is via the one exported type that we control (somewhat). -// -// When static codecs are created for types, they will use this value -// to perform encoding or decoding of primitives or known slice or map types. // GenHelperEncoder is exported so that it can be used externally by codecgen. // @@ -47,56 +41,22 @@ type genHelperEncDriver struct { encDriver } -func (x genHelperEncDriver) EncodeBuiltin(rt uintptr, v interface{}) {} -func (x genHelperEncDriver) EncStructFieldKey(keyType valueType, s string) { - encStructFieldKey(s, x.encDriver, nil, keyType, false, false) -} -func (x genHelperEncDriver) EncodeSymbol(s string) { - x.encDriver.EncodeStringEnc(cUTF8, s) -} - type genHelperDecDriver struct { decDriver - C checkOverflow -} - -func (x genHelperDecDriver) DecodeBuiltin(rt uintptr, v interface{}) {} -func (x genHelperDecDriver) DecStructFieldKey(keyType valueType, buf *[decScratchByteArrayLen]byte) []byte { - return decStructFieldKey(x.decDriver, keyType, buf) -} -func (x genHelperDecDriver) DecodeInt(bitsize uint8) (i int64) { - return x.C.IntV(x.decDriver.DecodeInt64(), bitsize) -} -func (x genHelperDecDriver) DecodeUint(bitsize uint8) (ui uint64) { - return x.C.UintV(x.decDriver.DecodeUint64(), bitsize) -} -func (x genHelperDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { - f = x.DecodeFloat64() - if chkOverflow32 && chkOvf.Float32(f) { - panicv.errorf("float32 overflow: %v", f) - } - return -} -func (x genHelperDecDriver) DecodeFloat32As64() (f float64) { - f = x.DecodeFloat64() - if chkOvf.Float32(f) { - panicv.errorf("float32 overflow: %v", f) - } - return } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperEncoder struct { M must - e *Encoder F fastpathT + e *Encoder } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperDecoder struct { C checkOverflow - d *Decoder F fastpathT + d *Decoder } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* @@ -116,7 +76,6 @@ func (f genHelperEncoder) IsJSONHandle() bool { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncFallback(iv interface{}) { - // println(">>>>>>>>> EncFallback") // f.e.encodeI(iv, false, false) f.e.encodeValue(reflect.ValueOf(iv), nil, false) } @@ -142,18 +101,6 @@ func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncRaw(iv Raw) { f.e.rawBytes(iv) } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: builtin no longer supported - so we make this method a no-op, -// but leave in-place so that old generated files continue to work without regeneration. -func (f genHelperEncoder) TimeRtidIfBinc() (v uintptr) { return } - -// func (f genHelperEncoder) TimeRtidIfBinc() uintptr { -// if _, ok := f.e.hh.(*BincHandle); ok { -// return timeTypId -// } -// } - // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) I2Rtid(v interface{}) uintptr { return i2rtid(v) @@ -171,31 +118,32 @@ func (f genHelperEncoder) EncExtension(v interface{}, xfFn *extTypeTagFn) { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) WriteStr(s string) { - f.e.w.writestr(s) + f.e.w().writestr(s) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) BytesView(v string) []byte { return bytesView(v) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: No longer used, -// but leave in-place so that old generated files continue to work without regeneration. -func (f genHelperEncoder) HasExtensions() bool { - return len(f.e.h.extHandle) != 0 -} +func (f genHelperEncoder) EncWriteMapStart(length int) { f.e.mapStart(length) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: No longer used, -// but leave in-place so that old generated files continue to work without regeneration. -func (f genHelperEncoder) EncExt(v interface{}) (r bool) { - if xfFn := f.e.h.getExt(i2rtid(v)); xfFn != nil { - f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e) - return true - } - return false -} +func (f genHelperEncoder) EncWriteMapEnd() { f.e.mapEnd() } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncWriteArrayStart(length int) { f.e.arrayStart(length) } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncWriteArrayEnd() { f.e.arrayEnd() } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncWriteArrayElem() { f.e.arrayElem() } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncWriteMapElemKey() { f.e.mapElemKey() } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncWriteMapElemValue() { f.e.mapElemValue() } // ---------------- DECODER FOLLOWS ----------------- @@ -224,13 +172,11 @@ func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) { - // println(">>>>>>>>> DecFallback") rv := reflect.ValueOf(iv) if chkPtr { rv = f.d.ensureDecodeable(rv) } f.d.decodeValue(rv, nil, false) - // f.d.decodeValueFallback(rv) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* @@ -250,8 +196,7 @@ func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) { - fnerr := tm.UnmarshalText(f.d.d.DecodeStringAsBytes()) - if fnerr != nil { + if fnerr := tm.UnmarshalText(f.d.d.DecodeStringAsBytes()); fnerr != nil { panic(fnerr) } } @@ -260,16 +205,14 @@ func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) { func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) { // bs := f.dd.DecodeStringAsBytes() // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself. - fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()) - if fnerr != nil { + if fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()); fnerr != nil { panic(fnerr) } } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) { - fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true)) - if fnerr != nil { + if fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true)); fnerr != nil { panic(fnerr) } } @@ -277,20 +220,6 @@ func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecRaw() []byte { return f.d.rawBytes() } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: builtin no longer supported - so we make this method a no-op, -// but leave in-place so that old generated files continue to work without regeneration. -func (f genHelperDecoder) TimeRtidIfBinc() (v uintptr) { return } - -// func (f genHelperDecoder) TimeRtidIfBinc() uintptr { -// // Note: builtin is no longer supported - so make this a no-op -// if _, ok := f.d.hh.(*BincHandle); ok { -// return timeTypId -// } -// return 0 -// } - // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) IsJSONHandle() bool { return f.d.js @@ -311,33 +240,34 @@ func (f genHelperDecoder) DecExtension(v interface{}, xfFn *extTypeTagFn) { f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext) } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: No longer used, -// but leave in-place so that old generated files continue to work without regeneration. -func (f genHelperDecoder) HasExtensions() bool { - return len(f.d.h.extHandle) != 0 -} - -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: No longer used, -// but leave in-place so that old generated files continue to work without regeneration. -func (f genHelperDecoder) DecExt(v interface{}) (r bool) { - if xfFn := f.d.h.getExt(i2rtid(v)); xfFn != nil { - f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext) - return true - } - return false -} - // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int) { return decInferLen(clen, maxlen, unit) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: no longer used, -// but leave in-place so that old generated files continue to work without regeneration. func (f genHelperDecoder) StringView(v []byte) string { return stringView(v) } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadMapStart() int { return f.d.mapStart() } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadMapEnd() { f.d.mapEnd() } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadArrayStart() int { return f.d.arrayStart() } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadArrayEnd() { f.d.arrayEnd() } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadArrayElem() { f.d.arrayElem() } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadMapElemKey() { f.d.mapElemKey() } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadMapElemValue() { f.d.mapElemValue() } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecDecodeFloat32() float64 { return f.d.decodeFloat32() } diff --git a/backend/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl b/backend/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl index f5d0634e..abe8cf33 100644 --- a/backend/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl +++ b/backend/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl @@ -18,12 +18,14 @@ const GenVersion = {{ .Version }} // This file is used to generate helper code for codecgen. // The values here i.e. genHelper(En|De)coder are not to be used directly by // library users. They WILL change continuously and without notice. -// + +{{/* // To help enforce this, we create an unexported type with exported members. // The only way to get the type is via the one exported type that we control (somewhat). // // When static codecs are created for types, they will use this value // to perform encoding or decoding of primitives or known slice or map types. +*/ -}} // GenHelperEncoder is exported so that it can be used externally by codecgen. // @@ -47,56 +49,34 @@ type genHelperEncDriver struct { encDriver } -func (x genHelperEncDriver) EncodeBuiltin(rt uintptr, v interface{}) {} +type genHelperDecDriver struct { + decDriver +} + +{{/* +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (x genHelperEncDriver) EncStructFieldKey(keyType valueType, s string) { encStructFieldKey(s, x.encDriver, nil, keyType, false, false) } -func (x genHelperEncDriver) EncodeSymbol(s string) { - x.encDriver.EncodeStringEnc(cUTF8, s) -} -type genHelperDecDriver struct { - decDriver - C checkOverflow -} - -func (x genHelperDecDriver) DecodeBuiltin(rt uintptr, v interface{}) {} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (x genHelperDecDriver) DecStructFieldKey(keyType valueType, buf *[decScratchByteArrayLen]byte) []byte { return decStructFieldKey(x.decDriver, keyType, buf) } -func (x genHelperDecDriver) DecodeInt(bitsize uint8) (i int64) { - return x.C.IntV(x.decDriver.DecodeInt64(), bitsize) -} -func (x genHelperDecDriver) DecodeUint(bitsize uint8) (ui uint64) { - return x.C.UintV(x.decDriver.DecodeUint64(), bitsize) -} -func (x genHelperDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { - f = x.DecodeFloat64() - if chkOverflow32 && chkOvf.Float32(f) { - panicv.errorf("float32 overflow: %v", f) - } - return -} -func (x genHelperDecDriver) DecodeFloat32As64() (f float64) { - f = x.DecodeFloat64() - if chkOvf.Float32(f) { - panicv.errorf("float32 overflow: %v", f) - } - return -} +*/ -}} // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperEncoder struct { M must - e *Encoder F fastpathT + e *Encoder } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperDecoder struct { C checkOverflow - d *Decoder F fastpathT + d *Decoder } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* @@ -113,7 +93,6 @@ func (f genHelperEncoder) IsJSONHandle() bool { } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncFallback(iv interface{}) { - // println(">>>>>>>>> EncFallback") // f.e.encodeI(iv, false, false) f.e.encodeValue(reflect.ValueOf(iv), nil, false) } @@ -134,16 +113,6 @@ func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) { } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncRaw(iv Raw) { f.e.rawBytes(iv) } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: builtin no longer supported - so we make this method a no-op, -// but leave in-place so that old generated files continue to work without regeneration. -func (f genHelperEncoder) TimeRtidIfBinc() (v uintptr) { return } -// func (f genHelperEncoder) TimeRtidIfBinc() uintptr { -// if _, ok := f.e.hh.(*BincHandle); ok { -// return timeTypId -// } -// } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) I2Rtid(v interface{}) uintptr { @@ -159,28 +128,25 @@ func (f genHelperEncoder) EncExtension(v interface{}, xfFn *extTypeTagFn) { } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) WriteStr(s string) { - f.e.w.writestr(s) + f.e.w().writestr(s) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) BytesView(v string) []byte { return bytesView(v) } + // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: No longer used, -// but leave in-place so that old generated files continue to work without regeneration. -func (f genHelperEncoder) HasExtensions() bool { - return len(f.e.h.extHandle) != 0 -} +func (f genHelperEncoder) EncWriteMapStart(length int) { f.e.mapStart(length) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: No longer used, -// but leave in-place so that old generated files continue to work without regeneration. -func (f genHelperEncoder) EncExt(v interface{}) (r bool) { - if xfFn := f.e.h.getExt(i2rtid(v)); xfFn != nil { - f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e) - return true - } - return false -} +func (f genHelperEncoder) EncWriteMapEnd() { f.e.mapEnd() } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncWriteArrayStart(length int) { f.e.arrayStart(length) } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncWriteArrayEnd() { f.e.arrayEnd() } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncWriteArrayElem() { f.e.arrayElem() } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncWriteMapElemKey() { f.e.mapElemKey() } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncWriteMapElemValue() { f.e.mapElemValue() } // ---------------- DECODER FOLLOWS ----------------- @@ -204,13 +170,11 @@ func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) { - // println(">>>>>>>>> DecFallback") rv := reflect.ValueOf(iv) if chkPtr { rv = f.d.ensureDecodeable(rv) } f.d.decodeValue(rv, nil, false) - // f.d.decodeValueFallback(rv) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecSliceHelperStart() (decSliceHelper, int) { @@ -226,8 +190,7 @@ func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) { } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) { - fnerr := tm.UnmarshalText(f.d.d.DecodeStringAsBytes()) - if fnerr != nil { + if fnerr := tm.UnmarshalText(f.d.d.DecodeStringAsBytes()); fnerr != nil { panic(fnerr) } } @@ -235,32 +198,18 @@ func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) { func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) { // bs := f.dd.DecodeStringAsBytes() // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself. - fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()) - if fnerr != nil { + if fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()); fnerr != nil { panic(fnerr) } } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) { - fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true)) - if fnerr != nil { + if fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true)); fnerr != nil { panic(fnerr) } } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecRaw() []byte { return f.d.rawBytes() } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: builtin no longer supported - so we make this method a no-op, -// but leave in-place so that old generated files continue to work without regeneration. -func (f genHelperDecoder) TimeRtidIfBinc() (v uintptr) { return } -// func (f genHelperDecoder) TimeRtidIfBinc() uintptr { -// // Note: builtin is no longer supported - so make this a no-op -// if _, ok := f.d.hh.(*BincHandle); ok { -// return timeTypId -// } -// return 0 -// } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) IsJSONHandle() bool { @@ -279,30 +228,27 @@ func (f genHelperDecoder) DecExtension(v interface{}, xfFn *extTypeTagFn) { f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: No longer used, -// but leave in-place so that old generated files continue to work without regeneration. -func (f genHelperDecoder) HasExtensions() bool { - return len(f.d.h.extHandle) != 0 -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: No longer used, -// but leave in-place so that old generated files continue to work without regeneration. -func (f genHelperDecoder) DecExt(v interface{}) (r bool) { - if xfFn := f.d.h.getExt(i2rtid(v)); xfFn != nil { - f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext) - return true - } - return false -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int) { return decInferLen(clen, maxlen, unit) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -// -// Deprecated: no longer used, -// but leave in-place so that old generated files continue to work without regeneration. func (f genHelperDecoder) StringView(v []byte) string { return stringView(v) } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadMapStart() int { return f.d.mapStart() } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadMapEnd() { f.d.mapEnd() } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadArrayStart() int { return f.d.arrayStart() } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadArrayEnd() { f.d.arrayEnd() } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadArrayElem() { f.d.arrayElem() } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadMapElemKey() { f.d.mapElemKey() } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecReadMapElemValue() { f.d.mapElemValue() } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecDecodeFloat32() float64 { return f.d.decodeFloat32() } + diff --git a/backend/vendor/github.com/ugorji/go/codec/gen.generated.go b/backend/vendor/github.com/ugorji/go/codec/gen.generated.go index 8b00090a..b88998b0 100644 --- a/backend/vendor/github.com/ugorji/go/codec/gen.generated.go +++ b/backend/vendor/github.com/ugorji/go/codec/gen.generated.go @@ -9,7 +9,7 @@ package codec const genDecMapTmpl = ` {{var "v"}} := *{{ .Varname }} -{{var "l"}} := r.ReadMapStart() +{{var "l"}} := z.DecReadMapStart() {{var "bh"}} := z.DecBasicHandle() if {{var "v"}} == nil { {{var "rl"}} := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }}) @@ -27,21 +27,29 @@ if {{var "bh"}}.MapValueReset { if {{var "l"}} != 0 { {{var "hl"}} := {{var "l"}} > 0 for {{var "j"}} := 0; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ { - r.ReadMapElemKey() {{/* z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) */}} - {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }} -{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { + z.DecReadMapElemKey() {{/* z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) */}} + {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x -}} + {{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */ -}} + if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { {{var "mk"}} = string({{var "bv"}}) - }{{ end }}{{if decElemKindPtr}} - {{var "ms"}} = true{{end}} + } + {{ end -}} + {{if decElemKindPtr -}} + {{var "ms"}} = true + {{end -}} if {{var "mg"}} { - {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}] + {{if decElemKindPtr -}} + {{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}] if {{var "mok"}} { {{var "ms"}} = false - } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}} + } + {{else -}} + {{var "mv"}} = {{var "v"}}[{{var "mk"}}] + {{end -}} } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}} - r.ReadMapElemValue() {{/* z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) */}} + z.DecReadMapElemValue() {{/* z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) */}} {{var "mdn"}} = false - {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ $y := printf "%vmdn%v" .TempVar .Rand }}{{ decLineVar $x $y }} + {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ $y := printf "%vmdn%v" .TempVar .Rand }}{{ decLineVar $x $y -}} if {{var "mdn"}} { if {{ var "bh" }}.DeleteOnNilMapValue { delete({{var "v"}}, {{var "mk"}}) } else { {{var "v"}}[{{var "mk"}}] = {{decElemZero}} } } else if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { @@ -49,7 +57,7 @@ if {{var "l"}} != 0 { } } } // else len==0: TODO: Should we clear map entries? -r.ReadMapEnd() {{/* z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) */}} +z.DecReadMapEnd() {{/* z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) */}} ` const genDecListTmpl = ` @@ -67,7 +75,8 @@ if {{var "l"}} == 0 { } {{else if isChan }}if {{var "v"}} == nil { {{var "v"}} = make({{ .CTyp }}, 0) {{var "c"}} = true - } {{end}} + } + {{end -}} } else { {{var "hl"}} := {{var "l"}} > 0 var {{var "rl"}} int @@ -85,9 +94,10 @@ if {{var "l"}} == 0 { {{var "v"}} = {{var "v"}}[:{{var "l"}}] {{var "c"}} = true } - } {{end}} + } + {{end -}} var {{var "j"}} int - // var {{var "dn"}} bool + {{/* // var {{var "dn"}} bool */ -}} for {{var "j"}} = 0; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ { // bounds-check-elimination {{if not isArray}} if {{var "j"}} == 0 && {{var "v"}} == nil { if {{var "hl"}} { @@ -97,27 +107,28 @@ if {{var "l"}} == 0 { } {{var "v"}} = make({{if isSlice}}[]{{ .Typ }}{{else if isChan}}{{.CTyp}}{{end}}, {{var "rl"}}) {{var "c"}} = true - }{{end}} + } + {{end -}} {{var "h"}}.ElemContainerState({{var "j"}}) - {{/* {{var "dn"}} = r.TryDecodeAsNil() */}}{{/* commented out, as decLineVar handles this already each time */}} + {{/* {{var "dn"}} = r.TryDecodeAsNil() */}}{{/* commented out, as decLineVar handles this already each time */ -}} {{if isChan}}{{ $x := printf "%[1]vvcx%[2]v" .TempVar .Rand }}var {{$x}} {{ .Typ }} - {{ decLineVar $x }} + {{ decLineVar $x -}} {{var "v"}} <- {{ $x }} // println(">>>> sending ", {{ $x }}, " into ", {{var "v"}}) // TODO: remove this - {{else}}{{/* // if indefinite, etc, then expand the slice if necessary */}} + {{else}}{{/* // if indefinite, etc, then expand the slice if necessary */ -}} var {{var "db"}} bool if {{var "j"}} >= len({{var "v"}}) { {{if isSlice }} {{var "v"}} = append({{var "v"}}, {{ zero }}) {{var "c"}} = true {{else}} z.DecArrayCannotExpand(len(v), {{var "j"}}+1); {{var "db"}} = true - {{end}} + {{end -}} } if {{var "db"}} { z.DecSwallow() } else { - {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} + {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x -}} } - {{end}} + {{end -}} } {{if isSlice}} if {{var "j"}} < len({{var "v"}}) { {{var "v"}} = {{var "v"}}[:{{var "j"}}] @@ -125,12 +136,14 @@ if {{var "l"}} == 0 { } else if {{var "j"}} == 0 && {{var "v"}} == nil { {{var "v"}} = make([]{{ .Typ }}, 0) {{var "c"}} = true - } {{end}} + } + {{end -}} } {{var "h"}}.End() {{if not isArray }}if {{var "c"}} { *{{ .Varname }} = {{var "v"}} -}{{end}} +} +{{end -}} ` const genEncChanTmpl = ` diff --git a/backend/vendor/github.com/ugorji/go/codec/gen.go b/backend/vendor/github.com/ugorji/go/codec/gen.go index 74c4aa86..4dc3c065 100644 --- a/backend/vendor/github.com/ugorji/go/codec/gen.go +++ b/backend/vendor/github.com/ugorji/go/codec/gen.go @@ -105,8 +105,10 @@ import ( // v7: // v8: current - we now maintain compatibility with old generated code. // v9: skipped -// v10: modified encDriver and decDriver interfaces. Remove deprecated methods after Jan 1, 2019 -const genVersion = 10 +// v10: modified encDriver and decDriver interfaces. +// v11: remove deprecated methods of encDriver and decDriver. +// v12: removed deprecated methods from genHelper and changed container tracking logic +const genVersion = 12 const ( genCodecPkg = "codec1978" @@ -123,6 +125,15 @@ const ( // // From testing, it didn't make much difference in runtime, so keep as true (one function only) genUseOneFunctionForDecStructMap = true + + // genFastpathCanonical configures whether we support Canonical in fast path. + // The savings is not much. + // + // NOTE: This MUST ALWAYS BE TRUE. fast-path.go.tmp doesn't handle it being false. + genFastpathCanonical = true // MUST be true + + // genFastpathTrimTypes configures whether we trim uncommon fastpath types. + genFastpathTrimTypes = true ) type genStructMapStyle uint8 @@ -157,10 +168,11 @@ func (x *genBuf) reset() { // genRunner holds some state used during a Gen run. type genRunner struct { - w io.Writer // output - c uint64 // counter used for generating varsfx - t []reflect.Type // list of types to run selfer on + w io.Writer // output + c uint64 // counter used for generating varsfx + f uint64 // counter used for saying false + t []reflect.Type // list of types to run selfer on tc reflect.Type // currently running selfer on this type te map[uintptr]bool // types for which the encoder has been created td map[uintptr]bool // types for which the decoder has been created @@ -187,6 +199,30 @@ type genRunner struct { nx bool // no extensions } +type genIfClause struct { + hasIf bool +} + +func (g *genIfClause) end(x *genRunner) { + if g.hasIf { + x.line("}") + } +} + +func (g *genIfClause) c(last bool) (v string) { + if last { + if g.hasIf { + v = " } else { " + } + } else if g.hasIf { + v = " } else if " + } else { + v = "if " + g.hasIf = true + } + return +} + // Gen will write a complete go file containing Selfer implementations for each // type passed. All the types must be in the same package. // @@ -285,43 +321,49 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, x.linef("codecSelferBitsize%s = uint8(32 << (^uint(0) >> 63))", x.xs) x.line(")") x.line("var (") - x.line("errCodecSelferOnlyMapOrArrayEncodeToStruct" + x.xs + " = errors.New(`only encoded map or array can be decoded into a struct`)") + x.line("errCodecSelferOnlyMapOrArrayEncodeToStruct" + x.xs + " = " + "\nerrors.New(`only encoded map or array can be decoded into a struct`)") x.line(")") x.line("") x.hn = "codecSelfer" + x.xs x.line("type " + x.hn + " struct{}") x.line("") - + x.linef("func %sFalse() bool { return false }", x.hn) + x.line("") x.varsfxreset() x.line("func init() {") x.linef("if %sGenVersion != %v {", x.cpfx, genVersion) x.line("_, file, _, _ := runtime.Caller(0)") - x.outf(`panic("codecgen version mismatch: current: %v, need " + strconv.FormatInt(int64(%sGenVersion), 10) + ". Re-generate file: " + file)`, genVersion, x.cpfx) + x.linef("ver := strconv.FormatInt(int64(%sGenVersion), 10)", x.cpfx) + x.outf(`panic("codecgen version mismatch: current: %v, need " + ver + ". Re-generate file: " + file)`, genVersion) // x.out(`panic(fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", `) // x.linef(`%v, %sGenVersion, file))`, genVersion, x.cpfx) x.linef("}") - x.line("if false { var _ byte = 0; // reference the types, but skip this branch at build/run time") - // x.line("_ = strconv.ParseInt") - var n int - // for k, t := range x.im { - for _, k := range imKeys { - t := x.im[k] - x.linef("var v%v %s.%s", n, x.imn[k], t.Name()) - n++ - } - if n > 0 { - x.out("_") - for i := 1; i < n; i++ { - x.out(", _") - } - x.out(" = v0") - for i := 1; i < n; i++ { - x.outf(", v%v", i) + if len(imKeys) > 0 { + x.line("if false { // reference the types, but skip this branch at build/run time") + x.line("var _ byte") + // x.line("_ = strconv.ParseInt") + // var n int + // for k, t := range x.im { + for _, k := range imKeys { + t := x.im[k] + // x.linef("var v%v %s.%s", n, x.imn[k], t.Name()) + // n++ + x.linef("var _ %s.%s", x.imn[k], t.Name()) } + // if n > 0 { + // x.out("_") + // for i := 1; i < n; i++ { + // x.out(", _") + // } + // x.out(" = v0") + // for i := 1; i < n; i++ { + // x.outf(", v%v", i) + // } + // } + x.line("} ") // close if false } - x.line("} ") // close if false - x.line("}") // close init + x.line("}") // close init x.line("") // generate rest of type info @@ -422,6 +464,15 @@ func (x *genRunner) genRefPkgs(t reflect.Type) { } } +// sayFalse will either say "false" or use a function call that returns false. +func (x *genRunner) sayFalse() string { + x.f++ + if x.f%2 == 0 { + return x.hn + "False()" + } + return "false" +} + func (x *genRunner) varsfx() string { x.c++ return strconv.FormatUint(x.c, 10) @@ -452,6 +503,12 @@ func (x *genRunner) line(s string) { } } +func (x *genRunner) lineIf(s string) { + if s != "" { + x.line(s) + } +} + func (x *genRunner) linef(s string, params ...interface{}) { x.outf(s, params...) if len(s) == 0 || s[len(s)-1] != '\n' { @@ -638,12 +695,16 @@ func (x *genRunner) registerXtraT(t reflect.Type) { // encVar will encode a variable. // The parameter, t, is the reflect.Type of the variable itself func (x *genRunner) encVar(varname string, t reflect.Type) { - // fmt.Printf(">>>>>> varname: %s, t: %v\n", varname, t) + // xdebugf("varname: %s, t: %v", varname, t) var checkNil bool switch t.Kind() { case reflect.Ptr, reflect.Interface, reflect.Slice, reflect.Map, reflect.Chan: checkNil = true } + x.encVarChkNil(varname, t, checkNil) +} + +func (x *genRunner) encVarChkNil(varname string, t reflect.Type, checkNil bool) { if checkNil { x.linef("if %s == nil { r.EncodeNil() } else { ", varname) } @@ -674,7 +735,6 @@ func (x *genRunner) encVar(varname string, t reflect.Type) { if checkNil { x.line("}") } - } // enc will encode a variable (varname) of type t, where t represents T. @@ -738,53 +798,54 @@ func (x *genRunner) enc(varname string, t reflect.Type) { // - type is time.Time, RawExt, Raw // - the type implements (Text|JSON|Binary)(Unm|M)arshal - x.line("if false {") //start if block - defer func() { x.line("}") }() //end if block + var hasIf genIfClause + defer hasIf.end(x) // end if block (if necessary) if t == timeTyp { - x.linef("} else if !z.EncBasicHandle().TimeNotBuiltin { r.EncodeTime(%s)", varname) + x.linef("%s !z.EncBasicHandle().TimeNotBuiltin { r.EncodeTime(%s)", hasIf.c(false), varname) // return } if t == rawTyp { - x.linef("} else { z.EncRaw(%s)", varname) + x.linef("%s z.EncRaw(%s)", hasIf.c(true), varname) return } if t == rawExtTyp { - x.linef("} else { r.EncodeRawExt(%s, e)", varname) + x.linef("%s r.EncodeRawExt(%s, e)", hasIf.c(true), varname) return } // only check for extensions if the type is named, and has a packagePath. var arrayOrStruct = tk == reflect.Array || tk == reflect.Struct // meaning varname if of type *T if !x.nx && genImportPath(t) != "" && t.Name() != "" { yy := fmt.Sprintf("%sxt%s", genTempVarPfx, mi) - x.linef("} else if %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.EncExtension(%s, %s) ", yy, varname, yy, varname, yy) + x.linef("%s %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.EncExtension(%s, %s) ", + hasIf.c(false), yy, varname, yy, varname, yy) } if arrayOrStruct { // varname is of type *T if ti2.bm || ti2.bmp { // t.Implements(binaryMarshalerTyp) || tptr.Implements(binaryMarshalerTyp) { - x.linef("} else if z.EncBinary() { z.EncBinaryMarshal(%v) ", varname) + x.linef("%s z.EncBinary() { z.EncBinaryMarshal(%v) ", hasIf.c(false), varname) } if ti2.jm || ti2.jmp { // t.Implements(jsonMarshalerTyp) || tptr.Implements(jsonMarshalerTyp) { - x.linef("} else if !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", varname) + x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", hasIf.c(false), varname) } else if ti2.tm || ti2.tmp { // t.Implements(textMarshalerTyp) || tptr.Implements(textMarshalerTyp) { - x.linef("} else if !z.EncBinary() { z.EncTextMarshal(%v) ", varname) + x.linef("%s !z.EncBinary() { z.EncTextMarshal(%v) ", hasIf.c(false), varname) } } else { // varname is of type T if ti2.bm { // t.Implements(binaryMarshalerTyp) { - x.linef("} else if z.EncBinary() { z.EncBinaryMarshal(%v) ", varname) + x.linef("%s z.EncBinary() { z.EncBinaryMarshal(%v) ", hasIf.c(false), varname) } else if ti2.bmp { // tptr.Implements(binaryMarshalerTyp) { - x.linef("} else if z.EncBinary() { z.EncBinaryMarshal(&%v) ", varname) + x.linef("%s z.EncBinary() { z.EncBinaryMarshal(&%v) ", hasIf.c(false), varname) } if ti2.jm { // t.Implements(jsonMarshalerTyp) { - x.linef("} else if !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", varname) + x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", hasIf.c(false), varname) } else if ti2.jmp { // tptr.Implements(jsonMarshalerTyp) { - x.linef("} else if !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(&%v) ", varname) + x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(&%v) ", hasIf.c(false), varname) } else if ti2.tm { // t.Implements(textMarshalerTyp) { - x.linef("} else if !z.EncBinary() { z.EncTextMarshal(%v) ", varname) + x.linef("%s !z.EncBinary() { z.EncTextMarshal(%v) ", hasIf.c(false), varname) } else if ti2.tmp { // tptr.Implements(textMarshalerTyp) { - x.linef("} else if !z.EncBinary() { z.EncTextMarshal(&%v) ", varname) + x.linef("%s !z.EncBinary() { z.EncTextMarshal(&%v) ", hasIf.c(false), varname) } } - x.line("} else {") + x.lineIf(hasIf.c(true)) switch t.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: @@ -814,7 +875,7 @@ func (x *genRunner) enc(varname string, t reflect.Type) { if rtid == uint8SliceTypId { x.line("r.EncodeStringBytesRaw([]byte(" + varname + "))") } else if fastpathAV.index(rtid) != -1 { - g := x.newGenV(t) + g := x.newFastpathGenV(t) x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", e)") } else { x.xtraSM(varname, t, true, false) @@ -828,7 +889,7 @@ func (x *genRunner) enc(varname string, t reflect.Type) { // - else call Encoder.encode(XXX) on it. // x.line("if " + varname + " == nil { \nr.EncodeNil()\n } else { ") if fastpathAV.index(rtid) != -1 { - g := x.newGenV(t) + g := x.newFastpathGenV(t) x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", e)") } else { x.xtraSM(varname, t, true, false) @@ -868,6 +929,11 @@ func (x *genRunner) encZero(t reflect.Type) { } } +func (x *genRunner) doEncOmitEmptyLine(t2 reflect.StructField, varname string, buf *genBuf) { + x.f = 0 + x.encOmitEmptyLine(t2, varname, buf) +} + func (x *genRunner) encOmitEmptyLine(t2 reflect.StructField, varname string, buf *genBuf) { // smartly check omitEmpty on a struct type, as it may contain uncomparable map/slice/etc. // also, for maps/slices/arrays, check if len ! 0 (not if == zero value) @@ -890,7 +956,7 @@ func (x *genRunner) encOmitEmptyLine(t2 reflect.StructField, varname string, buf break } // buf.s("(") - buf.s("false") + buf.s(x.sayFalse()) // buf.s("false") for i, n := 0, t2.Type.NumField(); i < n; i++ { f := t2.Type.Field(i) if f.PkgPath != "" { // unexported @@ -910,6 +976,7 @@ func (x *genRunner) encOmitEmptyLine(t2 reflect.StructField, varname string, buf } func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { + // xdebug2f("encStruct, varname: %s, t: %s", varname, t) // Use knowledge from structfieldinfo (mbs, encodable fields. Ignore omitempty. ) // replicate code in kStruct i.e. for each field, deref type to non-pointer, and call x.enc on it @@ -920,11 +987,13 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { numfieldsvar := genTempVarPfx + "q" + i ti2arrayvar := genTempVarPfx + "r" + i struct2arrvar := genTempVarPfx + "2arr" + i + // firstvar := genTempVarPfx + "2first" + i x.line(sepVarname + " := !z.EncBinary()") x.linef("%s := z.EncBasicHandle().StructToArray", struct2arrvar) x.linef("_, _ = %s, %s", sepVarname, struct2arrvar) x.linef("const %s bool = %v // struct tag has 'toArray'", ti2arrayvar, ti.toArray) + // x.linef("var %s bool = true", firstvar) tisfi := ti.sfiSrc // always use sequence from file. decStruct expects same thing. @@ -968,36 +1037,32 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { } } } - x.encOmitEmptyLine(t2, varname, &omitline) + x.doEncOmitEmptyLine(t2, varname, &omitline) x.linef("%s, // %s", omitline.v(), si.fieldName) } x.line("}") x.linef("_ = %s", numfieldsvar) } // x.linef("var %snn%s int", genTempVarPfx, i) - x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray { - x.linef("r.WriteArrayStart(%d)", len(tisfi)) - x.linef("} else {") // if not ti.toArray - if ti.anyOmitEmpty { - // nn = 0 - // x.linef("var %snn%s = %v", genTempVarPfx, i, nn) - x.linef("var %snn%s int", genTempVarPfx, i) - x.linef("for _, b := range %s { if b { %snn%s++ } }", numfieldsvar, genTempVarPfx, i) - x.linef("r.WriteMapStart(%snn%s)", genTempVarPfx, i) - x.linef("%snn%s = %v", genTempVarPfx, i, 0) - } else { - x.linef("r.WriteMapStart(%d)", len(tisfi)) - } - x.line("}") // close if not StructToArray + type genFQN struct { + i string + fqname string + nilLine genBuf + nilVar string + canNil bool + sf reflect.StructField + } + + genFQNs := make([]genFQN, len(tisfi)) for j, si := range tisfi { - i := x.varsfx() - isNilVarName := genTempVarPfx + "n" + i - var labelUsed bool - var t2 reflect.StructField + q := &genFQNs[j] + q.i = x.varsfx() + q.nilVar = genTempVarPfx + "n" + q.i + q.canNil = false + q.fqname = varname { t2typ := t - varname3 := varname for ij, ix := range si.is { if uint8(ij) == si.nis { break @@ -1005,51 +1070,76 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { for t2typ.Kind() == reflect.Ptr { t2typ = t2typ.Elem() } - t2 = t2typ.Field(int(ix)) - t2typ = t2.Type - varname3 = varname3 + "." + t2.Name + q.sf = t2typ.Field(int(ix)) + t2typ = q.sf.Type + q.fqname += "." + q.sf.Name if t2typ.Kind() == reflect.Ptr { - if !labelUsed { - x.line("var " + isNilVarName + " bool") + if !q.canNil { + q.nilLine.f("%s == nil", q.fqname) + q.canNil = true + } else { + q.nilLine.f(" || %s == nil", q.fqname) } - x.line("if " + varname3 + " == nil { " + isNilVarName + " = true ") - x.line("goto LABEL" + i) - x.line("}") - labelUsed = true + // x.linef("if %s == nil { %s = true; goto LABEL%d }", varname3, isNilVarName, i) // "varname3 = new(" + x.genTypeName(t3.Elem()) + ") }") } } // t2 = t.FieldByIndex(si.is) } - if labelUsed { - x.line("LABEL" + i + ":") - } - // if the type of the field is a Selfer, or one of the ones + } - x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray - if labelUsed { - x.linef("if %s { r.WriteArrayElem(); r.EncodeNil() } else { ", isNilVarName) + for j := range genFQNs { + q := &genFQNs[j] + if q.canNil { + x.linef("var %s bool = %s", q.nilVar, q.nilLine.v()) + // x.linef("if %s { %s = true }", q.nilLine.v(), q.nilVar) } - x.line("r.WriteArrayElem()") + } + + x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray + x.linef("z.EncWriteArrayStart(%d)", len(tisfi)) + + for j, si := range tisfi { + q := &genFQNs[j] + // if the type of the field is a Selfer, or one of the ones + if q.canNil { + x.linef("if %s { z.EncWriteArrayElem(); r.EncodeNil() } else { ", q.nilVar) + } + x.linef("z.EncWriteArrayElem()") if si.omitEmpty() { x.linef("if %s[%v] {", numfieldsvar, j) } - x.encVar(varname+"."+t2.Name, t2.Type) + // xdebug2f("varname: %s, t2.Type: %s", varname3, t2.Type) + x.encVarChkNil(q.fqname, q.sf.Type, false) if si.omitEmpty() { x.linef("} else {") - x.encZero(t2.Type) + x.encZero(q.sf.Type) x.linef("}") } - if labelUsed { + if q.canNil { x.line("}") } + } - x.linef("} else {") // if not ti.toArray + x.line("z.EncWriteArrayEnd()") + x.linef("} else {") // if not ti.toArray + if ti.anyOmitEmpty { + // nn = 0 + // x.linef("var %snn%s = %v", genTempVarPfx, i, nn) + x.linef("var %snn%s int", genTempVarPfx, i) + x.linef("for _, b := range %s { if b { %snn%s++ } }", numfieldsvar, genTempVarPfx, i) + x.linef("z.EncWriteMapStart(%snn%s)", genTempVarPfx, i) + x.linef("%snn%s = %v", genTempVarPfx, i, 0) + } else { + x.linef("z.EncWriteMapStart(%d)", len(tisfi)) + } + for j, si := range tisfi { + q := &genFQNs[j] if si.omitEmpty() { x.linef("if %s[%v] {", numfieldsvar, j) } - x.line("r.WriteMapElemKey()") + x.linef("z.EncWriteMapElemKey()") // emulate EncStructFieldKey switch ti.keyType { @@ -1069,25 +1159,20 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { } } // x.linef("r.EncStructFieldKey(codecSelferValueType%s%s, `%s`)", ti.keyType.String(), x.xs, si.encName) - x.line("r.WriteMapElemValue()") - if labelUsed { - x.line("if " + isNilVarName + " { r.EncodeNil() } else { ") - x.encVar(varname+"."+t2.Name, t2.Type) + x.line("z.EncWriteMapElemValue()") + if q.canNil { + x.line("if " + q.nilVar + " { r.EncodeNil() } else { ") + x.encVarChkNil(q.fqname, q.sf.Type, false) x.line("}") } else { - x.encVar(varname+"."+t2.Name, t2.Type) + x.encVarChkNil(q.fqname, q.sf.Type, false) } if si.omitEmpty() { x.line("}") } - x.linef("} ") // end if/else ti.toArray } - x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray { - x.line("r.WriteArrayEnd()") - x.line("} else {") - x.line("r.WriteMapEnd()") - x.line("}") - + x.line("z.EncWriteMapEnd()") + x.linef("} ") // end if/else ti.toArray } func (x *genRunner) encListFallback(varname string, t reflect.Type) { @@ -1124,13 +1209,13 @@ func (x *genRunner) encListFallback(varname string, t reflect.Type) { varname = "sch" + i } - x.line("r.WriteArrayStart(len(" + varname + "))") + x.line("z.EncWriteArrayStart(len(" + varname + "))") x.linef("for _, %sv%s := range %s {", genTempVarPfx, i, varname) - x.line("r.WriteArrayElem()") + x.linef("z.EncWriteArrayElem()") x.encVar(genTempVarPfx+"v"+i, t.Elem()) x.line("}") - x.line("r.WriteArrayEnd()") + x.line("z.EncWriteArrayEnd()") if t.Kind() == reflect.Chan { x.line("}") } @@ -1139,22 +1224,24 @@ func (x *genRunner) encListFallback(varname string, t reflect.Type) { func (x *genRunner) encMapFallback(varname string, t reflect.Type) { // TODO: expand this to handle canonical. i := x.varsfx() - x.line("r.WriteMapStart(len(" + varname + "))") + x.line("z.EncWriteMapStart(len(" + varname + "))") + // x.linef("var %sfirst%s = true", genTempVarPfx, i) x.linef("for %sk%s, %sv%s := range %s {", genTempVarPfx, i, genTempVarPfx, i, varname) - x.line("r.WriteMapElemKey()") + x.linef("z.EncWriteMapElemKey()") + // x.linef("%sfirst%s = false", genTempVarPfx, i) x.encVar(genTempVarPfx+"k"+i, t.Key()) - x.line("r.WriteMapElemValue()") + x.line("z.EncWriteMapElemValue()") x.encVar(genTempVarPfx+"v"+i, t.Elem()) x.line("}") - x.line("r.WriteMapEnd()") + x.line("z.EncWriteMapEnd()") } func (x *genRunner) decVarInitPtr(varname, nilvar string, t reflect.Type, si *structFieldInfo, - newbuf, nilbuf *genBuf) (t2 reflect.StructField) { + newbuf, nilbuf *genBuf) (varname3 string, t2 reflect.StructField) { //we must accommodate anonymous fields, where the embedded field is a nil pointer in the value. // t2 = t.FieldByIndex(si.is) + varname3 = varname t2typ := t - varname3 := varname t2kind := t2typ.Kind() var nilbufed bool if si != nil { @@ -1177,10 +1264,11 @@ func (x *genRunner) decVarInitPtr(varname, nilvar string, t reflect.Type, si *st } if nilbuf != nil { if !nilbufed { - nilbuf.s("if true") + nilbuf.s("if ").s(varname3).s(" != nil") nilbufed = true + } else { + nilbuf.s(" && ").s(varname3).s(" != nil") } - nilbuf.s(" && ").s(varname3).s(" != nil") } } } @@ -1189,7 +1277,7 @@ func (x *genRunner) decVarInitPtr(varname, nilvar string, t reflect.Type, si *st // } if nilbuf != nil { if nilbufed { - nilbuf.s(" { ") + nilbuf.s(" { ").s("// remove the if-true\n") } if nilvar != "" { nilbuf.s(nilvar).s(" = true") @@ -1206,7 +1294,7 @@ func (x *genRunner) decVarInitPtr(varname, nilvar string, t reflect.Type, si *st nilbuf.s("}") } } - return t2 + return } // decVar takes a variable called varname, of type t @@ -1323,8 +1411,9 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { mi := x.varsfx() // x.linef("%sm%s := z.DecBinary()", genTempVarPfx, mi) // x.linef("_ = %sm%s", genTempVarPfx, mi) - x.line("if false {") //start if block - defer func() { x.line("}") }() //end if block + + var hasIf genIfClause + defer hasIf.end(x) var ptrPfx, addrPfx string if isptr { @@ -1333,16 +1422,16 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { addrPfx = "&" } if t == timeTyp { - x.linef("} else if !z.DecBasicHandle().TimeNotBuiltin { %s%v = r.DecodeTime()", ptrPfx, varname) + x.linef("%s !z.DecBasicHandle().TimeNotBuiltin { %s%v = r.DecodeTime()", hasIf.c(false), ptrPfx, varname) // return } if t == rawTyp { - x.linef("} else { %s%v = z.DecRaw()", ptrPfx, varname) + x.linef("%s %s%v = z.DecRaw()", hasIf.c(true), ptrPfx, varname) return } if t == rawExtTyp { - x.linef("} else { r.DecodeExt(%s%v, 0, nil)", addrPfx, varname) + x.linef("%s r.DecodeExt(%s%v, 0, nil)", hasIf.c(true), addrPfx, varname) return } @@ -1351,19 +1440,19 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { // first check if extensions are configued, before doing the interface conversion // x.linef("} else if z.HasExtensions() && z.DecExt(%s) {", varname) yy := fmt.Sprintf("%sxt%s", genTempVarPfx, mi) - x.linef("} else if %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.DecExtension(%s, %s) ", yy, varname, yy, varname, yy) + x.linef("%s %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.DecExtension(%s, %s) ", hasIf.c(false), yy, varname, yy, varname, yy) } if ti2.bu || ti2.bup { // t.Implements(binaryUnmarshalerTyp) || tptr.Implements(binaryUnmarshalerTyp) { - x.linef("} else if z.DecBinary() { z.DecBinaryUnmarshal(%s%v) ", addrPfx, varname) + x.linef("%s z.DecBinary() { z.DecBinaryUnmarshal(%s%v) ", hasIf.c(false), addrPfx, varname) } if ti2.ju || ti2.jup { // t.Implements(jsonUnmarshalerTyp) || tptr.Implements(jsonUnmarshalerTyp) { - x.linef("} else if !z.DecBinary() && z.IsJSONHandle() { z.DecJSONUnmarshal(%s%v)", addrPfx, varname) + x.linef("%s !z.DecBinary() && z.IsJSONHandle() { z.DecJSONUnmarshal(%s%v)", hasIf.c(false), addrPfx, varname) } else if ti2.tu || ti2.tup { // t.Implements(textUnmarshalerTyp) || tptr.Implements(textUnmarshalerTyp) { - x.linef("} else if !z.DecBinary() { z.DecTextUnmarshal(%s%v)", addrPfx, varname) + x.linef("%s !z.DecBinary() { z.DecTextUnmarshal(%s%v)", hasIf.c(false), addrPfx, varname) } - x.line("} else {") + x.lineIf(hasIf.c(true)) if x.decTryAssignPrimitive(varname, t, isptr) { return @@ -1382,7 +1471,7 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { x.linef("%s%s = r.DecodeBytes(%s(%s[]byte)(%s), false)", ptrPfx, varname, ptrPfx, ptrPfx, varname) } else if fastpathAV.index(rtid) != -1 { - g := x.newGenV(t) + g := x.newFastpathGenV(t) x.linef("z.F.%sX(%s%s, d)", g.MethodNamePfx("Dec", false), addrPfx, varname) } else { x.xtraSM(varname, t, false, isptr) @@ -1394,7 +1483,7 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { // - if elements are primitives or Selfers, call dedicated function on each member. // - else call Encoder.encode(XXX) on it. if fastpathAV.index(rtid) != -1 { - g := x.newGenV(t) + g := x.newFastpathGenV(t) x.linef("z.F.%sX(%s%s, d)", g.MethodNamePfx("Dec", false), addrPfx, varname) } else { x.xtraSM(varname, t, false, isptr) @@ -1457,7 +1546,7 @@ func (x *genRunner) decTryAssignPrimitive(varname string, t reflect.Type, isptr x.linef("%s%s = (%s)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize%s))", ptr, varname, x.genTypeName(t), x.xs) case reflect.Float32: - x.linef("%s%s = (%s)(r.DecodeFloat32As64())", ptr, varname, x.genTypeName(t)) + x.linef("%s%s = (%s)(z.DecDecodeFloat32())", ptr, varname, x.genTypeName(t)) case reflect.Float64: x.linef("%s%s = (%s)(r.DecodeFloat64())", ptr, varname, x.genTypeName(t)) @@ -1582,9 +1671,9 @@ func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintpt x.line("case \"" + si.encName + "\":") newbuf.reset() nilbuf.reset() - t2 := x.decVarInitPtr(varname, "", t, si, &newbuf, &nilbuf) + varname3, t2 := x.decVarInitPtr(varname, "", t, si, &newbuf, &nilbuf) x.linef("if r.TryDecodeAsNil() { %s } else { %s", nilbuf.buf, newbuf.buf) - x.decVarMain(varname+"."+t2.Name, x.varsfx(), t2.Type, false) + x.decVarMain(varname3, x.varsfx(), t2.Type, false) x.line("}") } x.line("default:") @@ -1610,7 +1699,7 @@ func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t ref x.linef("if %shl%s { if %sj%s >= %s { break }", tpfx, i, tpfx, i, lenvarname) x.line("} else { if r.CheckBreak() { break }; }") } - x.line("r.ReadMapElemKey()") + x.line("z.DecReadMapElemKey()") // emulate decstructfieldkey switch ti.keyType { @@ -1625,11 +1714,11 @@ func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t ref } // x.linef("%s := z.StringView(r.DecStructFieldKey(codecSelferValueType%s%s, z.DecScratchArrayBuffer()))", kName, ti.keyType.String(), x.xs) - x.line("r.ReadMapElemValue()") + x.line("z.DecReadMapElemValue()") x.decStructMapSwitch(kName, varname, rtid, t) x.line("} // end for " + tpfx + "j" + i) - x.line("r.ReadMapEnd()") + x.line("z.DecReadMapEnd()") } func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid uintptr, t reflect.Type) { @@ -1645,13 +1734,13 @@ func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid x.linef("%sj%s++; if %shl%s { %sb%s = %sj%s > %s } else { %sb%s = r.CheckBreak() }", tpfx, i, tpfx, i, tpfx, i, tpfx, i, lenvarname, tpfx, i) - x.linef("if %sb%s { r.ReadArrayEnd(); %s }", tpfx, i, breakString) - x.line("r.ReadArrayElem()") + x.linef("if %sb%s { z.DecReadArrayEnd(); %s }", tpfx, i, breakString) + x.line("z.DecReadArrayElem()") newbuf.reset() nilbuf.reset() - t2 := x.decVarInitPtr(varname, "", t, si, &newbuf, &nilbuf) + varname3, t2 := x.decVarInitPtr(varname, "", t, si, &newbuf, &nilbuf) x.linef("if r.TryDecodeAsNil() { %s } else { %s", nilbuf.buf, newbuf.buf) - x.decVarMain(varname+"."+t2.Name, x.varsfx(), t2.Type, false) + x.decVarMain(varname3, x.varsfx(), t2.Type, false) x.line("}") } // read remaining values and throw away. @@ -1660,10 +1749,10 @@ func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid tpfx, i, tpfx, i, tpfx, i, tpfx, i, lenvarname, tpfx, i) x.linef("if %sb%s { break }", tpfx, i) - x.line("r.ReadArrayElem()") + x.line("z.DecReadArrayElem()") x.linef(`z.DecStructFieldNotFound(%sj%s - 1, "")`, tpfx, i) x.line("}") - x.line("r.ReadArrayEnd()") + x.line("z.DecReadArrayEnd()") } func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) { @@ -1671,9 +1760,9 @@ func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) { i := x.varsfx() x.linef("%sct%s := r.ContainerType()", genTempVarPfx, i) x.linef("if %sct%s == codecSelferValueTypeMap%s {", genTempVarPfx, i, x.xs) - x.line(genTempVarPfx + "l" + i + " := r.ReadMapStart()") + x.line(genTempVarPfx + "l" + i + " := z.DecReadMapStart()") x.linef("if %sl%s == 0 {", genTempVarPfx, i) - x.line("r.ReadMapEnd()") + x.line("z.DecReadMapEnd()") if genUseOneFunctionForDecStructMap { x.line("} else { ") x.linef("%s.codecDecodeSelfFromMap(%sl%s, d)", varname, genTempVarPfx, i) @@ -1687,9 +1776,9 @@ func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) { // else if container is array x.linef("} else if %sct%s == codecSelferValueTypeArray%s {", genTempVarPfx, i, x.xs) - x.line(genTempVarPfx + "l" + i + " := r.ReadArrayStart()") + x.line(genTempVarPfx + "l" + i + " := z.DecReadArrayStart()") x.linef("if %sl%s == 0 {", genTempVarPfx, i) - x.line("r.ReadArrayEnd()") + x.line("z.DecReadArrayEnd()") x.line("} else { ") x.linef("%s.codecDecodeSelfFromArray(%sl%s, d)", varname, genTempVarPfx, i) x.line("}") @@ -1701,15 +1790,17 @@ func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) { // -------- -type genV struct { - // genV is either a primitive (Primitive != "") or a map (MapKey != "") or a slice - MapKey string - Elem string - Primitive string - Size int +type fastpathGenV struct { + // fastpathGenV is either a primitive (Primitive != "") or a map (MapKey != "") or a slice + MapKey string + Elem string + Primitive string + Size int + NoCanonical bool } -func (x *genRunner) newGenV(t reflect.Type) (v genV) { +func (x *genRunner) newFastpathGenV(t reflect.Type) (v fastpathGenV) { + v.NoCanonical = !genFastpathCanonical switch t.Kind() { case reflect.Slice, reflect.Array: te := t.Elem() @@ -1721,12 +1812,12 @@ func (x *genRunner) newGenV(t reflect.Type) (v genV) { v.MapKey = x.genTypeName(tk) v.Size = int(te.Size() + tk.Size()) default: - panic("unexpected type for newGenV. Requires map or slice type") + panic("unexpected type for newFastpathGenV. Requires map or slice type") } return } -func (x *genV) MethodNamePfx(prefix string, prim bool) string { +func (x *fastpathGenV) MethodNamePfx(prefix string, prim bool) string { var name []byte if prefix != "" { name = append(name, prefix...) @@ -1743,7 +1834,6 @@ func (x *genV) MethodNamePfx(prefix string, prim bool) string { name = append(name, genTitleCaseName(x.Elem)...) } return string(name) - } // genImportPath returns import path of a non-predeclared named typed, or an empty string otherwise. @@ -1791,6 +1881,8 @@ func genTitleCaseName(s string) string { switch s { case "interface{}", "interface {}": return "Intf" + case "[]byte", "[]uint8", "bytes": + return "Bytes" default: return strings.ToUpper(s[0:1]) + s[1:] } @@ -1878,7 +1970,7 @@ func genIsImmutable(t reflect.Type) (v bool) { type genInternal struct { Version int - Values []genV + Values []fastpathGenV } func (x genInternal) FastpathLen() (l int) { @@ -1894,6 +1986,8 @@ func genInternalZeroValue(s string) string { switch s { case "interface{}", "interface {}": return "nil" + case "[]byte", "[]uint8", "bytes": + return "nil" case "bool": return "false" case "string": @@ -1903,49 +1997,55 @@ func genInternalZeroValue(s string) string { } } -var genInternalNonZeroValueIdx [5]uint64 -var genInternalNonZeroValueStrs = [2][5]string{ - {`"string-is-an-interface"`, "true", `"some-string"`, "11.1", "33"}, - {`"string-is-an-interface-2"`, "true", `"some-string-2"`, "22.2", "44"}, +var genInternalNonZeroValueIdx [6]uint64 +var genInternalNonZeroValueStrs = [2][6]string{ + {`"string-is-an-interface"`, "true", `"some-string"`, `[]byte("some-string")`, "11.1", "33"}, + {`"string-is-an-interface-2"`, "true", `"some-string-2"`, `[]byte("some-string-2")`, "22.2", "44"}, } func genInternalNonZeroValue(s string) string { + var i int switch s { case "interface{}", "interface {}": - genInternalNonZeroValueIdx[0]++ - return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[0]%2][0] // return string, to remove ambiguity + i = 0 case "bool": - genInternalNonZeroValueIdx[1]++ - return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[1]%2][1] + i = 1 case "string": - genInternalNonZeroValueIdx[2]++ - return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[2]%2][2] + i = 2 + case "bytes", "[]byte", "[]uint8": + i = 3 case "float32", "float64", "float", "double": - genInternalNonZeroValueIdx[3]++ - return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[3]%2][3] + i = 4 default: - genInternalNonZeroValueIdx[4]++ - return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[4]%2][4] + i = 5 } + genInternalNonZeroValueIdx[i]++ + return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[i]%2][i] // return string, to remove ambiguity } func genInternalEncCommandAsString(s string, vname string) string { switch s { - case "uint", "uint8", "uint16", "uint32", "uint64": - return "ee.EncodeUint(uint64(" + vname + "))" - case "int", "int8", "int16", "int32", "int64": - return "ee.EncodeInt(int64(" + vname + "))" + case "uint64": + return "e.e.EncodeUint(" + vname + ")" + case "uint", "uint8", "uint16", "uint32": + return "e.e.EncodeUint(uint64(" + vname + "))" + case "int64": + return "e.e.EncodeInt(" + vname + ")" + case "int", "int8", "int16", "int32": + return "e.e.EncodeInt(int64(" + vname + "))" + case "[]byte", "[]uint8", "bytes": + return "e.e.EncodeStringBytesRaw(" + vname + ")" case "string": - return "if e.h.StringToRaw { ee.EncodeStringBytesRaw(bytesView(" + vname + ")) " + - "} else { ee.EncodeStringEnc(cUTF8, " + vname + ") }" + return "if e.h.StringToRaw { e.e.EncodeStringBytesRaw(bytesView(" + vname + ")) " + + "} else { e.e.EncodeStringEnc(cUTF8, " + vname + ") }" case "float32": - return "ee.EncodeFloat32(" + vname + ")" + return "e.e.EncodeFloat32(" + vname + ")" case "float64": - return "ee.EncodeFloat64(" + vname + ")" + return "e.e.EncodeFloat64(" + vname + ")" case "bool": - return "ee.EncodeBool(" + vname + ")" + return "e.e.EncodeBool(" + vname + ")" // case "symbol": - // return "ee.EncodeSymbol(" + vname + ")" + // return "e.e.EncodeSymbol(" + vname + ")" default: return "e.encode(" + vname + ")" } @@ -1954,50 +2054,58 @@ func genInternalEncCommandAsString(s string, vname string) string { func genInternalDecCommandAsString(s string) string { switch s { case "uint": - return "uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))" + return "uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))" case "uint8": - return "uint8(chkOvf.UintV(dd.DecodeUint64(), 8))" + return "uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))" case "uint16": - return "uint16(chkOvf.UintV(dd.DecodeUint64(), 16))" + return "uint16(chkOvf.UintV(d.d.DecodeUint64(), 16))" case "uint32": - return "uint32(chkOvf.UintV(dd.DecodeUint64(), 32))" + return "uint32(chkOvf.UintV(d.d.DecodeUint64(), 32))" case "uint64": - return "dd.DecodeUint64()" + return "d.d.DecodeUint64()" case "uintptr": - return "uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))" + return "uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))" case "int": - return "int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))" + return "int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))" case "int8": - return "int8(chkOvf.IntV(dd.DecodeInt64(), 8))" + return "int8(chkOvf.IntV(d.d.DecodeInt64(), 8))" case "int16": - return "int16(chkOvf.IntV(dd.DecodeInt64(), 16))" + return "int16(chkOvf.IntV(d.d.DecodeInt64(), 16))" case "int32": - return "int32(chkOvf.IntV(dd.DecodeInt64(), 32))" + return "int32(chkOvf.IntV(d.d.DecodeInt64(), 32))" case "int64": - return "dd.DecodeInt64()" + return "d.d.DecodeInt64()" case "string": - return "dd.DecodeString()" + return "d.d.DecodeString()" + case "[]byte", "[]uint8", "bytes": + return "d.d.DecodeBytes(nil, false)" case "float32": - return "float32(chkOvf.Float32V(dd.DecodeFloat64()))" + return "float32(d.decodeFloat32())" case "float64": - return "dd.DecodeFloat64()" + return "d.d.DecodeFloat64()" case "bool": - return "dd.DecodeBool()" + return "d.d.DecodeBool()" default: panic(errors.New("gen internal: unknown type for decode: " + s)) } } func genInternalSortType(s string, elem bool) string { - for _, v := range [...]string{"int", "uint", "float", "bool", "string"} { + for _, v := range [...]string{ + "int", "uint", "float", + "bool", + "string", "bytes", "[]uint8", "[]byte", + } { + if v == "[]byte" || v == "[]uint8" { + v = "bytes" + } if strings.HasPrefix(s, v) { + if v == "int" || v == "uint" || v == "float" { + v += "64" + } if elem { - if v == "int" || v == "uint" || v == "float" { - return v + "64" - } else { - return v - } + return v } return v + "Slice" } @@ -2024,49 +2132,12 @@ var genInternalTmplFuncs template.FuncMap var genInternalOnce sync.Once func genInternalInit() { - types := [...]string{ - "interface{}", - "string", - "float32", - "float64", - "uint", - "uint8", - "uint16", - "uint32", - "uint64", - "uintptr", - "int", - "int8", - "int16", - "int32", - "int64", - "bool", - } - // keep as slice, so it is in specific iteration order. - // Initial order was uint64, string, interface{}, int, int64 - mapvaltypes := [...]string{ - "interface{}", - "string", - "uint", - "uint8", - "uint16", - "uint32", - "uint64", - "uintptr", - "int", - "int8", - "int16", - "int32", - "int64", - "float32", - "float64", - "bool", - } wordSizeBytes := int(intBitsize) / 8 - mapvaltypes2 := map[string]int{ + typesizes := map[string]int{ "interface{}": 2 * wordSizeBytes, "string": 2 * wordSizeBytes, + "[]byte": 3 * wordSizeBytes, "uint": 1 * wordSizeBytes, "uint8": 1, "uint16": 2, @@ -2082,20 +2153,113 @@ func genInternalInit() { "float64": 8, "bool": 1, } + + // keep as slice, so it is in specific iteration order. + // Initial order was uint64, string, interface{}, int, int64, ... + + var types = [...]string{ + "interface{}", + "string", + "[]byte", + "float32", + "float64", + "uint", + "uint8", + "uint16", + "uint32", + "uint64", + "uintptr", + "int", + "int8", + "int16", + "int32", + "int64", + "bool", + } + + var primitivetypes, slicetypes, mapkeytypes, mapvaltypes []string + + primitivetypes = types[:] + slicetypes = types[:] + mapkeytypes = types[:] + mapvaltypes = types[:] + + if genFastpathTrimTypes { + mapkeytypes = []string{ + //"interface{}", + "string", + //"[]byte", + //"float32", + //"float64", + "uint", + "uint8", + //"uint16", + //"uint32", + "uint64", + //"uintptr", + "int", + //"int8", + //"int16", + //"int32", + "int64", + // "bool", + } + + mapvaltypes = []string{ + "interface{}", + "string", + "[]byte", + "uint", + "uint8", + //"uint16", + //"uint32", + "uint64", + "uintptr", + "int", + //"int8", + //"int16", + //"int32", + "int64", + "float32", + "float64", + "bool", + } + } + + // var mapkeytypes [len(&types) - 1]string // skip bool + // copy(mapkeytypes[:], types[:]) + + // var mb []byte + // mb = append(mb, '|') + // for _, s := range mapkeytypes { + // mb = append(mb, s...) + // mb = append(mb, '|') + // } + // var mapkeytypestr = string(mb) + var gt = genInternal{Version: genVersion} // For each slice or map type, there must be a (symmetrical) Encode and Decode fast-path function - for _, s := range types { - gt.Values = append(gt.Values, genV{Primitive: s, Size: mapvaltypes2[s]}) + + for _, s := range primitivetypes { + gt.Values = append(gt.Values, + fastpathGenV{Primitive: s, Size: typesizes[s], NoCanonical: !genFastpathCanonical}) + } + for _, s := range slicetypes { // if s != "uint8" { // do not generate fast path for slice of bytes. Treat specially already. - // gt.Values = append(gt.Values, genV{Elem: s, Size: mapvaltypes2[s]}) + // gt.Values = append(gt.Values, fastpathGenV{Elem: s, Size: typesizes[s]}) + // } + gt.Values = append(gt.Values, + fastpathGenV{Elem: s, Size: typesizes[s], NoCanonical: !genFastpathCanonical}) + } + for _, s := range mapkeytypes { + // if _, ok := typesizes[s]; !ok { + // if strings.Contains(mapkeytypestr, "|"+s+"|") { + // gt.Values = append(gt.Values, fastpathGenV{MapKey: s, Elem: s, Size: 2 * typesizes[s]}) // } - gt.Values = append(gt.Values, genV{Elem: s, Size: mapvaltypes2[s]}) - if _, ok := mapvaltypes2[s]; !ok { - gt.Values = append(gt.Values, genV{MapKey: s, Elem: s, Size: 2 * mapvaltypes2[s]}) - } for _, ms := range mapvaltypes { - gt.Values = append(gt.Values, genV{MapKey: s, Elem: ms, Size: mapvaltypes2[s] + mapvaltypes2[ms]}) + gt.Values = append(gt.Values, + fastpathGenV{MapKey: s, Elem: ms, Size: typesizes[s] + typesizes[ms], NoCanonical: !genFastpathCanonical}) } } diff --git a/backend/vendor/github.com/ugorji/go/codec/helper.go b/backend/vendor/github.com/ugorji/go/codec/helper.go index 8ada846b..daca5774 100644 --- a/backend/vendor/github.com/ugorji/go/codec/helper.go +++ b/backend/vendor/github.com/ugorji/go/codec/helper.go @@ -170,6 +170,14 @@ func init() { refBitset.set(byte(reflect.Chan)) } +type handleFlag uint8 + +const ( + initedHandleFlag handleFlag = 1 << iota + binaryHandleFlag + jsonHandleFlag +) + type clsErr struct { closed bool // is it closed? errClosed error // error on closing @@ -257,11 +265,11 @@ type containerState uint8 const ( _ containerState = iota - containerMapStart // slot left open, since Driver method already covers it + containerMapStart containerMapKey containerMapValue containerMapEnd - containerArrayStart // slot left open, since Driver methods already cover it + containerArrayStart containerArrayElem containerArrayEnd ) @@ -293,6 +301,7 @@ const ( typeInfoLoadArrayBLen = 8 * 4 ) +// typeInfoLoad is a transient object used while loading up a typeInfo. type typeInfoLoad struct { // fNames []string // encNames []string @@ -300,6 +309,8 @@ type typeInfoLoad struct { sfis []structFieldInfo } +// typeInfoLoadArray is a cache object used to efficiently load up a typeInfo without +// much allocation. type typeInfoLoadArray struct { // fNames [typeInfoLoadArrayLen]string // encNames [typeInfoLoadArrayLen]string @@ -309,6 +320,12 @@ type typeInfoLoadArray struct { b [typeInfoLoadArrayBLen]byte // scratch - used for struct field names } +// // cacheLineSafer denotes that a type is safe for cache-line access. +// // This could mean that +// type cacheLineSafer interface { +// cacheLineSafe() +// } + // mirror json.Marshaler and json.Unmarshaler here, // so we don't import the encoding/json package @@ -522,10 +539,9 @@ type BasicHandle struct { intf2impls - inited uint32 - _ uint32 // padding + EncodeOptions - // ---- cache line + DecodeOptions RPCOptions @@ -559,37 +575,71 @@ type BasicHandle struct { // runtime.SetFinalizer(d, (*Decoder).Release) ExplicitRelease bool - be bool // is handle a binary encoding? - js bool // is handle javascript handler? - n byte // first letter of handle name - _ uint16 // padding + // flags handleFlag // holds flag for if binaryEncoding, jsonHandler, etc + // be bool // is handle a binary encoding? + // js bool // is handle javascript handler? + // n byte // first letter of handle name + // _ uint16 // padding // ---- cache line - DecodeOptions - - // ---- cache line - - EncodeOptions - // noBuiltInTypeChecker + inited uint32 // holds if inited, and also handle flags (binary encoding, json handler, etc) + mu sync.Mutex + // _ uint32 // padding rtidFns atomicRtidFnSlice - mu sync.Mutex + // r []uintptr // rtids mapped to s above } // basicHandle returns an initialized BasicHandle from the Handle. func basicHandle(hh Handle) (x *BasicHandle) { x = hh.getBasicHandle() - if atomic.CompareAndSwapUint32(&x.inited, 0, 1) { - x.be = hh.isBinary() - _, x.js = hh.(*JsonHandle) - x.n = hh.Name()[0] + // ** We need to simulate once.Do, to ensure no data race within the block. + // ** Consequently, below would not work. + // if atomic.CompareAndSwapUint32(&x.inited, 0, 1) { + // x.be = hh.isBinary() + // _, x.js = hh.(*JsonHandle) + // x.n = hh.Name()[0] + // } + + // simulate once.Do using our own stored flag and mutex as a CompareAndSwap + // is not sufficient, since a race condition can occur within init(Handle) function. + // init is made noinline, so that this function can be inlined by its caller. + if atomic.LoadUint32(&x.inited) == 0 { + x.init(hh) } return } +func (x *BasicHandle) isJs() bool { + return handleFlag(x.inited)&jsonHandleFlag != 0 +} + +func (x *BasicHandle) isBe() bool { + return handleFlag(x.inited)&binaryHandleFlag != 0 +} + +//go:noinline +func (x *BasicHandle) init(hh Handle) { + // make it uninlineable, as it is called at most once + x.mu.Lock() + if x.inited == 0 { + var f = initedHandleFlag + if hh.isBinary() { + f |= binaryHandleFlag + } + if _, b := hh.(*JsonHandle); b { + f |= jsonHandleFlag + } + // _, x.js = hh.(*JsonHandle) + // x.n = hh.Name()[0] + atomic.StoreUint32(&x.inited, uint32(f)) + } + x.mu.Unlock() +} + func (x *BasicHandle) getBasicHandle() *BasicHandle { return x } @@ -669,20 +719,21 @@ func (x *BasicHandle) fn(rt reflect.Type, checkFastpath, checkCodecSelfer bool) if rk == reflect.Struct || rk == reflect.Array { fi.addrE = true } - } else if supportMarshalInterfaces && c.be && (ti.bm || ti.bmp) && (ti.bu || ti.bup) { + } else if supportMarshalInterfaces && c.isBe() && (ti.bm || ti.bmp) && (ti.bu || ti.bup) { fn.fe = (*Encoder).binaryMarshal fn.fd = (*Decoder).binaryUnmarshal fi.addrF = true fi.addrD = ti.bup fi.addrE = ti.bmp - } else if supportMarshalInterfaces && !c.be && c.js && (ti.jm || ti.jmp) && (ti.ju || ti.jup) { + } else if supportMarshalInterfaces && !c.isBe() && c.isJs() && + (ti.jm || ti.jmp) && (ti.ju || ti.jup) { //If JSON, we should check JSONMarshal before textMarshal fn.fe = (*Encoder).jsonMarshal fn.fd = (*Decoder).jsonUnmarshal fi.addrF = true fi.addrD = ti.jup fi.addrE = ti.jmp - } else if supportMarshalInterfaces && !c.be && (ti.tm || ti.tmp) && (ti.tu || ti.tup) { + } else if supportMarshalInterfaces && !c.isBe() && (ti.tm || ti.tmp) && (ti.tu || ti.tup) { fn.fe = (*Encoder).textMarshal fn.fd = (*Decoder).textUnmarshal fi.addrF = true @@ -953,11 +1004,6 @@ func (x addExtWrapper) UpdateExt(dest interface{}, v interface{}) { x.ReadExt(dest, v.([]byte)) } -type extWrapper struct { - BytesExt - InterfaceExt -} - type bytesExtFailer struct{} func (bytesExtFailer) WriteExt(v interface{}) []byte { @@ -978,6 +1024,21 @@ func (interfaceExtFailer) UpdateExt(dest interface{}, v interface{}) { panicv.errorstr("InterfaceExt.UpdateExt is not supported") } +// type extWrapper struct { +// BytesExt +// InterfaceExt +// } + +type bytesExtWrapper struct { + interfaceExtFailer + BytesExt +} + +type interfaceExtWrapper struct { + bytesExtFailer + InterfaceExt +} + type binaryEncodingType struct{} func (binaryEncodingType) isBinary() bool { return true } @@ -1035,7 +1096,7 @@ type extTypeTagFn struct { rt reflect.Type tag uint64 ext Ext - _ [1]uint64 // padding + // _ [1]uint64 // padding } type extHandle []extTypeTagFn @@ -1092,7 +1153,7 @@ func (o *extHandle) SetExt(rt reflect.Type, tag uint64, ext Ext) (err error) { } } rtidptr := rt2id(reflect.PtrTo(rt)) - *o = append(o2, extTypeTagFn{rtid, rtidptr, rt, tag, ext, [1]uint64{}}) + *o = append(o2, extTypeTagFn{rtid, rtidptr, rt, tag, ext}) // , [1]uint64{}}) return } @@ -1200,7 +1261,7 @@ type structFieldInfo struct { encNameAsciiAlphaNum bool // the encName only contains ascii alphabet and numbers structFieldInfoFlag - _ [1]byte // padding + // _ [1]byte // padding } func (si *structFieldInfo) setToZeroValue(v reflect.Value) { @@ -1389,7 +1450,8 @@ const ( typeInfoFlagIsZeroerPtr ) -// typeInfo keeps information about each (non-ptr) type referenced in the encode/decode sequence. +// typeInfo keeps static (non-changing readonly)information +// about each (non-ptr) type referenced in the encode/decode sequence. // // During an encode/decode sequence, we work as below: // - If base is a built in type, en/decode base value @@ -1448,8 +1510,8 @@ type typeInfo struct { flags typeInfoFlag infoFieldOmitempty bool - _ [6]byte // padding - _ [2]uint64 // padding + // _ [6]byte // padding + // _ [2]uint64 // padding } func (ti *typeInfo) isFlag(f typeInfoFlag) bool { @@ -1487,8 +1549,9 @@ type TypeInfos struct { // infos: formerly map[uintptr]*typeInfo, now *[]rtid2ti, 2 words expected infos atomicTypeInfoSlice mu sync.Mutex + _ uint64 // padding (cache-aligned) tags []string - _ [2]uint64 // padding + _ uint64 // padding (cache-aligned) } // NewTypeInfos creates a TypeInfos given a set of struct tags keys. @@ -1811,7 +1874,7 @@ func rgetResolveSFI(rt reflect.Type, x []structFieldInfo, pv *typeInfoLoadArray) for i := range x { ui = uint16(i) xn = x[i].encName // fieldName or encName? use encName for now. - if len(xn)+2 > cap(pv.b) { + if len(xn)+2 > cap(sn) { sn = make([]byte, len(xn)+2) } else { sn = sn[:len(xn)+2] @@ -1828,24 +1891,22 @@ func rgetResolveSFI(rt reflect.Type, x []structFieldInfo, pv *typeInfoLoadArray) sa = append(sa, 0xff, byte(ui>>8), byte(ui)) } else { index := uint16(sa[j+len(sn)+1]) | uint16(sa[j+len(sn)])<<8 - // one of them must be reset to nil, - // and the index updated appropriately to the other one - if x[i].nis == x[index].nis { - } else if x[i].nis < x[index].nis { + // one of them must be cleared (reset to nil), + // and the index updated appropriately + i2clear := ui // index to be cleared + if x[i].nis < x[index].nis { // this one is shallower + // update the index to point to this later one. sa[j+len(sn)], sa[j+len(sn)+1] = byte(ui>>8), byte(ui) - if x[index].ready() { - x[index].flagClr(structFieldInfoFlagReady) - n-- - } - } else { - if x[i].ready() { - x[i].flagClr(structFieldInfoFlagReady) - n-- - } + // clear the earlier one, as this later one is shallower. + i2clear = index + } + if x[i2clear].ready() { + x[i2clear].flagClr(structFieldInfoFlagReady) + n-- } } - } + var w []structFieldInfo sharingArray := len(x) <= typeInfoLoadArraySfisLen // sharing array with typeInfoLoadArray if sharingArray { @@ -2015,7 +2076,7 @@ type codecFn struct { i codecFnInfo fe func(*Encoder, *codecFnInfo, reflect.Value) fd func(*Decoder, *codecFnInfo, reflect.Value) - _ [1]uint64 // padding + _ [1]uint64 // padding (cache-aligned) } type codecRtidFn struct { @@ -2105,9 +2166,51 @@ func (x checkOverflow) SignedIntV(v uint64) int64 { return int64(v) } -// ------------------ SORT ----------------- +// ------------------ FLOATING POINT ----------------- -func isNaN(f float64) bool { return f != f } +func isNaN64(f float64) bool { return f != f } +func isNaN32(f float32) bool { return f != f } +func abs32(f float32) float32 { + return math.Float32frombits(math.Float32bits(f) &^ (1 << 31)) +} + +// Per go spec, floats are represented in memory as +// IEEE single or double precision floating point values. +// +// We also looked at the source for stdlib math/modf.go, +// reviewed https://github.com/chewxy/math32 +// and read wikipedia documents describing the formats. +// +// It became clear that we could easily look at the bits to determine +// whether any fraction exists. +// +// This is all we need for now. + +func noFrac64(f float64) (v bool) { + x := math.Float64bits(f) + e := uint64(x>>52)&0x7FF - 1023 // uint(x>>shift)&mask - bias + // clear top 12+e bits, the integer part; if the rest is 0, then no fraction. + if e < 52 { + // return x&((1<<64-1)>>(12+e)) == 0 + return x<<(12+e) == 0 + } + return +} +func noFrac32(f float32) (v bool) { + x := math.Float32bits(f) + e := uint32(x>>23)&0xFF - 127 // uint(x>>shift)&mask - bias + // clear top 9+e bits, the integer part; if the rest is 0, then no fraction. + if e < 23 { + // return x&((1<<32-1)>>(9+e)) == 0 + return x<<(9+e) == 0 + } + return +} + +// func noFrac(f float64) bool { +// _, frac := math.Modf(float64(f)) +// return frac == 0 +// } // ----------------------- @@ -2125,132 +2228,11 @@ type ioBuffered interface { // ----------------------- -type intSlice []int64 -type uintSlice []uint64 - -// type uintptrSlice []uintptr -type floatSlice []float64 -type boolSlice []bool -type stringSlice []string - -// type bytesSlice [][]byte - -func (p intSlice) Len() int { return len(p) } -func (p intSlice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } -func (p intSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -func (p uintSlice) Len() int { return len(p) } -func (p uintSlice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } -func (p uintSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -// func (p uintptrSlice) Len() int { return len(p) } -// func (p uintptrSlice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } -// func (p uintptrSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -func (p floatSlice) Len() int { return len(p) } -func (p floatSlice) Less(i, j int) bool { - return p[uint(i)] < p[uint(j)] || isNaN(p[uint(i)]) && !isNaN(p[uint(j)]) -} -func (p floatSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -func (p stringSlice) Len() int { return len(p) } -func (p stringSlice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } -func (p stringSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -// func (p bytesSlice) Len() int { return len(p) } -// func (p bytesSlice) Less(i, j int) bool { return bytes.Compare(p[uint(i)], p[uint(j)]) == -1 } -// func (p bytesSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -func (p boolSlice) Len() int { return len(p) } -func (p boolSlice) Less(i, j int) bool { return !p[uint(i)] && p[uint(j)] } -func (p boolSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -// --------------------- - type sfiRv struct { v *structFieldInfo r reflect.Value } -type intRv struct { - v int64 - r reflect.Value -} -type intRvSlice []intRv -type uintRv struct { - v uint64 - r reflect.Value -} -type uintRvSlice []uintRv -type floatRv struct { - v float64 - r reflect.Value -} -type floatRvSlice []floatRv -type boolRv struct { - v bool - r reflect.Value -} -type boolRvSlice []boolRv -type stringRv struct { - v string - r reflect.Value -} -type stringRvSlice []stringRv -type bytesRv struct { - v []byte - r reflect.Value -} -type bytesRvSlice []bytesRv -type timeRv struct { - v time.Time - r reflect.Value -} -type timeRvSlice []timeRv - -func (p intRvSlice) Len() int { return len(p) } -func (p intRvSlice) Less(i, j int) bool { return p[uint(i)].v < p[uint(j)].v } -func (p intRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -func (p uintRvSlice) Len() int { return len(p) } -func (p uintRvSlice) Less(i, j int) bool { return p[uint(i)].v < p[uint(j)].v } -func (p uintRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -func (p floatRvSlice) Len() int { return len(p) } -func (p floatRvSlice) Less(i, j int) bool { - return p[uint(i)].v < p[uint(j)].v || isNaN(p[uint(i)].v) && !isNaN(p[uint(j)].v) -} -func (p floatRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -func (p stringRvSlice) Len() int { return len(p) } -func (p stringRvSlice) Less(i, j int) bool { return p[uint(i)].v < p[uint(j)].v } -func (p stringRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -func (p bytesRvSlice) Len() int { return len(p) } -func (p bytesRvSlice) Less(i, j int) bool { return bytes.Compare(p[uint(i)].v, p[uint(j)].v) == -1 } -func (p bytesRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -func (p boolRvSlice) Len() int { return len(p) } -func (p boolRvSlice) Less(i, j int) bool { return !p[uint(i)].v && p[uint(j)].v } -func (p boolRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -func (p timeRvSlice) Len() int { return len(p) } -func (p timeRvSlice) Less(i, j int) bool { return p[uint(i)].v.Before(p[uint(j)].v) } -func (p timeRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - -// ----------------- - -type bytesI struct { - v []byte - i interface{} -} - -type bytesISlice []bytesI - -func (p bytesISlice) Len() int { return len(p) } -func (p bytesISlice) Less(i, j int) bool { return bytes.Compare(p[uint(i)].v, p[uint(j)].v) == -1 } -func (p bytesISlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } - // ----------------- type set []uintptr @@ -2258,6 +2240,8 @@ type set []uintptr func (s *set) add(v uintptr) (exists bool) { // e.ci is always nil, or len >= 1 x := *s + // defer func() { xdebugf("set.add: len: %d", len(x)) }() + if x == nil { x = make([]uintptr, 1, 8) x[0] = v @@ -2645,7 +2629,7 @@ func (z *sfiRvPooler) get(newlen int) (fkvs []sfiRv) { return } -// xdebugf prints the message in red on the terminal. +// xdebugf printf. the message in red on the terminal. // Use it in place of fmt.Printf (which it calls internally) func xdebugf(pattern string, args ...interface{}) { var delim string @@ -2655,6 +2639,16 @@ func xdebugf(pattern string, args ...interface{}) { fmt.Printf("\033[1;31m"+pattern+delim+"\033[0m", args...) } +// xdebug2f printf. the message in blue on the terminal. +// Use it in place of fmt.Printf (which it calls internally) +func xdebug2f(pattern string, args ...interface{}) { + var delim string + if len(pattern) > 0 && pattern[len(pattern)-1] != '\n' { + delim = "\n" + } + fmt.Printf("\033[1;34m"+pattern+delim+"\033[0m", args...) +} + // func isImmutableKind(k reflect.Kind) (v bool) { // return false || // k == reflect.Int || @@ -2679,7 +2673,7 @@ func xdebugf(pattern string, args ...interface{}) { // return "UTC" // } // var tzname = []byte("UTC+00:00") -// //tzname := fmt.Sprintf("UTC%s%02d:%02d", tzsign, tz/60, tz%60) //perf issue using Sprintf. inline below. +// //tzname := fmt.Sprintf("UTC%s%02d:%02d", tzsign, tz/60, tz%60) //perf issue using Sprintf.. inline below. // //tzhr, tzmin := tz/60, tz%60 //faster if u convert to int first // var tzhr, tzmin int16 // if tzint < 0 { diff --git a/backend/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go b/backend/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go index 74987f9f..886eaa34 100644 --- a/backend/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go +++ b/backend/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go @@ -182,11 +182,7 @@ func (d *Decoder) kTime(f *codecFnInfo, rv reflect.Value) { } func (d *Decoder) kFloat32(f *codecFnInfo, rv reflect.Value) { - fv := d.d.DecodeFloat64() - if chkOvf.Float32(fv) { - d.errorf("float32 overflow: %v", fv) - } - rv.SetFloat(fv) + rv.SetFloat(d.decodeFloat32()) } func (d *Decoder) kFloat64(f *codecFnInfo, rv reflect.Value) { diff --git a/backend/vendor/github.com/ugorji/go/codec/helper_unsafe.go b/backend/vendor/github.com/ugorji/go/codec/helper_unsafe.go index 3bc34d90..3f2d71e9 100644 --- a/backend/vendor/github.com/ugorji/go/codec/helper_unsafe.go +++ b/backend/vendor/github.com/ugorji/go/codec/helper_unsafe.go @@ -186,7 +186,7 @@ func isEmptyValue(v reflect.Value, tinfos *TypeInfos, deref, checkStruct bool) b // ---------------------- type atomicTypeInfoSlice struct { v unsafe.Pointer // *[]rtid2ti - _ uintptr // padding (atomicXXX expected to be 2 words) + _ uint64 // padding (atomicXXX expected to be 2 words) } func (x *atomicTypeInfoSlice) load() (s []rtid2ti) { @@ -204,7 +204,7 @@ func (x *atomicTypeInfoSlice) store(p []rtid2ti) { // -------------------------- type atomicRtidFnSlice struct { v unsafe.Pointer // *[]codecRtidFn - _ uintptr // padding (atomicXXX expected to be 2 words) + // _ uint64 // padding (atomicXXX expected to be 2 words) (make 1 word so JsonHandle fits) } func (x *atomicRtidFnSlice) load() (s []codecRtidFn) { @@ -222,7 +222,7 @@ func (x *atomicRtidFnSlice) store(p []codecRtidFn) { // -------------------------- type atomicClsErr struct { v unsafe.Pointer // *clsErr - _ uintptr // padding (atomicXXX expected to be 2 words) + _ uint64 // padding (atomicXXX expected to be 2 words) } func (x *atomicClsErr) load() (e clsErr) { @@ -326,12 +326,8 @@ func (d *Decoder) kTime(f *codecFnInfo, rv reflect.Value) { } func (d *Decoder) kFloat32(f *codecFnInfo, rv reflect.Value) { - fv := d.d.DecodeFloat64() - if chkOvf.Float32(fv) { - d.errorf("float32 overflow: %v", fv) - } urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*float32)(urv.ptr) = float32(fv) + *(*float32)(urv.ptr) = float32(d.decodeFloat32()) } func (d *Decoder) kFloat64(f *codecFnInfo, rv reflect.Value) { diff --git a/backend/vendor/github.com/ugorji/go/codec/json.go b/backend/vendor/github.com/ugorji/go/codec/json.go index 619bc5b5..7592b6e0 100644 --- a/backend/vendor/github.com/ugorji/go/codec/json.go +++ b/backend/vendor/github.com/ugorji/go/codec/json.go @@ -61,7 +61,7 @@ const ( jsonU4Chk1 = 'a' - 10 jsonU4Chk0 = 'A' - 10 - jsonScratchArrayLen = 64 + jsonScratchArrayLen = cacheLineSize // 64 ) const ( @@ -121,58 +121,39 @@ func init() { // ---------------- type jsonEncDriverTypical struct { - w *encWriterSwitch - b *[jsonScratchArrayLen]byte - tw bool // term white space - c containerState -} - -func (e *jsonEncDriverTypical) typical() {} - -func (e *jsonEncDriverTypical) reset(ee *jsonEncDriver) { - e.w = ee.ew - e.b = &ee.b - e.tw = ee.h.TermWhitespace - e.c = 0 + jsonEncDriver } func (e *jsonEncDriverTypical) WriteArrayStart(length int) { e.w.writen1('[') - e.c = containerArrayStart } func (e *jsonEncDriverTypical) WriteArrayElem() { - if e.c != containerArrayStart { + if e.e.c != containerArrayStart { e.w.writen1(',') } - e.c = containerArrayElem } func (e *jsonEncDriverTypical) WriteArrayEnd() { e.w.writen1(']') - e.c = containerArrayEnd } func (e *jsonEncDriverTypical) WriteMapStart(length int) { e.w.writen1('{') - e.c = containerMapStart } func (e *jsonEncDriverTypical) WriteMapElemKey() { - if e.c != containerMapStart { + if e.e.c != containerMapStart { e.w.writen1(',') } - e.c = containerMapKey } func (e *jsonEncDriverTypical) WriteMapElemValue() { e.w.writen1(':') - e.c = containerMapValue } func (e *jsonEncDriverTypical) WriteMapEnd() { e.w.writen1('}') - e.c = containerMapEnd } func (e *jsonEncDriverTypical) EncodeBool(b bool) { @@ -183,11 +164,6 @@ func (e *jsonEncDriverTypical) EncodeBool(b bool) { } } -func (e *jsonEncDriverTypical) EncodeFloat64(f float64) { - fmt, prec := jsonFloatStrconvFmtPrec(f) - e.w.writeb(strconv.AppendFloat(e.b[:0], f, fmt, prec, 64)) -} - func (e *jsonEncDriverTypical) EncodeInt(v int64) { e.w.writeb(strconv.AppendInt(e.b[:0], v, 10)) } @@ -196,31 +172,32 @@ func (e *jsonEncDriverTypical) EncodeUint(v uint64) { e.w.writeb(strconv.AppendUint(e.b[:0], v, 10)) } -func (e *jsonEncDriverTypical) EncodeFloat32(f float32) { - e.EncodeFloat64(float64(f)) +func (e *jsonEncDriverTypical) EncodeFloat64(f float64) { + fmt, prec := jsonFloatStrconvFmtPrec64(f) + e.w.writeb(strconv.AppendFloat(e.b[:0], f, fmt, int(prec), 64)) + // e.w.writeb(strconv.AppendFloat(e.b[:0], f, jsonFloatStrconvFmtPrec64(f), 64)) } -func (e *jsonEncDriverTypical) atEndOfEncode() { - if e.tw { - e.w.writen1(' ') - } +func (e *jsonEncDriverTypical) EncodeFloat32(f float32) { + fmt, prec := jsonFloatStrconvFmtPrec32(f) + e.w.writeb(strconv.AppendFloat(e.b[:0], float64(f), fmt, int(prec), 32)) } +// func (e *jsonEncDriverTypical) encodeFloat(f float64, bitsize uint8) { +// fmt, prec := jsonFloatStrconvFmtPrec(f, bitsize == 32) +// e.w.writeb(strconv.AppendFloat(e.b[:0], f, fmt, prec, int(bitsize))) +// } + +// func (e *jsonEncDriverTypical) atEndOfEncode() { +// if e.tw { +// e.w.writen1(' ') +// } +// } + // ---------------- type jsonEncDriverGeneric struct { - w *encWriterSwitch - b *[jsonScratchArrayLen]byte - c containerState - // ds string // indent string - di int8 // indent per - d bool // indenting? - dt bool // indent using tabs - dl uint16 // indent level - ks bool // map key as string - is byte // integer as string - tw bool // term white space - _ [7]byte // padding + jsonEncDriver } // indent is done as below: @@ -228,23 +205,23 @@ type jsonEncDriverGeneric struct { // - newline and indent are added before each ending, // except there was no entry (so we can have {} or []) -func (e *jsonEncDriverGeneric) reset(ee *jsonEncDriver) { - e.w = ee.ew - e.b = &ee.b - e.tw = ee.h.TermWhitespace - e.c = 0 - e.d, e.dt, e.dl, e.di = false, false, 0, 0 - h := ee.h - if h.Indent > 0 { +func (e *jsonEncDriverGeneric) reset() { + e.jsonEncDriver.reset() + e.d, e.dl, e.di = false, 0, 0 + if e.h.Indent != 0 { e.d = true - e.di = int8(h.Indent) - } else if h.Indent < 0 { - e.d = true - e.dt = true - e.di = int8(-h.Indent) + e.di = int8(e.h.Indent) } - e.ks = h.MapKeyAsString - e.is = h.IntegerAsString + // if e.h.Indent > 0 { + // e.d = true + // e.di = int8(e.h.Indent) + // } else if e.h.Indent < 0 { + // e.d = true + // // e.dt = true + // e.di = int8(-e.h.Indent) + // } + e.ks = e.h.MapKeyAsString + e.is = e.h.IntegerAsString } func (e *jsonEncDriverGeneric) WriteArrayStart(length int) { @@ -252,28 +229,14 @@ func (e *jsonEncDriverGeneric) WriteArrayStart(length int) { e.dl++ } e.w.writen1('[') - e.c = containerArrayStart -} - -func (e *jsonEncDriverGeneric) WriteArrayElem() { - if e.c != containerArrayStart { - e.w.writen1(',') - } - if e.d { - e.writeIndent() - } - e.c = containerArrayElem } func (e *jsonEncDriverGeneric) WriteArrayEnd() { if e.d { e.dl-- - if e.c != containerArrayStart { - e.writeIndent() - } + e.writeIndent() } e.w.writen1(']') - e.c = containerArrayEnd } func (e *jsonEncDriverGeneric) WriteMapStart(length int) { @@ -281,59 +244,20 @@ func (e *jsonEncDriverGeneric) WriteMapStart(length int) { e.dl++ } e.w.writen1('{') - e.c = containerMapStart -} - -func (e *jsonEncDriverGeneric) WriteMapElemKey() { - if e.c != containerMapStart { - e.w.writen1(',') - } - if e.d { - e.writeIndent() - } - e.c = containerMapKey -} - -func (e *jsonEncDriverGeneric) WriteMapElemValue() { - if e.d { - e.w.writen2(':', ' ') - } else { - e.w.writen1(':') - } - e.c = containerMapValue } func (e *jsonEncDriverGeneric) WriteMapEnd() { if e.d { e.dl-- - if e.c != containerMapStart { + if e.e.c != containerMapStart { e.writeIndent() } } e.w.writen1('}') - e.c = containerMapEnd -} - -func (e *jsonEncDriverGeneric) writeIndent() { - e.w.writen1('\n') - x := int(e.di) * int(e.dl) - if e.dt { - for x > jsonSpacesOrTabsLen { - e.w.writeb(jsonTabs[:]) - x -= jsonSpacesOrTabsLen - } - e.w.writeb(jsonTabs[:x]) - } else { - for x > jsonSpacesOrTabsLen { - e.w.writeb(jsonSpaces[:]) - x -= jsonSpacesOrTabsLen - } - e.w.writeb(jsonSpaces[:x]) - } } func (e *jsonEncDriverGeneric) EncodeBool(b bool) { - if e.ks && e.c == containerMapKey { + if e.ks && e.e.c == containerMapKey { if b { e.w.writeb(jsonLiterals[jsonLitTrueQ : jsonLitTrueQ+6]) } else { @@ -348,24 +272,31 @@ func (e *jsonEncDriverGeneric) EncodeBool(b bool) { } } -func (e *jsonEncDriverGeneric) EncodeFloat64(f float64) { - // instead of using 'g', specify whether to use 'e' or 'f' - fmt, prec := jsonFloatStrconvFmtPrec(f) - +func (e *jsonEncDriverGeneric) encodeFloat(f float64, bitsize, fmt byte, prec int8) { var blen int - if e.ks && e.c == containerMapKey { - blen = 2 + len(strconv.AppendFloat(e.b[1:1], f, fmt, prec, 64)) + if e.ks && e.e.c == containerMapKey { + blen = 2 + len(strconv.AppendFloat(e.b[1:1], f, fmt, int(prec), int(bitsize))) e.b[0] = '"' e.b[blen-1] = '"' } else { - blen = len(strconv.AppendFloat(e.b[:0], f, fmt, prec, 64)) + blen = len(strconv.AppendFloat(e.b[:0], f, fmt, int(prec), int(bitsize))) } e.w.writeb(e.b[:blen]) } +func (e *jsonEncDriverGeneric) EncodeFloat64(f float64) { + fmt, prec := jsonFloatStrconvFmtPrec64(f) + e.encodeFloat(f, 64, fmt, prec) +} + +func (e *jsonEncDriverGeneric) EncodeFloat32(f float32) { + fmt, prec := jsonFloatStrconvFmtPrec32(f) + e.encodeFloat(float64(f), 32, fmt, prec) +} + func (e *jsonEncDriverGeneric) EncodeInt(v int64) { x := e.is - if x == 'A' || x == 'L' && (v > 1<<53 || v < -(1<<53)) || (e.ks && e.c == containerMapKey) { + if x == 'A' || x == 'L' && (v > 1<<53 || v < -(1<<53)) || (e.ks && e.e.c == containerMapKey) { blen := 2 + len(strconv.AppendInt(e.b[1:1], v, 10)) e.b[0] = '"' e.b[blen-1] = '"' @@ -377,7 +308,7 @@ func (e *jsonEncDriverGeneric) EncodeInt(v int64) { func (e *jsonEncDriverGeneric) EncodeUint(v uint64) { x := e.is - if x == 'A' || x == 'L' && v > 1<<53 || (e.ks && e.c == containerMapKey) { + if x == 'A' || x == 'L' && v > 1<<53 || (e.ks && e.e.c == containerMapKey) { blen := 2 + len(strconv.AppendUint(e.b[1:1], v, 10)) e.b[0] = '"' e.b[blen-1] = '"' @@ -387,49 +318,110 @@ func (e *jsonEncDriverGeneric) EncodeUint(v uint64) { e.w.writeb(strconv.AppendUint(e.b[:0], v, 10)) } -func (e *jsonEncDriverGeneric) EncodeFloat32(f float32) { - // e.encodeFloat(float64(f), 32) - // always encode all floats as IEEE 64-bit floating point. - // It also ensures that we can decode in full precision even if into a float32, - // as what is written is always to float64 precision. - e.EncodeFloat64(float64(f)) -} +// func (e *jsonEncDriverGeneric) EncodeFloat32(f float32) { +// // e.encodeFloat(float64(f), 32) +// // always encode all floats as IEEE 64-bit floating point. +// // It also ensures that we can decode in full precision even if into a float32, +// // as what is written is always to float64 precision. +// e.EncodeFloat64(float64(f)) +// } -func (e *jsonEncDriverGeneric) atEndOfEncode() { - if e.tw { - if e.d { - e.w.writen1('\n') - } else { - e.w.writen1(' ') - } - } -} +// func (e *jsonEncDriverGeneric) atEndOfEncode() { +// if e.tw { +// if e.d { +// e.w.writen1('\n') +// } else { +// e.w.writen1(' ') +// } +// } +// } // -------------------- type jsonEncDriver struct { noBuiltInTypes - e *Encoder - h *JsonHandle - ew *encWriterSwitch - se extWrapper + w *encWriterSwitch + e *Encoder + h *JsonHandle + + bs []byte // for encoding strings + se interfaceExtWrapper + // ---- cpu cache line boundary? - bs []byte // scratch - // ---- cpu cache line boundary? - b [jsonScratchArrayLen]byte // scratch (encode time, - _ [2]uint64 // padding + // ds string // indent string + di int8 // indent per: if negative, use tabs + d bool // indenting? + // dt bool // indent using tabs + dl uint16 // indent level + ks bool // map key as string + is byte // integer as string + + s *bitset256 // safe set for characters (taking h.HTMLAsIs into consideration) + // scratch: encode time, numbers, etc. Note: leave 1 byte for containerState + b [jsonScratchArrayLen - 16]byte // leave space for bs(len,cap), containerState +} + +// Keep writeIndent, WriteArrayElem, WriteMapElemKey, WriteMapElemValue +// in jsonEncDriver, so that *Encoder can directly call them + +func (e *jsonEncDriver) getJsonEncDriver() *jsonEncDriver { return e } + +func (e *jsonEncDriver) writeIndent() { + e.w.writen1('\n') + x := int(e.di) * int(e.dl) + if e.di < 0 { + x = -x + for x > jsonSpacesOrTabsLen { + e.w.writeb(jsonTabs[:]) + x -= jsonSpacesOrTabsLen + } + e.w.writeb(jsonTabs[:x]) + } else { + for x > jsonSpacesOrTabsLen { + e.w.writeb(jsonSpaces[:]) + x -= jsonSpacesOrTabsLen + } + e.w.writeb(jsonSpaces[:x]) + } +} + +func (e *jsonEncDriver) WriteArrayElem() { + // xdebugf("WriteArrayElem: e.e.c: %d", e.e.c) + if e.e.c != containerArrayStart { + e.w.writen1(',') + } + if e.d { + e.writeIndent() + } +} + +func (e *jsonEncDriver) WriteMapElemKey() { + if e.e.c != containerMapStart { + e.w.writen1(',') + } + if e.d { + e.writeIndent() + } +} + +func (e *jsonEncDriver) WriteMapElemValue() { + if e.d { + e.w.writen2(':', ' ') + } else { + e.w.writen1(':') + } } func (e *jsonEncDriver) EncodeNil() { // We always encode nil as just null (never in quotes) // This allows us to easily decode if a nil in the json stream // ie if initial token is n. - e.ew.writeb(jsonLiterals[jsonLitNull : jsonLitNull+4]) + e.w.writeb(jsonLiterals[jsonLitNull : jsonLitNull+4]) - // if e.h.MapKeyAsString && e.c == containerMapKey { - // e.ew.writeb(jsonLiterals[jsonLitNullQ : jsonLitNullQ+6]) + // if e.h.MapKeyAsString && e.e.c == containerMapKey { + // e.w.writeb(jsonLiterals[jsonLitNullQ : jsonLitNullQ+6]) // } else { - // e.ew.writeb(jsonLiterals[jsonLitNull : jsonLitNull+4]) + // e.w.writeb(jsonLiterals[jsonLitNull : jsonLitNull+4]) // } } @@ -442,9 +434,9 @@ func (e *jsonEncDriver) EncodeTime(t time.Time) { e.b[0] = '"' b := t.AppendFormat(e.b[1:1], time.RFC3339Nano) e.b[len(b)+1] = '"' - e.ew.writeb(e.b[:len(b)+2]) + e.w.writeb(e.b[:len(b)+2]) } - // v, err := t.MarshalJSON(); if err != nil { e.e.error(err) } e.ew.writeb(v) + // v, err := t.MarshalJSON(); if err != nil { e.e.error(err) } e.w.writeb(v) } func (e *jsonEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Encoder) { @@ -464,41 +456,10 @@ func (e *jsonEncDriver) EncodeRawExt(re *RawExt, en *Encoder) { } } -func (e *jsonEncDriver) EncodeString(c charEncoding, v string) { - e.quoteStr(v) -} - func (e *jsonEncDriver) EncodeStringEnc(c charEncoding, v string) { e.quoteStr(v) } -func (e *jsonEncDriver) EncodeStringBytes(c charEncoding, v []byte) { - // if encoding raw bytes and RawBytesExt is configured, use it to encode - if v == nil { - e.EncodeNil() - return - } - if c == cRAW { - if e.se.InterfaceExt != nil { - e.EncodeExt(v, 0, &e.se, e.e) - return - } - - slen := base64.StdEncoding.EncodedLen(len(v)) + 2 - if cap(e.bs) >= slen { - e.bs = e.bs[:slen] - } else { - e.bs = make([]byte, slen) - } - e.bs[0] = '"' - base64.StdEncoding.Encode(e.bs[1:], v) - e.bs[slen-1] = '"' - e.ew.writeb(e.bs) - } else { - e.quoteStr(stringView(v)) - } -} - func (e *jsonEncDriver) EncodeStringBytesRaw(v []byte) { // if encoding raw bytes and RawBytesExt is configured, use it to encode if v == nil { @@ -519,30 +480,33 @@ func (e *jsonEncDriver) EncodeStringBytesRaw(v []byte) { e.bs[0] = '"' base64.StdEncoding.Encode(e.bs[1:], v) e.bs[slen-1] = '"' - e.ew.writeb(e.bs) + e.w.writeb(e.bs) } func (e *jsonEncDriver) EncodeAsis(v []byte) { - e.ew.writeb(v) + e.w.writeb(v) } func (e *jsonEncDriver) quoteStr(s string) { // adapted from std pkg encoding/json const hex = "0123456789abcdef" - w := e.ew - htmlasis := e.h.HTMLCharsAsIs + w := e.w w.writen1('"') var start int - for i, slen := 0, len(s); i < slen; { + for i := 0; i < len(s); { // encode all bytes < 0x20 (except \r, \n). // also encode < > & to prevent security holes when served to some browsers. + + // We optimize for ascii, by assumining that most characters are in the BMP + // and natively consumed by json without much computation. + + // if 0x20 <= b && b != '\\' && b != '"' && b != '<' && b != '>' && b != '&' { + // if (htmlasis && jsonCharSafeSet.isset(b)) || jsonCharHtmlSafeSet.isset(b) { + if e.s.isset(s[i]) { + i++ + continue + } if b := s[i]; b < utf8.RuneSelf { - // if 0x20 <= b && b != '\\' && b != '"' && b != '<' && b != '>' && b != '&' { - // if (htmlasis && jsonCharSafeSet.isset(b)) || jsonCharHtmlSafeSet.isset(b) { - if jsonCharHtmlSafeSet.isset(b) || (htmlasis && jsonCharSafeSet.isset(b)) { - i++ - continue - } if start < i { w.writestr(s[start:i]) } @@ -568,13 +532,15 @@ func (e *jsonEncDriver) quoteStr(s string) { continue } c, size := utf8.DecodeRuneInString(s[i:]) - if c == utf8.RuneError && size == 1 { - if start < i { - w.writestr(s[start:i]) + if c == utf8.RuneError { + if size == 1 { + if start < i { + w.writestr(s[start:i]) + } + w.writestr(`\ufffd`) + i++ + start = i } - w.writestr(`\ufffd`) - i += size - start = i continue } // U+2028 is LINE SEPARATOR. U+2029 is PARAGRAPH SEPARATOR. @@ -597,24 +563,41 @@ func (e *jsonEncDriver) quoteStr(s string) { w.writen1('"') } +func (e *jsonEncDriver) atEndOfEncode() { + // if e.e.c == 0 { // scalar written, output space + // e.w.writen1(' ') + // } else if e.h.TermWhitespace { // container written, output new-line + // e.w.writen1('\n') + // } + if e.h.TermWhitespace { + if e.e.c == 0 { // scalar written, output space + e.w.writen1(' ') + } else { // container written, output new-line + e.w.writen1('\n') + } + } + +} + type jsonDecDriver struct { noBuiltInTypes d *Decoder h *JsonHandle r *decReaderSwitch - se extWrapper + se interfaceExtWrapper + bs []byte // scratch, initialized from b. For parsing strings or numbers. // ---- writable fields during execution --- *try* to keep in sep cache line - c containerState - // tok is used to store the token read right after skipWhiteSpace. - tok uint8 - fnull bool // found null from appendStringAsBytes - bs []byte // scratch. Initialized from b. Used for parsing strings or numbers. - bstr [8]byte // scratch used for string \UXXX parsing // ---- cpu cache line boundary? - b [jsonScratchArrayLen]byte // scratch 1, used for parsing strings or numbers or time.Time - b2 [jsonScratchArrayLen]byte // scratch 2, used only for readUntil, decNumBytes + b [jsonScratchArrayLen]byte // scratch 1, used for parsing strings or numbers or time.Time + // ---- cpu cache line boundary? + // c containerState + tok uint8 // used to store the token read right after skipWhiteSpace + fnull bool // found null from appendStringAsBytes + _ [2]byte // padding + bstr [4]byte // scratch used for string \UXXX parsing + b2 [jsonScratchArrayLen - 8]byte // scratch 2, used only for readUntil, decNumBytes // _ [3]uint64 // padding // n jsonNum @@ -641,7 +624,6 @@ func (d *jsonDecDriver) ReadMapStart() int { d.d.errorf("read map - expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 - d.c = containerMapStart return -1 } @@ -654,7 +636,6 @@ func (d *jsonDecDriver) ReadArrayStart() int { d.d.errorf("read array - expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 - d.c = containerArrayStart return -1 } @@ -668,7 +649,7 @@ func (d *jsonDecDriver) CheckBreak() bool { // For the ReadXXX methods below, we could just delegate to helper functions // readContainerState(c containerState, xc uint8, check bool) // - ReadArrayElem would become: -// readContainerState(containerArrayElem, ',', d.c != containerArrayStart) +// readContainerState(containerArrayElem, ',', d.d.c != containerArrayStart) // // However, until mid-stack inlining comes in go1.11 which supports inlining of // one-liners, we explicitly write them all 5 out to elide the extra func call. @@ -680,13 +661,13 @@ func (d *jsonDecDriver) ReadArrayElem() { if d.tok == 0 { d.tok = d.r.skip(&jsonCharWhitespaceSet) } - if d.c != containerArrayStart { + // xdebugf("ReadArrayElem: d.d.c: %d, token: %c", d.d.c, d.tok) + if d.d.c != containerArrayStart { if d.tok != xc { d.d.errorf("read array element - expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 } - d.c = containerArrayElem } func (d *jsonDecDriver) ReadArrayEnd() { @@ -698,7 +679,6 @@ func (d *jsonDecDriver) ReadArrayEnd() { d.d.errorf("read array end - expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 - d.c = containerArrayEnd } func (d *jsonDecDriver) ReadMapElemKey() { @@ -706,13 +686,12 @@ func (d *jsonDecDriver) ReadMapElemKey() { if d.tok == 0 { d.tok = d.r.skip(&jsonCharWhitespaceSet) } - if d.c != containerMapStart { + if d.d.c != containerMapStart { if d.tok != xc { d.d.errorf("read map key - expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 } - d.c = containerMapKey } func (d *jsonDecDriver) ReadMapElemValue() { @@ -724,7 +703,6 @@ func (d *jsonDecDriver) ReadMapElemValue() { d.d.errorf("read map value - expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 - d.c = containerMapValue } func (d *jsonDecDriver) ReadMapEnd() { @@ -736,7 +714,6 @@ func (d *jsonDecDriver) ReadMapEnd() { d.d.errorf("read map end - expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 - d.c = containerMapEnd } // func (d *jsonDecDriver) readLit(length, fromIdx uint8) { @@ -789,7 +766,7 @@ func (d *jsonDecDriver) DecodeBool() (v bool) { if d.tok == 0 { d.tok = d.r.skip(&jsonCharWhitespaceSet) } - fquot := d.c == containerMapKey && d.tok == '"' + fquot := d.d.c == containerMapKey && d.tok == '"' if fquot { d.tok = d.r.readn1() } @@ -929,18 +906,26 @@ func (d *jsonDecDriver) decUint64ViaFloat(s string) (u uint64) { return uint64(fi) } -func (d *jsonDecDriver) DecodeFloat64() (f float64) { +func (d *jsonDecDriver) decodeFloat(bitsize int) (f float64) { bs := d.decNumBytes() if len(bs) == 0 { return } - f, err := strconv.ParseFloat(stringView(bs), 64) + f, err := strconv.ParseFloat(stringView(bs), bitsize) if err != nil { d.d.errorv(err) } return } +func (d *jsonDecDriver) DecodeFloat64() (f float64) { + return d.decodeFloat(64) +} + +func (d *jsonDecDriver) DecodeFloat32() (f float64) { + return d.decodeFloat(32) +} + func (d *jsonDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) { if ext == nil { re := rv.(*RawExt) @@ -1204,7 +1189,7 @@ F: func (d *jsonDecDriver) bsToString() string { // if x := d.s.sc; x != nil && x.so && x.st == '}' { // map key - if jsonAlwaysReturnInternString || d.c == containerMapKey { + if jsonAlwaysReturnInternString || d.d.c == containerMapKey { return d.d.string(d.bs) } return string(d.bs) @@ -1236,7 +1221,7 @@ func (d *jsonDecDriver) DecodeNaked() { case '"': // if a string, and MapKeyAsString, then try to decode it as a nil, bool or number first d.appendStringAsBytes() - if len(d.bs) > 0 && d.c == containerMapKey && d.h.MapKeyAsString { + if len(d.bs) > 0 && d.d.c == containerMapKey && d.h.MapKeyAsString { switch stringView(d.bs) { case "null": z.v = valueTypeNil @@ -1342,15 +1327,16 @@ type JsonHandle struct { // The only caveat is that nil value is ALWAYS written as null (never as "null") MapKeyAsString bool - // _ [2]byte // padding + // _ uint64 // padding (cache line) - // Note: below, we store hardly-used items e.g. RawBytesExt is cached in the (en|de)cDriver. + // Note: below, we store hardly-used items + // e.g. RawBytesExt (which is already cached in the (en|de)cDriver). // RawBytesExt, if configured, is used to encode and decode raw bytes in a custom way. // If not configured, raw bytes are encoded to/from base64 text. RawBytesExt InterfaceExt - _ [2]uint64 // padding + // _ [2]uint64 // padding } // Name returns the name of the handle: json @@ -1360,55 +1346,28 @@ func (h *JsonHandle) typical() bool { return h.Indent == 0 && !h.MapKeyAsString && h.IntegerAsString != 'A' && h.IntegerAsString != 'L' } -type jsonTypical interface { - typical() -} - func (h *JsonHandle) recreateEncDriver(ed encDriver) (v bool) { - _, v = ed.(jsonTypical) + _, v = ed.(*jsonEncDriverTypical) return v != h.typical() } // SetInterfaceExt sets an extension func (h *JsonHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) { - return h.SetExt(rt, tag, &extWrapper{bytesExtFailer{}, ext}) -} - -type jsonEncDriverTypicalImpl struct { - jsonEncDriver - jsonEncDriverTypical - _ [1]uint64 // padding -} - -func (x *jsonEncDriverTypicalImpl) reset() { - x.jsonEncDriver.reset() - x.jsonEncDriverTypical.reset(&x.jsonEncDriver) -} - -type jsonEncDriverGenericImpl struct { - jsonEncDriver - jsonEncDriverGeneric - // _ [2]uint64 // padding -} - -func (x *jsonEncDriverGenericImpl) reset() { - x.jsonEncDriver.reset() - x.jsonEncDriverGeneric.reset(&x.jsonEncDriver) + return h.SetExt(rt, tag, &interfaceExtWrapper{InterfaceExt: ext}) } func (h *JsonHandle) newEncDriver(e *Encoder) (ee encDriver) { var hd *jsonEncDriver if h.typical() { - var v jsonEncDriverTypicalImpl + var v jsonEncDriverTypical ee = &v hd = &v.jsonEncDriver } else { - var v jsonEncDriverGenericImpl + var v jsonEncDriverGeneric ee = &v hd = &v.jsonEncDriver } hd.e, hd.h, hd.bs = e, h, hd.b[:0] - hd.se.BytesExt = bytesExtFailer{} ee.reset() return } @@ -1416,47 +1375,82 @@ func (h *JsonHandle) newEncDriver(e *Encoder) (ee encDriver) { func (h *JsonHandle) newDecDriver(d *Decoder) decDriver { // d := jsonDecDriver{r: r.(*bytesDecReader), h: h} hd := jsonDecDriver{d: d, h: h} - hd.se.BytesExt = bytesExtFailer{} hd.bs = hd.b[:0] hd.reset() return &hd } func (e *jsonEncDriver) reset() { - e.ew = e.e.w + e.w = e.e.w() + // (htmlasis && jsonCharSafeSet.isset(b)) || jsonCharHtmlSafeSet.isset(b) + if e.h.HTMLCharsAsIs { + e.s = &jsonCharSafeSet + } else { + e.s = &jsonCharHtmlSafeSet + } e.se.InterfaceExt = e.h.RawBytesExt - if e.bs != nil { + if e.bs == nil { + e.bs = e.b[:0] + } else { e.bs = e.bs[:0] } } func (d *jsonDecDriver) reset() { - d.r = d.d.r + d.r = d.d.r() d.se.InterfaceExt = d.h.RawBytesExt if d.bs != nil { d.bs = d.bs[:0] } - d.c, d.tok = 0, 0 + d.tok = 0 // d.n.reset() } -func jsonFloatStrconvFmtPrec(f float64) (fmt byte, prec int) { +// jsonFloatStrconvFmtPrec ... +// +// ensure that every float has an 'e' or '.' in it,/ for easy differentiation from integers. +// this is better/faster than checking if encoded value has [e.] and appending if needed. + +// func jsonFloatStrconvFmtPrec(f float64, bits32 bool) (fmt byte, prec int) { +// fmt = 'f' +// prec = -1 +// var abs = math.Abs(f) +// if abs == 0 || abs == 1 { +// prec = 1 +// } else if !bits32 && (abs < 1e-6 || abs >= 1e21) || +// bits32 && (float32(abs) < 1e-6 || float32(abs) >= 1e21) { +// fmt = 'e' +// } else if _, frac := math.Modf(abs); frac == 0 { +// // ensure that floats have a .0 at the end, for easy identification as floats +// prec = 1 +// } +// return +// } + +func jsonFloatStrconvFmtPrec64(f float64) (fmt byte, prec int8) { + fmt = 'f' prec = -1 var abs = math.Abs(f) - if abs != 0 && (abs < 1e-6 || abs >= 1e21) { + if abs == 0 || abs == 1 { + prec = 1 + } else if abs < 1e-6 || abs >= 1e21 { fmt = 'e' - } else { - fmt = 'f' - // set prec to 1 iff mod is 0. - // better than using jsonIsFloatBytesB2 to check if a . or E in the float bytes. - // this ensures that every float has an e or .0 in it. - if abs <= 1 { - if abs == 0 || abs == 1 { - prec = 1 - } - } else if _, mod := math.Modf(abs); mod == 0 { - prec = 1 - } + } else if noFrac64(abs) { // _, frac := math.Modf(abs); frac == 0 { + prec = 1 + } + return +} + +func jsonFloatStrconvFmtPrec32(f float32) (fmt byte, prec int8) { + fmt = 'f' + prec = -1 + var abs = abs32(f) + if abs == 0 || abs == 1 { + prec = 1 + } else if abs < 1e-6 || abs >= 1e21 { + fmt = 'e' + } else if noFrac32(abs) { // _, frac := math.Modf(abs); frac == 0 { + prec = 1 } return } @@ -1502,7 +1496,13 @@ func jsonParseInteger(s []byte) (n uint64, neg, badSyntax, overflow bool) { return } +var _ decDriverContainerTracker = (*jsonDecDriver)(nil) +var _ encDriverContainerTracker = (*jsonEncDriver)(nil) var _ decDriver = (*jsonDecDriver)(nil) -var _ encDriver = (*jsonEncDriverGenericImpl)(nil) -var _ encDriver = (*jsonEncDriverTypicalImpl)(nil) -var _ jsonTypical = (*jsonEncDriverTypical)(nil) +var _ encDriver = (*jsonEncDriverGeneric)(nil) +var _ encDriver = (*jsonEncDriverTypical)(nil) +var _ (interface{ getJsonEncDriver() *jsonEncDriver }) = (*jsonEncDriverTypical)(nil) +var _ (interface{ getJsonEncDriver() *jsonEncDriver }) = (*jsonEncDriverGeneric)(nil) +var _ (interface{ getJsonEncDriver() *jsonEncDriver }) = (*jsonEncDriver)(nil) + +// var _ encDriver = (*jsonEncDriver)(nil) diff --git a/backend/vendor/github.com/ugorji/go/codec/msgpack.go b/backend/vendor/github.com/ugorji/go/codec/msgpack.go index 85c71f22..e07bdcbf 100644 --- a/backend/vendor/github.com/ugorji/go/codec/msgpack.go +++ b/backend/vendor/github.com/ugorji/go/codec/msgpack.go @@ -370,39 +370,15 @@ func (e *msgpackEncDriver) WriteMapStart(length int) { e.writeContainerLen(msgpackContainerMap, length) } -func (e *msgpackEncDriver) EncodeString(c charEncoding, s string) { - slen := len(s) - if c == cRAW && e.h.WriteExt { - e.writeContainerLen(msgpackContainerBin, slen) - } else { - e.writeContainerLen(msgpackContainerRawLegacy, slen) - } - if slen > 0 { - e.w.writestr(s) - } -} - func (e *msgpackEncDriver) EncodeStringEnc(c charEncoding, s string) { slen := len(s) - e.writeContainerLen(msgpackContainerStr, slen) - if slen > 0 { - e.w.writestr(s) - } -} - -func (e *msgpackEncDriver) EncodeStringBytes(c charEncoding, bs []byte) { - if bs == nil { - e.EncodeNil() - return - } - slen := len(bs) - if c == cRAW && e.h.WriteExt { - e.writeContainerLen(msgpackContainerBin, slen) + if e.h.WriteExt { + e.writeContainerLen(msgpackContainerStr, slen) } else { e.writeContainerLen(msgpackContainerRawLegacy, slen) } if slen > 0 { - e.w.writeb(bs) + e.w.writestr(s) } } @@ -521,7 +497,7 @@ func (d *msgpackDecDriver) DecodeNaked() { n.v = valueTypeInt n.i = int64(int8(bd)) case bd == mpStr8, bd == mpStr16, bd == mpStr32, bd >= mpFixStrMin && bd <= mpFixStrMax: - if d.h.WriteExt { + if d.h.WriteExt || d.h.RawToString { n.v = valueTypeString n.s = d.DecodeString() } else { @@ -701,9 +677,11 @@ func (d *msgpackDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) return } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { clen = d.readContainerLen(msgpackContainerBin) // binary - } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax) { + } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || + (bd >= mpFixStrMin && bd <= mpFixStrMax) { clen = d.readContainerLen(msgpackContainerStr) // string/raw - } else if bd == mpArray16 || bd == mpArray32 || (bd >= mpFixArrayMin && bd <= mpFixArrayMax) { + } else if bd == mpArray16 || bd == mpArray32 || + (bd >= mpFixArrayMin && bd <= mpFixArrayMax) { // check if an "array" of uint8's if zerocopy && len(bs) == 0 { bs = d.d.b[:] @@ -755,9 +733,11 @@ func (d *msgpackDecDriver) ContainerType() (vt valueType) { // // nil // } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { // // binary - // } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax) { + // } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || + // (bd >= mpFixStrMin && bd <= mpFixStrMax) { // // string/raw - // } else if bd == mpArray16 || bd == mpArray32 || (bd >= mpFixArrayMin && bd <= mpFixArrayMax) { + // } else if bd == mpArray16 || bd == mpArray32 || + // (bd >= mpFixArrayMin && bd <= mpFixArrayMax) { // // array // } else if bd == mpMap16 || bd == mpMap32 || (bd >= mpFixMapMin && bd <= mpFixMapMax) { // // map @@ -766,8 +746,9 @@ func (d *msgpackDecDriver) ContainerType() (vt valueType) { return valueTypeNil } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { return valueTypeBytes - } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax) { - if d.h.WriteExt { // UTF-8 string (new spec) + } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || + (bd >= mpFixStrMin && bd <= mpFixStrMax) { + if d.h.WriteExt || d.h.RawToString { // UTF-8 string (new spec) return valueTypeString } return valueTypeBytes // raw (old spec) @@ -866,7 +847,8 @@ func (d *msgpackDecDriver) DecodeTime() (t time.Time) { return } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { clen = d.readContainerLen(msgpackContainerBin) // binary - } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax) { + } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || + (bd >= mpFixStrMin && bd <= mpFixStrMax) { clen = d.readContainerLen(msgpackContainerStr) // string/raw } else { // expect to see mpFixExt4,-1 OR mpFixExt8,-1 OR mpExt8,12,-1 @@ -979,7 +961,7 @@ type MsgpackHandle struct { binaryEncodingType noElemSeparators - // _ [1]uint64 // padding + _ [1]uint64 // padding (cache-aligned) } // Name returns the name of the handle: msgpack @@ -987,23 +969,23 @@ func (h *MsgpackHandle) Name() string { return "msgpack" } // SetBytesExt sets an extension func (h *MsgpackHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) { - return h.SetExt(rt, tag, &extWrapper{ext, interfaceExtFailer{}}) + return h.SetExt(rt, tag, &bytesExtWrapper{BytesExt: ext}) } func (h *MsgpackHandle) newEncDriver(e *Encoder) encDriver { - return &msgpackEncDriver{e: e, w: e.w, h: h} + return &msgpackEncDriver{e: e, w: e.w(), h: h} } func (h *MsgpackHandle) newDecDriver(d *Decoder) decDriver { - return &msgpackDecDriver{d: d, h: h, r: d.r, br: d.bytes} + return &msgpackDecDriver{d: d, h: h, r: d.r(), br: d.bytes} } func (e *msgpackEncDriver) reset() { - e.w = e.e.w + e.w = e.e.w() } func (d *msgpackDecDriver) reset() { - d.r, d.br = d.d.r, d.d.bytes + d.r, d.br = d.d.r(), d.d.bytes d.bd, d.bdRead = 0, false } diff --git a/backend/vendor/github.com/ugorji/go/codec/simple.go b/backend/vendor/github.com/ugorji/go/codec/simple.go index a3257c1a..ee9755b3 100644 --- a/backend/vendor/github.com/ugorji/go/codec/simple.go +++ b/backend/vendor/github.com/ugorji/go/codec/simple.go @@ -33,15 +33,15 @@ const ( type simpleEncDriver struct { noBuiltInTypes + encDriverNoopContainerWriter // encNoSeparator e *Encoder h *SimpleHandle w *encWriterSwitch b [8]byte // c containerState - encDriverTrackContainerWriter - // encDriverNoopContainerWriter - _ [3]uint64 // padding + // encDriverTrackContainerWriter + _ [2]uint64 // padding (cache-aligned) } func (e *simpleEncDriver) EncodeNil() { @@ -49,7 +49,7 @@ func (e *simpleEncDriver) EncodeNil() { } func (e *simpleEncDriver) EncodeBool(b bool) { - if e.h.EncZeroValuesAsNil && e.c != containerMapKey && !b { + if e.h.EncZeroValuesAsNil && e.e.c != containerMapKey && !b { e.EncodeNil() return } @@ -61,7 +61,7 @@ func (e *simpleEncDriver) EncodeBool(b bool) { } func (e *simpleEncDriver) EncodeFloat32(f float32) { - if e.h.EncZeroValuesAsNil && e.c != containerMapKey && f == 0.0 { + if e.h.EncZeroValuesAsNil && e.e.c != containerMapKey && f == 0.0 { e.EncodeNil() return } @@ -70,7 +70,7 @@ func (e *simpleEncDriver) EncodeFloat32(f float32) { } func (e *simpleEncDriver) EncodeFloat64(f float64) { - if e.h.EncZeroValuesAsNil && e.c != containerMapKey && f == 0.0 { + if e.h.EncZeroValuesAsNil && e.e.c != containerMapKey && f == 0.0 { e.EncodeNil() return } @@ -91,7 +91,7 @@ func (e *simpleEncDriver) EncodeUint(v uint64) { } func (e *simpleEncDriver) encUint(v uint64, bd uint8) { - if e.h.EncZeroValuesAsNil && e.c != containerMapKey && v == 0 { + if e.h.EncZeroValuesAsNil && e.e.c != containerMapKey && v == 0 { e.EncodeNil() return } @@ -148,12 +148,10 @@ func (e *simpleEncDriver) encodeExtPreamble(xtag byte, length int) { } func (e *simpleEncDriver) WriteArrayStart(length int) { - e.c = containerArrayStart e.encLen(simpleVdArray, length) } func (e *simpleEncDriver) WriteMapStart(length int) { - e.c = containerMapStart e.encLen(simpleVdMap, length) } @@ -162,7 +160,7 @@ func (e *simpleEncDriver) WriteMapStart(length int) { // } func (e *simpleEncDriver) EncodeStringEnc(c charEncoding, v string) { - if false && e.h.EncZeroValuesAsNil && e.c != containerMapKey && v == "" { + if false && e.h.EncZeroValuesAsNil && e.e.c != containerMapKey && v == "" { e.EncodeNil() return } @@ -170,14 +168,6 @@ func (e *simpleEncDriver) EncodeStringEnc(c charEncoding, v string) { e.w.writestr(v) } -func (e *simpleEncDriver) EncodeString(c charEncoding, v string) { - e.EncodeStringEnc(c, v) -} - -func (e *simpleEncDriver) EncodeStringBytes(c charEncoding, v []byte) { - e.EncodeStringBytesRaw(v) -} - func (e *simpleEncDriver) EncodeStringBytesRaw(v []byte) { // if e.h.EncZeroValuesAsNil && e.c != containerMapKey && v == nil { if v == nil { @@ -213,7 +203,7 @@ type simpleDecDriver struct { bdRead bool bd byte br bool // a bytes reader? - c containerState + // c containerState // b [scratchByteArrayLen]byte noBuiltInTypes // noStreamingCodec @@ -370,7 +360,6 @@ func (d *simpleDecDriver) ReadMapStart() (length int) { d.readNextBd() } d.bdRead = false - d.c = containerMapStart return d.decLen() } @@ -379,30 +368,9 @@ func (d *simpleDecDriver) ReadArrayStart() (length int) { d.readNextBd() } d.bdRead = false - d.c = containerArrayStart return d.decLen() } -func (d *simpleDecDriver) ReadArrayElem() { - d.c = containerArrayElem -} - -func (d *simpleDecDriver) ReadArrayEnd() { - d.c = containerArrayEnd -} - -func (d *simpleDecDriver) ReadMapElemKey() { - d.c = containerMapKey -} - -func (d *simpleDecDriver) ReadMapElemValue() { - d.c = containerMapValue -} - -func (d *simpleDecDriver) ReadMapEnd() { - d.c = containerMapEnd -} - func (d *simpleDecDriver) decLen() int { switch d.bd % 8 { case 0: @@ -630,7 +598,7 @@ type SimpleHandle struct { // EncZeroValuesAsNil says to encode zero values for numbers, bool, string, etc as nil EncZeroValuesAsNil bool - // _ [1]uint64 // padding + _ [1]uint64 // padding (cache-aligned) } // Name returns the name of the handle: simple @@ -638,27 +606,25 @@ func (h *SimpleHandle) Name() string { return "simple" } // SetBytesExt sets an extension func (h *SimpleHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) { - return h.SetExt(rt, tag, &extWrapper{ext, interfaceExtFailer{}}) + return h.SetExt(rt, tag, &bytesExtWrapper{BytesExt: ext}) } -func (h *SimpleHandle) hasElemSeparators() bool { return true } // as it implements Write(Map|Array)XXX +// func (h *SimpleHandle) hasElemSeparators() bool { return true } // as it implements Write(Map|Array)XXX func (h *SimpleHandle) newEncDriver(e *Encoder) encDriver { - return &simpleEncDriver{e: e, w: e.w, h: h} + return &simpleEncDriver{e: e, w: e.w(), h: h} } func (h *SimpleHandle) newDecDriver(d *Decoder) decDriver { - return &simpleDecDriver{d: d, h: h, r: d.r, br: d.bytes} + return &simpleDecDriver{d: d, h: h, r: d.r(), br: d.bytes} } func (e *simpleEncDriver) reset() { - e.c = 0 - e.w = e.e.w + e.w = e.e.w() } func (d *simpleDecDriver) reset() { - d.c = 0 - d.r, d.br = d.d.r, d.d.bytes + d.r, d.br = d.d.r(), d.d.bytes d.bd, d.bdRead = 0, false } diff --git a/backend/vendor/golang.org/x/net/html/const.go b/backend/vendor/golang.org/x/net/html/const.go index a3a918f0..73804d34 100644 --- a/backend/vendor/golang.org/x/net/html/const.go +++ b/backend/vendor/golang.org/x/net/html/const.go @@ -52,7 +52,6 @@ var isSpecialElementMap = map[string]bool{ "iframe": true, "img": true, "input": true, - "isindex": true, // The 'isindex' element has been removed, but keep it for backwards compatibility. "keygen": true, "li": true, "link": true, diff --git a/backend/vendor/golang.org/x/net/html/foreign.go b/backend/vendor/golang.org/x/net/html/foreign.go index 01477a96..74774c45 100644 --- a/backend/vendor/golang.org/x/net/html/foreign.go +++ b/backend/vendor/golang.org/x/net/html/foreign.go @@ -172,7 +172,6 @@ var svgAttributeAdjustments = map[string]string{ "diffuseconstant": "diffuseConstant", "edgemode": "edgeMode", "externalresourcesrequired": "externalResourcesRequired", - "filterres": "filterRes", "filterunits": "filterUnits", "glyphref": "glyphRef", "gradienttransform": "gradientTransform", diff --git a/backend/vendor/golang.org/x/net/html/node.go b/backend/vendor/golang.org/x/net/html/node.go index 633ee15d..1350eef2 100644 --- a/backend/vendor/golang.org/x/net/html/node.go +++ b/backend/vendor/golang.org/x/net/html/node.go @@ -18,6 +18,11 @@ const ( ElementNode CommentNode DoctypeNode + // RawNode nodes are not returned by the parser, but can be part of the + // Node tree passed to func Render to insert raw HTML (without escaping). + // If so, this package makes no guarantee that the rendered HTML is secure + // (from e.g. Cross Site Scripting attacks) or well-formed. + RawNode scopeMarkerNode ) diff --git a/backend/vendor/golang.org/x/net/html/parse.go b/backend/vendor/golang.org/x/net/html/parse.go index 992cff2a..2cd12fc8 100644 --- a/backend/vendor/golang.org/x/net/html/parse.go +++ b/backend/vendor/golang.org/x/net/html/parse.go @@ -184,6 +184,17 @@ func (p *parser) clearStackToContext(s scope) { } } +// parseGenericRawTextElements implements the generic raw text element parsing +// algorithm defined in 12.2.6.2. +// https://html.spec.whatwg.org/multipage/parsing.html#parsing-elements-that-contain-only-text +// TODO: Since both RAWTEXT and RCDATA states are treated as tokenizer's part +// officially, need to make tokenizer consider both states. +func (p *parser) parseGenericRawTextElement() { + p.addElement() + p.originalIM = p.im + p.im = textIM +} + // generateImpliedEndTags pops nodes off the stack of open elements as long as // the top node has a tag name of dd, dt, li, optgroup, option, p, rb, rp, rt or rtc. // If exceptions are specified, nodes with that name will not be popped off. @@ -192,16 +203,17 @@ func (p *parser) generateImpliedEndTags(exceptions ...string) { loop: for i = len(p.oe) - 1; i >= 0; i-- { n := p.oe[i] - if n.Type == ElementNode { - switch n.DataAtom { - case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc: - for _, except := range exceptions { - if n.Data == except { - break loop - } + if n.Type != ElementNode { + break + } + switch n.DataAtom { + case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc: + for _, except := range exceptions { + if n.Data == except { + break loop } - continue } + continue } break } @@ -369,8 +381,7 @@ findIdenticalElements: // Section 12.2.4.3. func (p *parser) clearActiveFormattingElements() { for { - n := p.afe.pop() - if len(p.afe) == 0 || n.Type == scopeMarkerNode { + if n := p.afe.pop(); len(p.afe) == 0 || n.Type == scopeMarkerNode { return } } @@ -625,25 +636,29 @@ func inHeadIM(p *parser) bool { switch p.tok.DataAtom { case a.Html: return inBodyIM(p) - case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta: + case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta: p.addElement() p.oe.pop() p.acknowledgeSelfClosingTag() return true case a.Noscript: - p.addElement() if p.scripting { - p.setOriginalIM() - p.im = textIM - } else { - p.im = inHeadNoscriptIM + p.parseGenericRawTextElement() + return true } + p.addElement() + p.im = inHeadNoscriptIM + // Don't let the tokenizer go into raw text mode when scripting is disabled. + p.tokenizer.NextIsNotRawText() return true - case a.Script, a.Title, a.Noframes, a.Style: + case a.Script, a.Title: p.addElement() p.setOriginalIM() p.im = textIM return true + case a.Noframes, a.Style: + p.parseGenericRawTextElement() + return true case a.Head: // Ignore the token. return true @@ -855,7 +870,7 @@ func inBodyIM(p *parser) bool { return true } copyAttributes(p.oe[0], p.tok) - case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Template, a.Title: + case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Template, a.Title: return inHeadIM(p) case a.Body: if p.oe.contains(a.Template) { @@ -881,7 +896,7 @@ func inBodyIM(p *parser) bool { p.addElement() p.im = inFramesetIM return true - case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Menu, a.Nav, a.Ol, a.P, a.Section, a.Summary, a.Ul: + case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Main, a.Menu, a.Nav, a.Ol, a.P, a.Section, a.Summary, a.Ul: p.popUntil(buttonScope, a.P) p.addElement() case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6: @@ -1014,53 +1029,6 @@ func inBodyIM(p *parser) bool { p.tok.DataAtom = a.Img p.tok.Data = a.Img.String() return false - case a.Isindex: - if p.form != nil { - // Ignore the token. - return true - } - action := "" - prompt := "This is a searchable index. Enter search keywords: " - attr := []Attribute{{Key: "name", Val: "isindex"}} - for _, t := range p.tok.Attr { - switch t.Key { - case "action": - action = t.Val - case "name": - // Ignore the attribute. - case "prompt": - prompt = t.Val - default: - attr = append(attr, t) - } - } - p.acknowledgeSelfClosingTag() - p.popUntil(buttonScope, a.P) - p.parseImpliedToken(StartTagToken, a.Form, a.Form.String()) - if p.form == nil { - // NOTE: The 'isindex' element has been removed, - // and the 'template' element has not been designed to be - // collaborative with the index element. - // - // Ignore the token. - return true - } - if action != "" { - p.form.Attr = []Attribute{{Key: "action", Val: action}} - } - p.parseImpliedToken(StartTagToken, a.Hr, a.Hr.String()) - p.parseImpliedToken(StartTagToken, a.Label, a.Label.String()) - p.addText(prompt) - p.addChild(&Node{ - Type: ElementNode, - DataAtom: a.Input, - Data: a.Input.String(), - Attr: attr, - }) - p.oe.pop() - p.parseImpliedToken(EndTagToken, a.Label, a.Label.String()) - p.parseImpliedToken(StartTagToken, a.Hr, a.Hr.String()) - p.parseImpliedToken(EndTagToken, a.Form, a.Form.String()) case a.Textarea: p.addElement() p.setOriginalIM() @@ -1070,18 +1038,21 @@ func inBodyIM(p *parser) bool { p.popUntil(buttonScope, a.P) p.reconstructActiveFormattingElements() p.framesetOK = false - p.addElement() - p.setOriginalIM() - p.im = textIM + p.parseGenericRawTextElement() case a.Iframe: p.framesetOK = false + p.parseGenericRawTextElement() + case a.Noembed: + p.parseGenericRawTextElement() + case a.Noscript: + if p.scripting { + p.parseGenericRawTextElement() + return true + } + p.reconstructActiveFormattingElements() p.addElement() - p.setOriginalIM() - p.im = textIM - case a.Noembed, a.Noscript: - p.addElement() - p.setOriginalIM() - p.im = textIM + // Don't let the tokenizer go into raw text mode when scripting is disabled. + p.tokenizer.NextIsNotRawText() case a.Select: p.reconstructActiveFormattingElements() p.addElement() @@ -1137,7 +1108,7 @@ func inBodyIM(p *parser) bool { return false } return true - case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Menu, a.Nav, a.Ol, a.Pre, a.Section, a.Summary, a.Ul: + case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Main, a.Menu, a.Nav, a.Ol, a.Pre, a.Section, a.Summary, a.Ul: p.popUntil(defaultScope, p.tok.DataAtom) case a.Form: if p.oe.contains(a.Template) { @@ -1198,14 +1169,13 @@ func inBodyIM(p *parser) bool { if len(p.templateStack) > 0 { p.im = inTemplateIM return false - } else { - for _, e := range p.oe { - switch e.DataAtom { - case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc, a.Tbody, a.Td, a.Tfoot, a.Th, - a.Thead, a.Tr, a.Body, a.Html: - default: - return true - } + } + for _, e := range p.oe { + switch e.DataAtom { + case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc, a.Tbody, a.Td, a.Tfoot, a.Th, + a.Thead, a.Tr, a.Body, a.Html: + default: + return true } } } @@ -1221,9 +1191,15 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { // Once the code successfully parses the comprehensive test suite, we should // refactor this code to be more idiomatic. - // Steps 1-4. The outer loop. + // Steps 1-2 + if current := p.oe.top(); current.Data == tagName && p.afe.index(current) == -1 { + p.oe.pop() + return + } + + // Steps 3-5. The outer loop. for i := 0; i < 8; i++ { - // Step 5. Find the formatting element. + // Step 6. Find the formatting element. var formattingElement *Node for j := len(p.afe) - 1; j >= 0; j-- { if p.afe[j].Type == scopeMarkerNode { @@ -1238,17 +1214,22 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { p.inBodyEndTagOther(tagAtom, tagName) return } + + // Step 7. Ignore the tag if formatting element is not in the stack of open elements. feIndex := p.oe.index(formattingElement) if feIndex == -1 { p.afe.remove(formattingElement) return } + // Step 8. Ignore the tag if formatting element is not in the scope. if !p.elementInScope(defaultScope, tagAtom) { // Ignore the tag. return } - // Steps 9-10. Find the furthest block. + // Step 9. This step is omitted because it's just a parse error but no need to return. + + // Steps 10-11. Find the furthest block. var furthestBlock *Node for _, e := range p.oe[feIndex:] { if isSpecialElement(e) { @@ -1265,47 +1246,65 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { return } - // Steps 11-12. Find the common ancestor and bookmark node. + // Steps 12-13. Find the common ancestor and bookmark node. commonAncestor := p.oe[feIndex-1] bookmark := p.afe.index(formattingElement) - // Step 13. The inner loop. Find the lastNode to reparent. + // Step 14. The inner loop. Find the lastNode to reparent. lastNode := furthestBlock node := furthestBlock x := p.oe.index(node) - // Steps 13.1-13.2 - for j := 0; j < 3; j++ { - // Step 13.3. + // Step 14.1. + j := 0 + for { + // Step 14.2. + j++ + // Step. 14.3. x-- node = p.oe[x] - // Step 13.4 - 13.5. + // Step 14.4. Go to the next step if node is formatting element. + if node == formattingElement { + break + } + // Step 14.5. Remove node from the list of active formatting elements if + // inner loop counter is greater than three and node is in the list of + // active formatting elements. + if ni := p.afe.index(node); j > 3 && ni > -1 { + p.afe.remove(node) + // If any element of the list of active formatting elements is removed, + // we need to take care whether bookmark should be decremented or not. + // This is because the value of bookmark may exceed the size of the + // list by removing elements from the list. + if ni <= bookmark { + bookmark-- + } + continue + } + // Step 14.6. Continue the next inner loop if node is not in the list of + // active formatting elements. if p.afe.index(node) == -1 { p.oe.remove(node) continue } - // Step 13.6. - if node == formattingElement { - break - } - // Step 13.7. + // Step 14.7. clone := node.clone() p.afe[p.afe.index(node)] = clone p.oe[p.oe.index(node)] = clone node = clone - // Step 13.8. + // Step 14.8. if lastNode == furthestBlock { bookmark = p.afe.index(node) + 1 } - // Step 13.9. + // Step 14.9. if lastNode.Parent != nil { lastNode.Parent.RemoveChild(lastNode) } node.AppendChild(lastNode) - // Step 13.10. + // Step 14.10. lastNode = node } - // Step 14. Reparent lastNode to the common ancestor, + // Step 15. Reparent lastNode to the common ancestor, // or for misnested table nodes, to the foster parent. if lastNode.Parent != nil { lastNode.Parent.RemoveChild(lastNode) @@ -1317,13 +1316,13 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { commonAncestor.AppendChild(lastNode) } - // Steps 15-17. Reparent nodes from the furthest block's children + // Steps 16-18. Reparent nodes from the furthest block's children // to a clone of the formatting element. clone := formattingElement.clone() reparentChildren(clone, furthestBlock) furthestBlock.AppendChild(clone) - // Step 18. Fix up the list of active formatting elements. + // Step 19. Fix up the list of active formatting elements. if oldLoc := p.afe.index(formattingElement); oldLoc != -1 && oldLoc < bookmark { // Move the bookmark with the rest of the list. bookmark-- @@ -1331,7 +1330,7 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { p.afe.remove(formattingElement) p.afe.insert(bookmark, clone) - // Step 19. Fix up the stack of open elements. + // Step 20. Fix up the stack of open elements. p.oe.remove(formattingElement) p.oe.insert(p.oe.index(furthestBlock)+1, clone) } @@ -1502,14 +1501,13 @@ func inCaptionIM(p *parser) bool { case StartTagToken: switch p.tok.DataAtom { case a.Caption, a.Col, a.Colgroup, a.Tbody, a.Td, a.Tfoot, a.Thead, a.Tr: - if p.popUntil(tableScope, a.Caption) { - p.clearActiveFormattingElements() - p.im = inTableIM - return false - } else { + if !p.popUntil(tableScope, a.Caption) { // Ignore the token. return true } + p.clearActiveFormattingElements() + p.im = inTableIM + return false case a.Select: p.reconstructActiveFormattingElements() p.addElement() @@ -1526,14 +1524,13 @@ func inCaptionIM(p *parser) bool { } return true case a.Table: - if p.popUntil(tableScope, a.Caption) { - p.clearActiveFormattingElements() - p.im = inTableIM - return false - } else { + if !p.popUntil(tableScope, a.Caption) { // Ignore the token. return true } + p.clearActiveFormattingElements() + p.im = inTableIM + return false case a.Body, a.Col, a.Colgroup, a.Html, a.Tbody, a.Td, a.Tfoot, a.Th, a.Thead, a.Tr: // Ignore the token. return true @@ -1777,12 +1774,11 @@ func inSelectIM(p *parser) bool { } p.addElement() case a.Select: - if p.popUntil(selectScope, a.Select) { - p.resetInsertionMode() - } else { + if !p.popUntil(selectScope, a.Select) { // Ignore the token. return true } + p.resetInsertionMode() case a.Input, a.Keygen, a.Textarea: if p.elementInScope(selectScope, a.Select) { p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) @@ -1810,12 +1806,11 @@ func inSelectIM(p *parser) bool { p.oe = p.oe[:i] } case a.Select: - if p.popUntil(selectScope, a.Select) { - p.resetInsertionMode() - } else { + if !p.popUntil(selectScope, a.Select) { // Ignore the token. return true } + p.resetInsertionMode() case a.Template: return inHeadIM(p) } @@ -2136,28 +2131,31 @@ func parseForeignContent(p *parser) bool { Data: p.tok.Data, }) case StartTagToken: - b := breakout[p.tok.Data] - if p.tok.DataAtom == a.Font { - loop: - for _, attr := range p.tok.Attr { - switch attr.Key { - case "color", "face", "size": - b = true - break loop + if !p.fragment { + b := breakout[p.tok.Data] + if p.tok.DataAtom == a.Font { + loop: + for _, attr := range p.tok.Attr { + switch attr.Key { + case "color", "face", "size": + b = true + break loop + } } } - } - if b { - for i := len(p.oe) - 1; i >= 0; i-- { - n := p.oe[i] - if n.Namespace == "" || htmlIntegrationPoint(n) || mathMLTextIntegrationPoint(n) { - p.oe = p.oe[:i+1] - break + if b { + for i := len(p.oe) - 1; i >= 0; i-- { + n := p.oe[i] + if n.Namespace == "" || htmlIntegrationPoint(n) || mathMLTextIntegrationPoint(n) { + p.oe = p.oe[:i+1] + break + } } + return false } - return false } - switch p.top().Namespace { + current := p.adjustedCurrentNode() + switch current.Namespace { case "math": adjustAttributeNames(p.tok.Attr, mathMLAttributeAdjustments) case "svg": @@ -2172,7 +2170,7 @@ func parseForeignContent(p *parser) bool { panic("html: bad parser state: unexpected namespace") } adjustForeignAttributes(p.tok.Attr) - namespace := p.top().Namespace + namespace := current.Namespace p.addElement() p.top().Namespace = namespace if namespace != "" { @@ -2201,12 +2199,20 @@ func parseForeignContent(p *parser) bool { return true } +// Section 12.2.4.2. +func (p *parser) adjustedCurrentNode() *Node { + if len(p.oe) == 1 && p.fragment && p.context != nil { + return p.context + } + return p.oe.top() +} + // Section 12.2.6. func (p *parser) inForeignContent() bool { if len(p.oe) == 0 { return false } - n := p.oe[len(p.oe)-1] + n := p.adjustedCurrentNode() if n.Namespace == "" { return false } @@ -2341,8 +2347,7 @@ func ParseWithOptions(r io.Reader, opts ...ParseOption) (*Node, error) { f(p) } - err := p.parse() - if err != nil { + if err := p.parse(); err != nil { return nil, err } return p.doc, nil @@ -2364,7 +2369,6 @@ func ParseFragmentWithOptions(r io.Reader, context *Node, opts ...ParseOption) ( contextTag = context.DataAtom.String() } p := &parser{ - tokenizer: NewTokenizerFragment(r, contextTag), doc: &Node{ Type: DocumentNode, }, @@ -2372,6 +2376,11 @@ func ParseFragmentWithOptions(r io.Reader, context *Node, opts ...ParseOption) ( fragment: true, context: context, } + if context != nil && context.Namespace != "" { + p.tokenizer = NewTokenizer(r) + } else { + p.tokenizer = NewTokenizerFragment(r, contextTag) + } for _, f := range opts { f(p) @@ -2396,8 +2405,7 @@ func ParseFragmentWithOptions(r io.Reader, context *Node, opts ...ParseOption) ( } } - err := p.parse() - if err != nil { + if err := p.parse(); err != nil { return nil, err } diff --git a/backend/vendor/golang.org/x/net/html/render.go b/backend/vendor/golang.org/x/net/html/render.go index d34564f4..46879c08 100644 --- a/backend/vendor/golang.org/x/net/html/render.go +++ b/backend/vendor/golang.org/x/net/html/render.go @@ -134,6 +134,9 @@ func render1(w writer, n *Node) error { } } return w.WriteByte('>') + case RawNode: + _, err := w.WriteString(n.Data) + return err default: return errors.New("html: unknown node type") } @@ -252,20 +255,19 @@ func writeQuoted(w writer, s string) error { // Section 12.1.2, "Elements", gives this list of void elements. Void elements // are those that can't have any contents. var voidElements = map[string]bool{ - "area": true, - "base": true, - "br": true, - "col": true, - "command": true, - "embed": true, - "hr": true, - "img": true, - "input": true, - "keygen": true, - "link": true, - "meta": true, - "param": true, - "source": true, - "track": true, - "wbr": true, + "area": true, + "base": true, + "br": true, + "col": true, + "embed": true, + "hr": true, + "img": true, + "input": true, + "keygen": true, + "link": true, + "meta": true, + "param": true, + "source": true, + "track": true, + "wbr": true, } diff --git a/backend/vendor/golang.org/x/net/html/token.go b/backend/vendor/golang.org/x/net/html/token.go index e3c01d7c..877709f9 100644 --- a/backend/vendor/golang.org/x/net/html/token.go +++ b/backend/vendor/golang.org/x/net/html/token.go @@ -296,8 +296,7 @@ func (z *Tokenizer) Buffered() []byte { // too many times in succession. func readAtLeastOneByte(r io.Reader, b []byte) (int, error) { for i := 0; i < 100; i++ { - n, err := r.Read(b) - if n != 0 || err != nil { + if n, err := r.Read(b); n != 0 || err != nil { return n, err } } @@ -347,6 +346,7 @@ loop: break loop } if c != '/' { + z.raw.end-- continue loop } if z.readRawEndTag() || z.err != nil { @@ -1067,6 +1067,11 @@ loop: // Raw returns the unmodified text of the current token. Calling Next, Token, // Text, TagName or TagAttr may change the contents of the returned slice. +// +// The token stream's raw bytes partition the byte stream (up until an +// ErrorToken). There are no overlaps or gaps between two consecutive token's +// raw bytes. One implication is that the byte offset of the current token is +// the sum of the lengths of all previous tokens' raw bytes. func (z *Tokenizer) Raw() []byte { return z.buf[z.raw.start:z.raw.end] } diff --git a/backend/vendor/golang.org/x/net/internal/socks/socks.go b/backend/vendor/golang.org/x/net/internal/socks/socks.go index 6929a9fd..97db2340 100644 --- a/backend/vendor/golang.org/x/net/internal/socks/socks.go +++ b/backend/vendor/golang.org/x/net/internal/socks/socks.go @@ -127,7 +127,7 @@ type Dialer struct { // establishing the transport connection. ProxyDial func(context.Context, string, string) (net.Conn, error) - // AuthMethods specifies the list of request authention + // AuthMethods specifies the list of request authentication // methods. // If empty, SOCKS client requests only AuthMethodNotRequired. AuthMethods []AuthMethod diff --git a/backend/vendor/modules.txt b/backend/vendor/modules.txt index 6c08a2ad..ab02bbcc 100644 --- a/backend/vendor/modules.txt +++ b/backend/vendor/modules.txt @@ -2,8 +2,15 @@ github.com/Masterminds/semver # github.com/Masterminds/sprig v2.16.0+incompatible github.com/Masterminds/sprig +# github.com/PuerkitoBio/purell v1.1.0 +github.com/PuerkitoBio/purell +# github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 +github.com/PuerkitoBio/urlesc # github.com/Unknwon/goconfig v0.0.0-20191126170842-860a72fb44fd github.com/Unknwon/goconfig +# github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc +github.com/alecthomas/template +github.com/alecthomas/template/parse # github.com/aokoli/goutils v1.0.1 github.com/aokoli/goutils # github.com/apex/log v1.1.1 @@ -19,7 +26,7 @@ github.com/emirpasic/gods/trees/binaryheap github.com/emirpasic/gods/utils # github.com/fsnotify/fsnotify v1.4.7 github.com/fsnotify/fsnotify -# github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 +# github.com/gin-contrib/sse v0.1.0 github.com/gin-contrib/sse # github.com/gin-gonic/gin v1.4.0 github.com/gin-gonic/gin @@ -32,6 +39,14 @@ github.com/globalsign/mgo/bson github.com/globalsign/mgo/internal/json github.com/globalsign/mgo/internal/sasl github.com/globalsign/mgo/internal/scram +# github.com/go-openapi/jsonpointer v0.17.0 +github.com/go-openapi/jsonpointer +# github.com/go-openapi/jsonreference v0.19.0 +github.com/go-openapi/jsonreference +# github.com/go-openapi/spec v0.19.0 +github.com/go-openapi/spec +# github.com/go-openapi/swag v0.17.0 +github.com/go-openapi/swag # github.com/go-playground/locales v0.12.1 github.com/go-playground/locales github.com/go-playground/locales/currency @@ -77,6 +92,11 @@ github.com/kevinburke/ssh_config github.com/leodido/go-urn # github.com/magiconair/properties v1.8.0 github.com/magiconair/properties +# github.com/mailru/easyjson v0.7.1 +github.com/mailru/easyjson +github.com/mailru/easyjson/buffer +github.com/mailru/easyjson/jlexer +github.com/mailru/easyjson/jwriter # github.com/matcornic/hermes v1.2.0 github.com/matcornic/hermes # github.com/mattn/go-isatty v0.0.8 @@ -93,9 +113,13 @@ github.com/modern-go/concurrent github.com/modern-go/reflect2 # github.com/olekukonko/tablewriter v0.0.1 github.com/olekukonko/tablewriter +# github.com/olivere/elastic/v7 v7.0.14 +github.com/olivere/elastic/v7 +github.com/olivere/elastic/v7/config +github.com/olivere/elastic/v7/uritemplates # github.com/pelletier/go-toml v1.2.0 github.com/pelletier/go-toml -# github.com/pkg/errors v0.8.1 +# github.com/pkg/errors v0.9.1 github.com/pkg/errors # github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid @@ -130,7 +154,12 @@ github.com/src-d/gcfg/token github.com/src-d/gcfg/types # github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf github.com/ssor/bom -# github.com/ugorji/go v1.1.4 +# github.com/swaggo/gin-swagger v1.2.0 +github.com/swaggo/gin-swagger +github.com/swaggo/gin-swagger/swaggerFiles +# github.com/swaggo/swag v1.5.1 +github.com/swaggo/swag +# github.com/ugorji/go/codec v1.1.5-pre github.com/ugorji/go/codec # github.com/xanzy/ssh-agent v0.2.1 github.com/xanzy/ssh-agent @@ -153,19 +182,30 @@ golang.org/x/crypto/scrypt golang.org/x/crypto/ssh golang.org/x/crypto/ssh/agent golang.org/x/crypto/ssh/knownhosts -# golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 +# golang.org/x/net v0.0.0-20200202094626-16171245cfb2 golang.org/x/net/context golang.org/x/net/html golang.org/x/net/html/atom +golang.org/x/net/idna golang.org/x/net/internal/socks golang.org/x/net/proxy +golang.org/x/net/webdav +golang.org/x/net/webdav/internal/xml # golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e golang.org/x/sys/cpu golang.org/x/sys/unix golang.org/x/sys/windows # golang.org/x/text v0.3.2 +golang.org/x/text/secure/bidirule golang.org/x/text/transform +golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm +golang.org/x/text/width +# golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a +golang.org/x/tools/go/ast/astutil +golang.org/x/tools/go/buildutil +golang.org/x/tools/go/internal/cgo +golang.org/x/tools/go/loader # gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc gopkg.in/alexcesaro/quotedprintable.v3 # gopkg.in/go-playground/validator.v8 v8.18.2