diff --git a/cluster.yml b/cluster.yml index c8e246e4..bada98a3 100644 --- a/cluster.yml +++ b/cluster.yml @@ -74,11 +74,11 @@ system_images: alpine: alpine:latest nginx_proxy: rancher/rke-nginx-proxy:v0.1.1 cert_downloader: rancher/rke-cert-deployer:v0.1.1 - service_sidekick_image: rancher/rke-service-sidekick:v0.1.0 - kubedns_image: gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.5 - dnsmasq_image: gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.5 - kubedns_sidecar_image: gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.5 - kubedns_autoscaler_image: gcr.io/google_containers/cluster-proportional-autoscaler-amd64:1.0.0 + kubernetes_services_sidecar: rancher/rke-service-sidekick:v0.1.0 + kubedns: gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.5 + dnsmasq: gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.5 + kubedns_sidecar: gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.5 + kubedns_autoscaler: gcr.io/google_containers/cluster-proportional-autoscaler-amd64:1.0.0 # all addon manifests MUST specify a namespace addons: |- diff --git a/cluster/addons.go b/cluster/addons.go index c7d16c3d..cf88c9d9 100644 --- a/cluster/addons.go +++ b/cluster/addons.go @@ -40,10 +40,10 @@ func (c *Cluster) deployKubeDNS(ctx context.Context) error { kubeDNSConfig := map[string]string{ addons.KubeDNSServer: c.ClusterDNSServer, addons.KubeDNSClusterDomain: c.ClusterDomain, - addons.KubeDNSImage: c.SystemImages[KubeDNSImage], - addons.DNSMasqImage: c.SystemImages[DNSMasqImage], - addons.KubeDNSSidecarImage: c.SystemImages[KubeDNSSidecarImage], - addons.KubeDNSAutoScalerImage: c.SystemImages[KubeDNSAutoScalerImage], + addons.KubeDNSImage: c.SystemImages.KubeDNS, + addons.DNSMasqImage: c.SystemImages.DNSmasq, + addons.KubeDNSSidecarImage: c.SystemImages.KubeDNSSidecar, + addons.KubeDNSAutoScalerImage: c.SystemImages.KubeDNSAutoscaler, } kubeDNSYaml, err := addons.GetKubeDNSManifest(kubeDNSConfig) if err != nil { diff --git a/cluster/certificates.go b/cluster/certificates.go index 75b43683..31b5523c 100644 --- a/cluster/certificates.go +++ b/cluster/certificates.go @@ -22,7 +22,7 @@ func SetUpAuthentication(ctx context.Context, kubeCluster, currentCluster *Clust kubeCluster.Certificates = currentCluster.Certificates } else { log.Infof(ctx, "[certificates] Attempting to recover certificates from backup on host [%s]", kubeCluster.EtcdHosts[0].Address) - kubeCluster.Certificates, err = pki.FetchCertificatesFromHost(ctx, kubeCluster.EtcdHosts, kubeCluster.EtcdHosts[0], kubeCluster.SystemImages[AplineImage], kubeCluster.LocalKubeConfigPath) + kubeCluster.Certificates, err = pki.FetchCertificatesFromHost(ctx, kubeCluster.EtcdHosts, kubeCluster.EtcdHosts[0], kubeCluster.SystemImages.Alpine, kubeCluster.LocalKubeConfigPath) if err != nil { return err } @@ -42,7 +42,7 @@ func SetUpAuthentication(ctx context.Context, kubeCluster, currentCluster *Clust return fmt.Errorf("Failed to generate Kubernetes certificates: %v", err) } log.Infof(ctx, "[certificates] Temporarily saving certs to etcd host [%s]", kubeCluster.EtcdHosts[0].Address) - if err := pki.DeployCertificatesOnHost(ctx, kubeCluster.EtcdHosts, kubeCluster.EtcdHosts[0], kubeCluster.Certificates, kubeCluster.SystemImages[CertDownloaderImage], pki.TempCertPath); err != nil { + if err := pki.DeployCertificatesOnHost(ctx, kubeCluster.EtcdHosts, kubeCluster.EtcdHosts[0], kubeCluster.Certificates, kubeCluster.SystemImages.CertDownloader, pki.TempCertPath); err != nil { return err } log.Infof(ctx, "[certificates] Saved certs to etcd host [%s]", kubeCluster.EtcdHosts[0].Address) diff --git a/cluster/cluster.go b/cluster/cluster.go index e92fc6db..ef428e42 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -43,14 +43,6 @@ const ( UpdateStateTimeout = 30 GetStateTimeout = 30 KubernetesClientTimeOut = 30 - AplineImage = "alpine" - NginxProxyImage = "nginx_proxy" - CertDownloaderImage = "cert_downloader" - KubeDNSImage = "kubedns_image" - DNSMasqImage = "dnsmasq_image" - KubeDNSSidecarImage = "kubedns_sidecar_image" - KubeDNSAutoScalerImage = "kubedns_autoscaler_image" - ServiceSidekickImage = "service_sidekick_image" NoneAuthorizationMode = "none" LocalNodeAddress = "127.0.0.1" LocalNodeHostname = "localhost" @@ -66,7 +58,7 @@ func (c *Cluster) DeployControlPlane(ctx context.Context) error { if err := services.RunControlPlane(ctx, c.ControlPlaneHosts, c.EtcdHosts, c.Services, - c.SystemImages[ServiceSidekickImage], + c.SystemImages.KubernetesServicesSidecar, c.Authorization.Mode, c.LocalConnDialerFactory); err != nil { return fmt.Errorf("[controlPlane] Failed to bring up Control Plane: %v", err) @@ -84,8 +76,8 @@ func (c *Cluster) DeployWorkerPlane(ctx context.Context) error { c.WorkerHosts, c.EtcdHosts, c.Services, - c.SystemImages[NginxProxyImage], - c.SystemImages[ServiceSidekickImage], + c.SystemImages.NginxProxy, + c.SystemImages.KubernetesServicesSidecar, c.LocalConnDialerFactory); err != nil { return fmt.Errorf("[workerPlane] Failed to bring up Worker Plane: %v", err) } @@ -189,22 +181,19 @@ func (c *Cluster) setClusterServicesDefaults() { } func (c *Cluster) setClusterImageDefaults() { - if c.SystemImages == nil { - // don't break if the user didn't define rke_images - c.SystemImages = make(map[string]string) - } - systemImagesDefaultsMap := map[string]string{ - AplineImage: DefaultAplineImage, - NginxProxyImage: DefaultNginxProxyImage, - CertDownloaderImage: DefaultCertDownloaderImage, - KubeDNSImage: DefaultKubeDNSImage, - DNSMasqImage: DefaultDNSMasqImage, - KubeDNSSidecarImage: DefaultKubeDNSSidecarImage, - KubeDNSAutoScalerImage: DefaultKubeDNSAutoScalerImage, - ServiceSidekickImage: DefaultServiceSidekickImage, + + systemImagesDefaultsMap := map[*string]string{ + &c.SystemImages.Alpine: DefaultAplineImage, + &c.SystemImages.NginxProxy: DefaultNginxProxyImage, + &c.SystemImages.CertDownloader: DefaultCertDownloaderImage, + &c.SystemImages.KubeDNS: DefaultKubeDNSImage, + &c.SystemImages.KubeDNSSidecar: DefaultKubeDNSSidecarImage, + &c.SystemImages.DNSmasq: DefaultDNSmasqImage, + &c.SystemImages.KubeDNSAutoscaler: DefaultKubeDNSAutoScalerImage, + &c.SystemImages.KubernetesServicesSidecar: DefaultKubernetesServicesSidecarImage, } for k, v := range systemImagesDefaultsMap { - setDefaultIfEmptyMapValue(c.SystemImages, k, v) + setDefaultIfEmpty(k, v) } } diff --git a/cluster/defaults.go b/cluster/defaults.go index 4b89e188..4d9d3889 100644 --- a/cluster/defaults.go +++ b/cluster/defaults.go @@ -17,11 +17,11 @@ const ( DefaultNetworkPlugin = "flannel" DefaultNetworkCloudProvider = "none" - DefaultInfraContainerImage = "gcr.io/google_containers/pause-amd64:3.0" - DefaultAplineImage = "alpine:latest" - DefaultNginxProxyImage = "rancher/rke-nginx-proxy:v0.1.1" - DefaultCertDownloaderImage = "rancher/rke-cert-deployer:v0.1.1" - DefaultServiceSidekickImage = "rancher/rke-service-sidekick:v0.1.0" + DefaultInfraContainerImage = "gcr.io/google_containers/pause-amd64:3.0" + DefaultAplineImage = "alpine:latest" + DefaultNginxProxyImage = "rancher/rke-nginx-proxy:v0.1.1" + DefaultCertDownloaderImage = "rancher/rke-cert-deployer:v0.1.1" + DefaultKubernetesServicesSidecarImage = "rancher/rke-service-sidekick:v0.1.0" DefaultEtcdImage = "quay.io/coreos/etcd:latest" DefaultK8sImage = "rancher/k8s:v1.8.5-rancher4" @@ -42,7 +42,7 @@ const ( DefaultCanalFlannelImage = "quay.io/coreos/flannel:v0.9.1" DefaultKubeDNSImage = "gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.5" - DefaultDNSMasqImage = "gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.5" + DefaultDNSmasqImage = "gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.5" DefaultKubeDNSSidecarImage = "gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.5" DefaultKubeDNSAutoScalerImage = "gcr.io/google_containers/cluster-proportional-autoscaler-amd64:1.0.0" ) diff --git a/cluster/hosts.go b/cluster/hosts.go index 5a4f7349..1dc51387 100644 --- a/cluster/hosts.go +++ b/cluster/hosts.go @@ -72,14 +72,14 @@ func (c *Cluster) InvertIndexHosts() error { func (c *Cluster) SetUpHosts(ctx context.Context) error { if c.Authentication.Strategy == X509AuthenticationProvider { log.Infof(ctx, "[certificates] Deploying kubernetes certificates to Cluster nodes") - if err := pki.DeployCertificatesOnMasters(ctx, c.ControlPlaneHosts, c.Certificates, c.SystemImages[CertDownloaderImage]); err != nil { + if err := pki.DeployCertificatesOnMasters(ctx, c.ControlPlaneHosts, c.Certificates, c.SystemImages.CertDownloader); err != nil { return err } - if err := pki.DeployCertificatesOnWorkers(ctx, c.WorkerHosts, c.Certificates, c.SystemImages[CertDownloaderImage]); err != nil { + if err := pki.DeployCertificatesOnWorkers(ctx, c.WorkerHosts, c.Certificates, c.SystemImages.CertDownloader); err != nil { return err } // Deploying etcd certificates - if err := pki.DeployCertificatesOnEtcd(ctx, c.EtcdHosts, c.Certificates, c.SystemImages[CertDownloaderImage]); err != nil { + if err := pki.DeployCertificatesOnEtcd(ctx, c.EtcdHosts, c.Certificates, c.SystemImages.CertDownloader); err != nil { return err } diff --git a/cluster/network.go b/cluster/network.go index b75ba35a..7d59fc71 100644 --- a/cluster/network.go +++ b/cluster/network.go @@ -343,7 +343,7 @@ func (c *Cluster) deployListenerOnPlane(ctx context.Context, portList []string, } func (c *Cluster) deployListener(ctx context.Context, host *hosts.Host, portList []string, containerName string) error { imageCfg := &container.Config{ - Image: c.SystemImages[AplineImage], + Image: c.SystemImages.Alpine, Cmd: []string{ "nc", "-kl", @@ -412,7 +412,7 @@ func (c *Cluster) runServicePortChecks(ctx context.Context) error { for _, host := range c.EtcdHosts { runHost := host errgrp.Go(func() error { - return checkPlaneTCPPortsFromHost(ctx, runHost, etcdPortList, c.EtcdHosts, c.SystemImages[AplineImage]) + return checkPlaneTCPPortsFromHost(ctx, runHost, etcdPortList, c.EtcdHosts, c.SystemImages.Alpine) }) } if err := errgrp.Wait(); err != nil { @@ -424,7 +424,7 @@ func (c *Cluster) runServicePortChecks(ctx context.Context) error { for _, host := range c.ControlPlaneHosts { runHost := host errgrp.Go(func() error { - return checkPlaneTCPPortsFromHost(ctx, runHost, etcdPortList, c.EtcdHosts, c.SystemImages[AplineImage]) + return checkPlaneTCPPortsFromHost(ctx, runHost, etcdPortList, c.EtcdHosts, c.SystemImages.Alpine) }) } if err := errgrp.Wait(); err != nil { @@ -434,7 +434,7 @@ func (c *Cluster) runServicePortChecks(ctx context.Context) error { for _, host := range c.WorkerHosts { runHost := host errgrp.Go(func() error { - return checkPlaneTCPPortsFromHost(ctx, runHost, etcdPortList, c.EtcdHosts, c.SystemImages[AplineImage]) + return checkPlaneTCPPortsFromHost(ctx, runHost, etcdPortList, c.EtcdHosts, c.SystemImages.Alpine) }) } if err := errgrp.Wait(); err != nil { @@ -448,7 +448,7 @@ func (c *Cluster) runServicePortChecks(ctx context.Context) error { for _, host := range c.ControlPlaneHosts { runHost := host errgrp.Go(func() error { - return checkPlaneTCPPortsFromHost(ctx, runHost, workerPortList, c.WorkerHosts, c.SystemImages[AplineImage]) + return checkPlaneTCPPortsFromHost(ctx, runHost, workerPortList, c.WorkerHosts, c.SystemImages.Alpine) }) } if err := errgrp.Wait(); err != nil { @@ -462,7 +462,7 @@ func (c *Cluster) runServicePortChecks(ctx context.Context) error { for _, host := range c.WorkerHosts { runHost := host errgrp.Go(func() error { - return checkPlaneTCPPortsFromHost(ctx, runHost, controlPlanePortList, c.ControlPlaneHosts, c.SystemImages[AplineImage]) + return checkPlaneTCPPortsFromHost(ctx, runHost, controlPlanePortList, c.ControlPlaneHosts, c.SystemImages.Alpine) }) } return errgrp.Wait() diff --git a/cluster/reconcile.go b/cluster/reconcile.go index d3c952a8..d6d54d3e 100644 --- a/cluster/reconcile.go +++ b/cluster/reconcile.go @@ -56,7 +56,7 @@ func reconcileWorker(ctx context.Context, currentCluster, kubeCluster *Cluster, return fmt.Errorf("Failed to delete worker node %s from cluster", toDeleteHost.Address) } // attempting to clean services/files on the host - if err := reconcileHost(ctx, toDeleteHost, true, false, currentCluster.SystemImages[AplineImage], currentCluster.DockerDialerFactory); err != nil { + if err := reconcileHost(ctx, toDeleteHost, true, false, currentCluster.SystemImages.Alpine, currentCluster.DockerDialerFactory); err != nil { log.Warnf(ctx, "[reconcile] Couldn't clean up worker node [%s]: %v", toDeleteHost.Address, err) continue } @@ -97,7 +97,7 @@ func reconcileControl(ctx context.Context, currentCluster, kubeCluster *Cluster, return fmt.Errorf("Failed to delete controlplane node %s from cluster", toDeleteHost.Address) } // attempting to clean services/files on the host - if err := reconcileHost(ctx, toDeleteHost, false, false, currentCluster.SystemImages[AplineImage], currentCluster.DockerDialerFactory); err != nil { + if err := reconcileHost(ctx, toDeleteHost, false, false, currentCluster.SystemImages.Alpine, currentCluster.DockerDialerFactory); err != nil { log.Warnf(ctx, "[reconcile] Couldn't clean up controlplane node [%s]: %v", toDeleteHost.Address, err) continue } @@ -110,7 +110,7 @@ func reconcileControl(ctx context.Context, currentCluster, kubeCluster *Cluster, cpChanged := hosts.IsHostListChanged(currentCluster.ControlPlaneHosts, kubeCluster.ControlPlaneHosts) if cpChanged { log.Infof(ctx, "[reconcile] Rolling update nginx hosts with new list of control plane hosts") - err := services.RollingUpdateNginxProxy(ctx, kubeCluster.ControlPlaneHosts, kubeCluster.WorkerHosts, currentCluster.SystemImages[NginxProxyImage]) + err := services.RollingUpdateNginxProxy(ctx, kubeCluster.ControlPlaneHosts, kubeCluster.WorkerHosts, currentCluster.SystemImages.NginxProxy) if err != nil { return fmt.Errorf("Failed to rolling update Nginx hosts with new control plane hosts") } @@ -173,7 +173,7 @@ func reconcileEtcd(ctx context.Context, currentCluster, kubeCluster *Cluster, ku continue } // attempting to clean services/files on the host - if err := reconcileHost(ctx, etcdHost, false, true, currentCluster.SystemImages[AplineImage], currentCluster.DockerDialerFactory); err != nil { + if err := reconcileHost(ctx, etcdHost, false, true, currentCluster.SystemImages.Alpine, currentCluster.DockerDialerFactory); err != nil { log.Warnf(ctx, "[reconcile] Couldn't clean up etcd node [%s]: %v", etcdHost.Address, err) continue } @@ -199,7 +199,7 @@ func reconcileEtcd(ctx context.Context, currentCluster, kubeCluster *Cluster, ku currentCluster.Certificates = crtMap for _, etcdHost := range etcdToAdd { // deploy certificates on new etcd host - if err := pki.DeployCertificatesOnHost(ctx, kubeCluster.EtcdHosts, etcdHost, currentCluster.Certificates, kubeCluster.SystemImages[CertDownloaderImage], pki.CertPathPrefix); err != nil { + if err := pki.DeployCertificatesOnHost(ctx, kubeCluster.EtcdHosts, etcdHost, currentCluster.Certificates, kubeCluster.SystemImages.CertDownloader, pki.CertPathPrefix); err != nil { return err } diff --git a/cluster/remove.go b/cluster/remove.go index 49eaead9..9f40368e 100644 --- a/cluster/remove.go +++ b/cluster/remove.go @@ -25,7 +25,7 @@ func (c *Cluster) ClusterRemove(ctx context.Context) error { } // Clean up all hosts - if err := cleanUpHosts(ctx, c.ControlPlaneHosts, c.WorkerHosts, c.EtcdHosts, c.SystemImages[AplineImage]); err != nil { + if err := cleanUpHosts(ctx, c.ControlPlaneHosts, c.WorkerHosts, c.EtcdHosts, c.SystemImages.Alpine); err != nil { return err } diff --git a/vendor.conf b/vendor.conf index 7010d2bf..cd564b84 100644 --- a/vendor.conf +++ b/vendor.conf @@ -24,4 +24,4 @@ github.com/coreos/go-semver e214231b295a8ea9479f11b70b35d5acf3556d9 github.com/ugorji/go/codec ccfe18359b55b97855cee1d3f74e5efbda4869dc github.com/rancher/norman da40fa7b068e21ca85bfb3c9f4cf207f1008bf43 -github.com/rancher/types 89ffa83b41713b743dbb420b7bd7180ad6ccb5f9 +github.com/rancher/types 019aa7fc1e5f54e09ecdbb2133bc665aa80cf54a diff --git a/vendor/github.com/coreos/etcd/pkg/tlsutil/doc.go b/vendor/github.com/coreos/etcd/pkg/tlsutil/doc.go deleted file mode 100644 index 3b6aa670..00000000 --- a/vendor/github.com/coreos/etcd/pkg/tlsutil/doc.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package tlsutil provides utility functions for handling TLS. -package tlsutil diff --git a/vendor/github.com/coreos/etcd/pkg/tlsutil/tlsutil.go b/vendor/github.com/coreos/etcd/pkg/tlsutil/tlsutil.go deleted file mode 100644 index 79b1f632..00000000 --- a/vendor/github.com/coreos/etcd/pkg/tlsutil/tlsutil.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tlsutil - -import ( - "crypto/tls" - "crypto/x509" - "encoding/pem" - "io/ioutil" -) - -// NewCertPool creates x509 certPool with provided CA files. -func NewCertPool(CAFiles []string) (*x509.CertPool, error) { - certPool := x509.NewCertPool() - - for _, CAFile := range CAFiles { - pemByte, err := ioutil.ReadFile(CAFile) - if err != nil { - return nil, err - } - - for { - var block *pem.Block - block, pemByte = pem.Decode(pemByte) - if block == nil { - break - } - cert, err := x509.ParseCertificate(block.Bytes) - if err != nil { - return nil, err - } - certPool.AddCert(cert) - } - } - - return certPool, nil -} - -// NewCert generates TLS cert by using the given cert,key and parse function. -func NewCert(certfile, keyfile string, parseFunc func([]byte, []byte) (tls.Certificate, error)) (*tls.Certificate, error) { - cert, err := ioutil.ReadFile(certfile) - if err != nil { - return nil, err - } - - key, err := ioutil.ReadFile(keyfile) - if err != nil { - return nil, err - } - - if parseFunc == nil { - parseFunc = tls.X509KeyPair - } - - tlsCert, err := parseFunc(cert, key) - if err != nil { - return nil, err - } - return &tlsCert, nil -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/doc.go b/vendor/github.com/coreos/etcd/pkg/transport/doc.go deleted file mode 100644 index 37658ce5..00000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package transport implements various HTTP transport utilities based on Go -// net package. -package transport diff --git a/vendor/github.com/coreos/etcd/pkg/transport/keepalive_listener.go b/vendor/github.com/coreos/etcd/pkg/transport/keepalive_listener.go deleted file mode 100644 index 4ff8e7f0..00000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/keepalive_listener.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "crypto/tls" - "fmt" - "net" - "time" -) - -type keepAliveConn interface { - SetKeepAlive(bool) error - SetKeepAlivePeriod(d time.Duration) error -} - -// NewKeepAliveListener returns a listener that listens on the given address. -// Be careful when wrap around KeepAliveListener with another Listener if TLSInfo is not nil. -// Some pkgs (like go/http) might expect Listener to return TLSConn type to start TLS handshake. -// http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html -func NewKeepAliveListener(l net.Listener, scheme string, tlscfg *tls.Config) (net.Listener, error) { - if scheme == "https" { - if tlscfg == nil { - return nil, fmt.Errorf("cannot listen on TLS for given listener: KeyFile and CertFile are not presented") - } - return newTLSKeepaliveListener(l, tlscfg), nil - } - - return &keepaliveListener{ - Listener: l, - }, nil -} - -type keepaliveListener struct{ net.Listener } - -func (kln *keepaliveListener) Accept() (net.Conn, error) { - c, err := kln.Listener.Accept() - if err != nil { - return nil, err - } - kac := c.(keepAliveConn) - // detection time: tcp_keepalive_time + tcp_keepalive_probes + tcp_keepalive_intvl - // default on linux: 30 + 8 * 30 - // default on osx: 30 + 8 * 75 - kac.SetKeepAlive(true) - kac.SetKeepAlivePeriod(30 * time.Second) - return c, nil -} - -// A tlsKeepaliveListener implements a network listener (net.Listener) for TLS connections. -type tlsKeepaliveListener struct { - net.Listener - config *tls.Config -} - -// Accept waits for and returns the next incoming TLS connection. -// The returned connection c is a *tls.Conn. -func (l *tlsKeepaliveListener) Accept() (c net.Conn, err error) { - c, err = l.Listener.Accept() - if err != nil { - return - } - kac := c.(keepAliveConn) - // detection time: tcp_keepalive_time + tcp_keepalive_probes + tcp_keepalive_intvl - // default on linux: 30 + 8 * 30 - // default on osx: 30 + 8 * 75 - kac.SetKeepAlive(true) - kac.SetKeepAlivePeriod(30 * time.Second) - c = tls.Server(c, l.config) - return c, nil -} - -// NewListener creates a Listener which accepts connections from an inner -// Listener and wraps each connection with Server. -// The configuration config must be non-nil and must have -// at least one certificate. -func newTLSKeepaliveListener(inner net.Listener, config *tls.Config) net.Listener { - l := &tlsKeepaliveListener{} - l.Listener = inner - l.config = config - return l -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/limit_listen.go b/vendor/github.com/coreos/etcd/pkg/transport/limit_listen.go deleted file mode 100644 index 930c5420..00000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/limit_listen.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2013 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package transport provides network utility functions, complementing the more -// common ones in the net package. -package transport - -import ( - "errors" - "net" - "sync" - "time" -) - -var ( - ErrNotTCP = errors.New("only tcp connections have keepalive") -) - -// LimitListener returns a Listener that accepts at most n simultaneous -// connections from the provided Listener. -func LimitListener(l net.Listener, n int) net.Listener { - return &limitListener{l, make(chan struct{}, n)} -} - -type limitListener struct { - net.Listener - sem chan struct{} -} - -func (l *limitListener) acquire() { l.sem <- struct{}{} } -func (l *limitListener) release() { <-l.sem } - -func (l *limitListener) Accept() (net.Conn, error) { - l.acquire() - c, err := l.Listener.Accept() - if err != nil { - l.release() - return nil, err - } - return &limitListenerConn{Conn: c, release: l.release}, nil -} - -type limitListenerConn struct { - net.Conn - releaseOnce sync.Once - release func() -} - -func (l *limitListenerConn) Close() error { - err := l.Conn.Close() - l.releaseOnce.Do(l.release) - return err -} - -func (l *limitListenerConn) SetKeepAlive(doKeepAlive bool) error { - tcpc, ok := l.Conn.(*net.TCPConn) - if !ok { - return ErrNotTCP - } - return tcpc.SetKeepAlive(doKeepAlive) -} - -func (l *limitListenerConn) SetKeepAlivePeriod(d time.Duration) error { - tcpc, ok := l.Conn.(*net.TCPConn) - if !ok { - return ErrNotTCP - } - return tcpc.SetKeepAlivePeriod(d) -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/listener.go b/vendor/github.com/coreos/etcd/pkg/transport/listener.go deleted file mode 100644 index 555618e6..00000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/listener.go +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/tls" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" - "errors" - "fmt" - "math/big" - "net" - "os" - "path/filepath" - "strings" - "time" - - "github.com/coreos/etcd/pkg/tlsutil" -) - -func NewListener(addr, scheme string, tlsinfo *TLSInfo) (l net.Listener, err error) { - if l, err = newListener(addr, scheme); err != nil { - return nil, err - } - return wrapTLS(addr, scheme, tlsinfo, l) -} - -func newListener(addr string, scheme string) (net.Listener, error) { - if scheme == "unix" || scheme == "unixs" { - // unix sockets via unix://laddr - return NewUnixListener(addr) - } - return net.Listen("tcp", addr) -} - -func wrapTLS(addr, scheme string, tlsinfo *TLSInfo, l net.Listener) (net.Listener, error) { - if scheme != "https" && scheme != "unixs" { - return l, nil - } - return newTLSListener(l, tlsinfo, checkSAN) -} - -type TLSInfo struct { - CertFile string - KeyFile string - CAFile string // TODO: deprecate this in v4 - TrustedCAFile string - ClientCertAuth bool - CRLFile string - InsecureSkipVerify bool - - // ServerName ensures the cert matches the given host in case of discovery / virtual hosting - ServerName string - - // HandshakeFailure is optionally called when a connection fails to handshake. The - // connection will be closed immediately afterwards. - HandshakeFailure func(*tls.Conn, error) - - selfCert bool - - // parseFunc exists to simplify testing. Typically, parseFunc - // should be left nil. In that case, tls.X509KeyPair will be used. - parseFunc func([]byte, []byte) (tls.Certificate, error) - - // AllowedCN is a CN which must be provided by a client. - AllowedCN string -} - -func (info TLSInfo) String() string { - return fmt.Sprintf("cert = %s, key = %s, ca = %s, trusted-ca = %s, client-cert-auth = %v, crl-file = %s", info.CertFile, info.KeyFile, info.CAFile, info.TrustedCAFile, info.ClientCertAuth, info.CRLFile) -} - -func (info TLSInfo) Empty() bool { - return info.CertFile == "" && info.KeyFile == "" -} - -func SelfCert(dirpath string, hosts []string) (info TLSInfo, err error) { - if err = os.MkdirAll(dirpath, 0700); err != nil { - return - } - - certPath := filepath.Join(dirpath, "cert.pem") - keyPath := filepath.Join(dirpath, "key.pem") - _, errcert := os.Stat(certPath) - _, errkey := os.Stat(keyPath) - if errcert == nil && errkey == nil { - info.CertFile = certPath - info.KeyFile = keyPath - info.selfCert = true - return - } - - serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) - serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) - if err != nil { - return - } - - tmpl := x509.Certificate{ - SerialNumber: serialNumber, - Subject: pkix.Name{Organization: []string{"etcd"}}, - NotBefore: time.Now(), - NotAfter: time.Now().Add(365 * (24 * time.Hour)), - - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - BasicConstraintsValid: true, - } - - for _, host := range hosts { - h, _, _ := net.SplitHostPort(host) - if ip := net.ParseIP(h); ip != nil { - tmpl.IPAddresses = append(tmpl.IPAddresses, ip) - } else { - tmpl.DNSNames = append(tmpl.DNSNames, h) - } - } - - priv, err := ecdsa.GenerateKey(elliptic.P521(), rand.Reader) - if err != nil { - return - } - - derBytes, err := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, &priv.PublicKey, priv) - if err != nil { - return - } - - certOut, err := os.Create(certPath) - if err != nil { - return - } - pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}) - certOut.Close() - - b, err := x509.MarshalECPrivateKey(priv) - if err != nil { - return - } - keyOut, err := os.OpenFile(keyPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) - if err != nil { - return - } - pem.Encode(keyOut, &pem.Block{Type: "EC PRIVATE KEY", Bytes: b}) - keyOut.Close() - - return SelfCert(dirpath, hosts) -} - -func (info TLSInfo) baseConfig() (*tls.Config, error) { - if info.KeyFile == "" || info.CertFile == "" { - return nil, fmt.Errorf("KeyFile and CertFile must both be present[key: %v, cert: %v]", info.KeyFile, info.CertFile) - } - - tlsCert, err := tlsutil.NewCert(info.CertFile, info.KeyFile, info.parseFunc) - if err != nil { - return nil, err - } - - cfg := &tls.Config{ - Certificates: []tls.Certificate{*tlsCert}, - MinVersion: tls.VersionTLS12, - ServerName: info.ServerName, - } - - if info.AllowedCN != "" { - cfg.VerifyPeerCertificate = func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error { - for _, chains := range verifiedChains { - if len(chains) != 0 { - if info.AllowedCN == chains[0].Subject.CommonName { - return nil - } - } - } - return errors.New("CommonName authentication failed") - } - } - - // this only reloads certs when there's a client request - // TODO: support server-side refresh (e.g. inotify, SIGHUP), caching - cfg.GetCertificate = func(clientHello *tls.ClientHelloInfo) (*tls.Certificate, error) { - return tlsutil.NewCert(info.CertFile, info.KeyFile, info.parseFunc) - } - cfg.GetClientCertificate = func(unused *tls.CertificateRequestInfo) (*tls.Certificate, error) { - return tlsutil.NewCert(info.CertFile, info.KeyFile, info.parseFunc) - } - return cfg, nil -} - -// cafiles returns a list of CA file paths. -func (info TLSInfo) cafiles() []string { - cs := make([]string, 0) - if info.CAFile != "" { - cs = append(cs, info.CAFile) - } - if info.TrustedCAFile != "" { - cs = append(cs, info.TrustedCAFile) - } - return cs -} - -// ServerConfig generates a tls.Config object for use by an HTTP server. -func (info TLSInfo) ServerConfig() (*tls.Config, error) { - cfg, err := info.baseConfig() - if err != nil { - return nil, err - } - - cfg.ClientAuth = tls.NoClientCert - if info.CAFile != "" || info.ClientCertAuth { - cfg.ClientAuth = tls.RequireAndVerifyClientCert - } - - CAFiles := info.cafiles() - if len(CAFiles) > 0 { - cp, err := tlsutil.NewCertPool(CAFiles) - if err != nil { - return nil, err - } - cfg.ClientCAs = cp - } - - // "h2" NextProtos is necessary for enabling HTTP2 for go's HTTP server - cfg.NextProtos = []string{"h2"} - - return cfg, nil -} - -// ClientConfig generates a tls.Config object for use by an HTTP client. -func (info TLSInfo) ClientConfig() (*tls.Config, error) { - var cfg *tls.Config - var err error - - if !info.Empty() { - cfg, err = info.baseConfig() - if err != nil { - return nil, err - } - } else { - cfg = &tls.Config{ServerName: info.ServerName} - } - cfg.InsecureSkipVerify = info.InsecureSkipVerify - - CAFiles := info.cafiles() - if len(CAFiles) > 0 { - cfg.RootCAs, err = tlsutil.NewCertPool(CAFiles) - if err != nil { - return nil, err - } - } - - if info.selfCert { - cfg.InsecureSkipVerify = true - } - return cfg, nil -} - -// IsClosedConnError returns true if the error is from closing listener, cmux. -// copied from golang.org/x/net/http2/http2.go -func IsClosedConnError(err error) bool { - // 'use of closed network connection' (Go <=1.8) - // 'use of closed file or network connection' (Go >1.8, internal/poll.ErrClosing) - // 'mux: listener closed' (cmux.ErrListenerClosed) - return err != nil && strings.Contains(err.Error(), "closed") -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/listener_tls.go b/vendor/github.com/coreos/etcd/pkg/transport/listener_tls.go deleted file mode 100644 index 6f160094..00000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/listener_tls.go +++ /dev/null @@ -1,272 +0,0 @@ -// Copyright 2017 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "context" - "crypto/tls" - "crypto/x509" - "fmt" - "io/ioutil" - "net" - "strings" - "sync" -) - -// tlsListener overrides a TLS listener so it will reject client -// certificates with insufficient SAN credentials or CRL revoked -// certificates. -type tlsListener struct { - net.Listener - connc chan net.Conn - donec chan struct{} - err error - handshakeFailure func(*tls.Conn, error) - check tlsCheckFunc -} - -type tlsCheckFunc func(context.Context, *tls.Conn) error - -// NewTLSListener handshakes TLS connections and performs optional CRL checking. -func NewTLSListener(l net.Listener, tlsinfo *TLSInfo) (net.Listener, error) { - check := func(context.Context, *tls.Conn) error { return nil } - return newTLSListener(l, tlsinfo, check) -} - -func newTLSListener(l net.Listener, tlsinfo *TLSInfo, check tlsCheckFunc) (net.Listener, error) { - if tlsinfo == nil || tlsinfo.Empty() { - l.Close() - return nil, fmt.Errorf("cannot listen on TLS for %s: KeyFile and CertFile are not presented", l.Addr().String()) - } - tlscfg, err := tlsinfo.ServerConfig() - if err != nil { - return nil, err - } - - hf := tlsinfo.HandshakeFailure - if hf == nil { - hf = func(*tls.Conn, error) {} - } - - if len(tlsinfo.CRLFile) > 0 { - prevCheck := check - check = func(ctx context.Context, tlsConn *tls.Conn) error { - if err := prevCheck(ctx, tlsConn); err != nil { - return err - } - st := tlsConn.ConnectionState() - if certs := st.PeerCertificates; len(certs) > 0 { - return checkCRL(tlsinfo.CRLFile, certs) - } - return nil - } - } - - tlsl := &tlsListener{ - Listener: tls.NewListener(l, tlscfg), - connc: make(chan net.Conn), - donec: make(chan struct{}), - handshakeFailure: hf, - check: check, - } - go tlsl.acceptLoop() - return tlsl, nil -} - -func (l *tlsListener) Accept() (net.Conn, error) { - select { - case conn := <-l.connc: - return conn, nil - case <-l.donec: - return nil, l.err - } -} - -func checkSAN(ctx context.Context, tlsConn *tls.Conn) error { - st := tlsConn.ConnectionState() - if certs := st.PeerCertificates; len(certs) > 0 { - addr := tlsConn.RemoteAddr().String() - return checkCertSAN(ctx, certs[0], addr) - } - return nil -} - -// acceptLoop launches each TLS handshake in a separate goroutine -// to prevent a hanging TLS connection from blocking other connections. -func (l *tlsListener) acceptLoop() { - var wg sync.WaitGroup - var pendingMu sync.Mutex - - pending := make(map[net.Conn]struct{}) - ctx, cancel := context.WithCancel(context.Background()) - defer func() { - cancel() - pendingMu.Lock() - for c := range pending { - c.Close() - } - pendingMu.Unlock() - wg.Wait() - close(l.donec) - }() - - for { - conn, err := l.Listener.Accept() - if err != nil { - l.err = err - return - } - - pendingMu.Lock() - pending[conn] = struct{}{} - pendingMu.Unlock() - - wg.Add(1) - go func() { - defer func() { - if conn != nil { - conn.Close() - } - wg.Done() - }() - - tlsConn := conn.(*tls.Conn) - herr := tlsConn.Handshake() - pendingMu.Lock() - delete(pending, conn) - pendingMu.Unlock() - - if herr != nil { - l.handshakeFailure(tlsConn, herr) - return - } - if err := l.check(ctx, tlsConn); err != nil { - l.handshakeFailure(tlsConn, err) - return - } - - select { - case l.connc <- tlsConn: - conn = nil - case <-ctx.Done(): - } - }() - } -} - -func checkCRL(crlPath string, cert []*x509.Certificate) error { - // TODO: cache - crlBytes, err := ioutil.ReadFile(crlPath) - if err != nil { - return err - } - certList, err := x509.ParseCRL(crlBytes) - if err != nil { - return err - } - revokedSerials := make(map[string]struct{}) - for _, rc := range certList.TBSCertList.RevokedCertificates { - revokedSerials[string(rc.SerialNumber.Bytes())] = struct{}{} - } - for _, c := range cert { - serial := string(c.SerialNumber.Bytes()) - if _, ok := revokedSerials[serial]; ok { - return fmt.Errorf("transport: certificate serial %x revoked", serial) - } - } - return nil -} - -func checkCertSAN(ctx context.Context, cert *x509.Certificate, remoteAddr string) error { - if len(cert.IPAddresses) == 0 && len(cert.DNSNames) == 0 { - return nil - } - h, _, herr := net.SplitHostPort(remoteAddr) - if herr != nil { - return herr - } - if len(cert.IPAddresses) > 0 { - cerr := cert.VerifyHostname(h) - if cerr == nil { - return nil - } - if len(cert.DNSNames) == 0 { - return cerr - } - } - if len(cert.DNSNames) > 0 { - ok, err := isHostInDNS(ctx, h, cert.DNSNames) - if ok { - return nil - } - errStr := "" - if err != nil { - errStr = " (" + err.Error() + ")" - } - return fmt.Errorf("tls: %q does not match any of DNSNames %q"+errStr, h, cert.DNSNames) - } - return nil -} - -func isHostInDNS(ctx context.Context, host string, dnsNames []string) (ok bool, err error) { - // reverse lookup - wildcards, names := []string{}, []string{} - for _, dns := range dnsNames { - if strings.HasPrefix(dns, "*.") { - wildcards = append(wildcards, dns[1:]) - } else { - names = append(names, dns) - } - } - lnames, lerr := net.DefaultResolver.LookupAddr(ctx, host) - for _, name := range lnames { - // strip trailing '.' from PTR record - if name[len(name)-1] == '.' { - name = name[:len(name)-1] - } - for _, wc := range wildcards { - if strings.HasSuffix(name, wc) { - return true, nil - } - } - for _, n := range names { - if n == name { - return true, nil - } - } - } - err = lerr - - // forward lookup - for _, dns := range names { - addrs, lerr := net.DefaultResolver.LookupHost(ctx, dns) - if lerr != nil { - err = lerr - continue - } - for _, addr := range addrs { - if addr == host { - return true, nil - } - } - } - return false, err -} - -func (l *tlsListener) Close() error { - err := l.Listener.Close() - <-l.donec - return err -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/timeout_conn.go b/vendor/github.com/coreos/etcd/pkg/transport/timeout_conn.go deleted file mode 100644 index 7e8c0203..00000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/timeout_conn.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "net" - "time" -) - -type timeoutConn struct { - net.Conn - wtimeoutd time.Duration - rdtimeoutd time.Duration -} - -func (c timeoutConn) Write(b []byte) (n int, err error) { - if c.wtimeoutd > 0 { - if err := c.SetWriteDeadline(time.Now().Add(c.wtimeoutd)); err != nil { - return 0, err - } - } - return c.Conn.Write(b) -} - -func (c timeoutConn) Read(b []byte) (n int, err error) { - if c.rdtimeoutd > 0 { - if err := c.SetReadDeadline(time.Now().Add(c.rdtimeoutd)); err != nil { - return 0, err - } - } - return c.Conn.Read(b) -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/timeout_dialer.go b/vendor/github.com/coreos/etcd/pkg/transport/timeout_dialer.go deleted file mode 100644 index 6ae39ecf..00000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/timeout_dialer.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "net" - "time" -) - -type rwTimeoutDialer struct { - wtimeoutd time.Duration - rdtimeoutd time.Duration - net.Dialer -} - -func (d *rwTimeoutDialer) Dial(network, address string) (net.Conn, error) { - conn, err := d.Dialer.Dial(network, address) - tconn := &timeoutConn{ - rdtimeoutd: d.rdtimeoutd, - wtimeoutd: d.wtimeoutd, - Conn: conn, - } - return tconn, err -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/timeout_listener.go b/vendor/github.com/coreos/etcd/pkg/transport/timeout_listener.go deleted file mode 100644 index b35e0495..00000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/timeout_listener.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "net" - "time" -) - -// NewTimeoutListener returns a listener that listens on the given address. -// If read/write on the accepted connection blocks longer than its time limit, -// it will return timeout error. -func NewTimeoutListener(addr string, scheme string, tlsinfo *TLSInfo, rdtimeoutd, wtimeoutd time.Duration) (net.Listener, error) { - ln, err := newListener(addr, scheme) - if err != nil { - return nil, err - } - ln = &rwTimeoutListener{ - Listener: ln, - rdtimeoutd: rdtimeoutd, - wtimeoutd: wtimeoutd, - } - if ln, err = wrapTLS(addr, scheme, tlsinfo, ln); err != nil { - return nil, err - } - return ln, nil -} - -type rwTimeoutListener struct { - net.Listener - wtimeoutd time.Duration - rdtimeoutd time.Duration -} - -func (rwln *rwTimeoutListener) Accept() (net.Conn, error) { - c, err := rwln.Listener.Accept() - if err != nil { - return nil, err - } - return timeoutConn{ - Conn: c, - wtimeoutd: rwln.wtimeoutd, - rdtimeoutd: rwln.rdtimeoutd, - }, nil -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/timeout_transport.go b/vendor/github.com/coreos/etcd/pkg/transport/timeout_transport.go deleted file mode 100644 index ea16b4c0..00000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/timeout_transport.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "net" - "net/http" - "time" -) - -// NewTimeoutTransport returns a transport created using the given TLS info. -// If read/write on the created connection blocks longer than its time limit, -// it will return timeout error. -// If read/write timeout is set, transport will not be able to reuse connection. -func NewTimeoutTransport(info TLSInfo, dialtimeoutd, rdtimeoutd, wtimeoutd time.Duration) (*http.Transport, error) { - tr, err := NewTransport(info, dialtimeoutd) - if err != nil { - return nil, err - } - - if rdtimeoutd != 0 || wtimeoutd != 0 { - // the timed out connection will timeout soon after it is idle. - // it should not be put back to http transport as an idle connection for future usage. - tr.MaxIdleConnsPerHost = -1 - } else { - // allow more idle connections between peers to avoid unnecessary port allocation. - tr.MaxIdleConnsPerHost = 1024 - } - - tr.Dial = (&rwTimeoutDialer{ - Dialer: net.Dialer{ - Timeout: dialtimeoutd, - KeepAlive: 30 * time.Second, - }, - rdtimeoutd: rdtimeoutd, - wtimeoutd: wtimeoutd, - }).Dial - return tr, nil -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/tls.go b/vendor/github.com/coreos/etcd/pkg/transport/tls.go deleted file mode 100644 index 62fe0d38..00000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/tls.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "fmt" - "strings" - "time" -) - -// ValidateSecureEndpoints scans the given endpoints against tls info, returning only those -// endpoints that could be validated as secure. -func ValidateSecureEndpoints(tlsInfo TLSInfo, eps []string) ([]string, error) { - t, err := NewTransport(tlsInfo, 5*time.Second) - if err != nil { - return nil, err - } - var errs []string - var endpoints []string - for _, ep := range eps { - if !strings.HasPrefix(ep, "https://") { - errs = append(errs, fmt.Sprintf("%q is insecure", ep)) - continue - } - conn, cerr := t.Dial("tcp", ep[len("https://"):]) - if cerr != nil { - errs = append(errs, fmt.Sprintf("%q failed to dial (%v)", ep, cerr)) - continue - } - conn.Close() - endpoints = append(endpoints, ep) - } - if len(errs) != 0 { - err = fmt.Errorf("%s", strings.Join(errs, ",")) - } - return endpoints, err -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/transport.go b/vendor/github.com/coreos/etcd/pkg/transport/transport.go deleted file mode 100644 index 4a7fe69d..00000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/transport.go +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "net" - "net/http" - "strings" - "time" -) - -type unixTransport struct{ *http.Transport } - -func NewTransport(info TLSInfo, dialtimeoutd time.Duration) (*http.Transport, error) { - cfg, err := info.ClientConfig() - if err != nil { - return nil, err - } - - t := &http.Transport{ - Proxy: http.ProxyFromEnvironment, - Dial: (&net.Dialer{ - Timeout: dialtimeoutd, - // value taken from http.DefaultTransport - KeepAlive: 30 * time.Second, - }).Dial, - // value taken from http.DefaultTransport - TLSHandshakeTimeout: 10 * time.Second, - TLSClientConfig: cfg, - } - - dialer := (&net.Dialer{ - Timeout: dialtimeoutd, - KeepAlive: 30 * time.Second, - }) - dial := func(net, addr string) (net.Conn, error) { - return dialer.Dial("unix", addr) - } - - tu := &http.Transport{ - Proxy: http.ProxyFromEnvironment, - Dial: dial, - TLSHandshakeTimeout: 10 * time.Second, - TLSClientConfig: cfg, - } - ut := &unixTransport{tu} - - t.RegisterProtocol("unix", ut) - t.RegisterProtocol("unixs", ut) - - return t, nil -} - -func (urt *unixTransport) RoundTrip(req *http.Request) (*http.Response, error) { - url := *req.URL - req.URL = &url - req.URL.Scheme = strings.Replace(req.URL.Scheme, "unix", "http", 1) - return urt.Transport.RoundTrip(req) -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/unix_listener.go b/vendor/github.com/coreos/etcd/pkg/transport/unix_listener.go deleted file mode 100644 index 123e2036..00000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/unix_listener.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "net" - "os" -) - -type unixListener struct{ net.Listener } - -func NewUnixListener(addr string) (net.Listener, error) { - if err := os.Remove(addr); err != nil && !os.IsNotExist(err) { - return nil, err - } - l, err := net.Listen("unix", addr) - if err != nil { - return nil, err - } - return &unixListener{l}, nil -} - -func (ul *unixListener) Close() error { - if err := os.Remove(ul.Addr().String()); err != nil && !os.IsNotExist(err) { - return err - } - return ul.Listener.Close() -} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/authz_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/authz_types.go index 216ee042..ec721772 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/authz_types.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/authz_types.go @@ -63,8 +63,8 @@ type GlobalRoleBinding struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Subject rbacv1.Subject `json:"subject,omitempty"` - GlobalRoleName string `json:"globalRoleName,omitempty" norman:"type=reference[globalRole]"` + UserName string `json:"userName,omitempty" norman:"required,type=reference[user]"` + GlobalRoleName string `json:"globalRoleName,omitempty" norman:"required,type=reference[globalRole]"` } type RoleTemplate struct { @@ -94,10 +94,9 @@ type ProjectRoleTemplateBinding struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Subject rbacv1.Subject `json:"subject,omitempty"` - - ProjectName string `json:"projectName,omitempty" norman:"type=reference[project]"` - RoleTemplateName string `json:"roleTemplateName,omitempty" norman:"type=reference[roleTemplate]"` + UserName string `json:"userName,omitempty" norman:"required,type=reference[user]"` + ProjectName string `json:"projectName,omitempty" norman:"required,type=reference[project]"` + RoleTemplateName string `json:"roleTemplateName,omitempty" norman:"required,type=reference[roleTemplate]"` } type ClusterRoleTemplateBinding struct { @@ -105,8 +104,7 @@ type ClusterRoleTemplateBinding struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Subject rbacv1.Subject `json:"subject,omitempty"` - - ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster]"` - RoleTemplateName string `json:"roleTemplateName,omitempty" norman:"type=reference[roleTemplate]"` + UserName string `json:"userName,omitempty" norman:"required,type=reference[user]"` + ClusterName string `json:"clusterName,omitempty" norman:"required,type=reference[cluster]"` + RoleTemplateName string `json:"roleTemplateName,omitempty" norman:"required,type=reference[roleTemplate]"` } diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/cluster_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/cluster_types.go index 93da054e..aefda74e 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/cluster_types.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/cluster_types.go @@ -17,6 +17,7 @@ const ( ClusterConditionProvisioned condition.Cond = "Provisioned" ClusterConditionUpdated condition.Cond = "Updated" ClusterConditionRemoved condition.Cond = "Removed" + ClusterConditionRegistered condition.Cond = "Registered" // ClusterConditionNoDiskPressure true when all cluster nodes have sufficient disk ClusterConditionNoDiskPressure condition.Cond = "NoDiskPressure" // ClusterConditionNoMemoryPressure true when all cluster nodes have sufficient memory @@ -46,8 +47,8 @@ type ClusterSpec struct { DisplayName string `json:"displayName"` Description string `json:"description"` Internal bool `json:"internal" norman:"nocreate,noupdate"` - Embedded bool `json:"embedded"` - EmbeddedConfig *K8sServerConfig `json:"embeddedConfig"` + ImportedConfig *ImportedConfig `json:"importedConfig" norman:"noupdate"` + EmbeddedConfig *K8sServerConfig `json:"embeddedConfig" norman:"noupdate"` GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"` AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"` RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty"` @@ -55,6 +56,10 @@ type ClusterSpec struct { DefaultClusterRoleForProjectMembers string `json:"defaultClusterRoleForProjectMembers,omitempty" norman:"type=reference[roleTemplate]"` } +type ImportedConfig struct { + KubeConfig string `json:"kubeConfig"` +} + type K8sServerConfig struct { AdmissionControllers []string `json:"admissionControllers,omitempty"` ServiceNetCIDR string `json:"serviceNetCidr,omitempty"` @@ -171,7 +176,7 @@ type ClusterRegistrationToken struct { } type ClusterRegistrationTokenSpec struct { - ClusterName string `json:"clusterName" norman:"type=reference[cluster]"` + ClusterName string `json:"clusterName" norman:"required,type=reference[cluster]"` } type ClusterRegistrationTokenStatus struct { diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/global_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/global_types.go new file mode 100644 index 00000000..7a89b140 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/global_types.go @@ -0,0 +1,43 @@ +package v3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type Setting struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Value string `json:"value" norman:"required"` + Default string `json:"default" norman:"nocreate,noupdate"` + Customized bool `json:"customized" norman:"nocreate,noupdate"` +} + +type ListenConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + Mode string `json:"mode,omitempty" norman:"type=enum,options=https|http|acme"` + CACerts string `json:"caCerts,omitempty"` + CACert string `json:"caCert,omitempty"` + CAKey string `json:"caKey,omitempty"` + Cert string `json:"cert,omitempty"` + Key string `json:"key,omitempty" norman:"writeOnly"` + Domains []string `json:"domains,omitempty"` + TOS []string `json:"tos,omitempty" norman:"default=auto"` + KnownIPs []string `json:"knownIps" norman:"nocreate,noupdate"` + Enabled bool `json:"enabled,omitempty" norman:"default=true"` + + CertFingerprint string `json:"certFingerprint,omitempty" norman:"nocreate,noupdate"` + CN string `json:"cn,omitempty" norman:"nocreate,noupdate"` + Version int `json:"version,omitempty" norman:"nocreate,noupdate"` + ExpiresAt string `json:"expiresAt,omitempty" norman:"nocreate,noupdate"` + Issuer string `json:"issuer,omitempty" norman:"nocreate,noupdate"` + IssuedAt string `json:"issuedAt,omitempty" norman:"nocreate,noupdate"` + Algorithm string `json:"algorithm,omitempty" norman:"nocreate,noupdate"` + SerialNumber string `json:"serialNumber,omitempty" norman:"nocreate,noupdate"` + KeySize int `json:"keySize,omitempty" norman:"nocreate,noupdate"` + SubjectAlternativeNames []string `json:"subjectAlternativeNames,omitempty" norman:"nocreate,noupdate"` +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/logging_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/logging_types.go new file mode 100644 index 00000000..44de0a3b --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/logging_types.go @@ -0,0 +1,133 @@ +package v3 + +import ( + "github.com/rancher/norman/condition" + "github.com/rancher/norman/types" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type ClusterLogging struct { + types.Namespaced + + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of the desired behavior of the the cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Spec ClusterLoggingSpec `json:"spec"` + // Most recent observed status of the cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Status LoggingStatus `json:"status"` +} + +type ProjectLogging struct { + types.Namespaced + + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of the desired behavior of the the cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Spec ProjectLoggingSpec `json:"spec"` + // Most recent observed status of the cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Status LoggingStatus `json:"status"` +} + +type LoggingCommonSpec struct { + DisplayName string `json:"displayName,omitempty"` + + OutputFlushInterval int `json:"outputFlushInterval"` + OutputTags map[string]string `json:"outputTags"` + + ElasticsearchConfig *ElasticsearchConfig `json:"elasticsearchConfig,omitempty"` + SplunkConfig *SplunkConfig `json:"splunkConfig,omitempty"` + KafkaConfig *KafkaConfig `json:"kafkaConfig,omitempty"` + SyslogConfig *SyslogConfig `json:"syslogConfig,omitempty"` +} + +type ClusterLoggingSpec struct { + LoggingCommonSpec + ClusterName string `json:"clusterName" norman:"type=reference[cluster]"` + + EmbeddedConfig *EmbeddedConfig `json:"embeddedConfig,omitempty"` +} + +type ProjectLoggingSpec struct { + LoggingCommonSpec + + ProjectName string `json:"projectName" norman:"type=reference[project]"` +} + +type LoggingStatus struct { + Conditions []LoggingCondition `json:"conditions,omitempty"` +} + +var ( + ClusterLoggingConditionInitialized condition.Cond = "Initialized" + ClusterLoggingConditionProvisioned condition.Cond = "Provisioned" +) + +type LoggingCondition struct { + // Type of cluster condition. + Type condition.Cond `json:"type"` + // Status of the condition, one of True, False, Unknown. + Status v1.ConditionStatus `json:"status"` + // The last time this condition was updated. + LastUpdateTime string `json:"lastUpdateTime,omitempty"` + // Last time the condition transitioned from one status to another. + LastTransitionTime string `json:"lastTransitionTime,omitempty"` + // The reason for the condition's last transition. + Reason string `json:"reason,omitempty"` + // Human-readable message indicating details about last transition + Message string `json:"message,omitempty"` +} + +type ElasticsearchConfig struct { + Host string `json:"host,omitempty"` + Port int `json:"port,omitempty"` + IndexPrefix string `json:"indexPrefix,omitempty"` + DateFormat string `json:"dateFormat,omitempty"` + AuthUserName string `json:"authUsername,omitempty"` //secret + AuthPassword string `json:"authPassword,omitempty"` //secret +} + +type SplunkConfig struct { + Host string `json:"host,omitempty"` + Port int `json:"port,omitempty"` + Protocol string `json:"protocol,omitempty"` + Source string `json:"source,omitempty"` + Token string `json:"token,omitempty"` //secret +} + +type EmbeddedConfig struct { + IndexPrefix string `json:"indexPrefix,omitempty"` + DateFormat string `json:"dateFormat,omitempty"` +} + +type KafkaConfig struct { + Zookeeper *Zookeeper `json:"zookeeper,omitempty"` + Broker *BrokerList `json:"broker,omitempty"` + Topic string `json:"topic,omitempty"` + DataType string `json:"dataType,omitempty"` + MaxSendRetries int `json:"maxSendRetries,omitempty"` +} + +type Zookeeper struct { + Host string `json:"host,omitempty"` + Port int `json:"port,omitempty"` +} + +type BrokerList struct { + BrokerList []string `json:"brokerList,omitempty"` +} + +type SyslogConfig struct { + Host string `json:"host,omitempty"` + Port int `json:"port,omitempty"` + Severity string `json:"severity,omitempty"` + Program string `json:"program,omitempty"` +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/machine_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/machine_types.go index 1ac6eaab..220953d7 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/machine_types.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/machine_types.go @@ -72,6 +72,7 @@ type MachineStatus struct { NodeAnnotations map[string]string `json:"nodeAnnotations,omitempty"` NodeLabels map[string]string `json:"nodeLabels,omitempty"` Token string `json:"token"` + NodeTaints []v1.Taint `json:"nodeTaints,omitempty"` } var ( @@ -102,15 +103,29 @@ type MachineConfig struct { Annotations map[string]string `json:"annotations"` } +type CustomConfig struct { + // IP or FQDN that is fully resolvable and used for SSH communication + Address string `yaml:"address" json:"address,omitempty"` + // Optional - Internal address that will be used for components communication + InternalAddress string `yaml:"internal_address" json:"internalAddress,omitempty"` + // SSH user that will be used by RKE + User string `yaml:"user" json:"user,omitempty"` + // Optional - Docker socket on the node that will be used in tunneling + DockerSocket string `yaml:"docker_socket" json:"dockerSocket,omitempty"` + // SSH Private Key + SSHKey string `yaml:"ssh_key" json:"sshKey,omitempty"` +} + type MachineSpec struct { - NodeSpec v1.NodeSpec `json:"nodeSpec"` - Description string `json:"description,omitempty"` - DisplayName string `json:"displayName"` - RequestedHostname string `json:"requestedHostname,omitempty" norman:"noupdate"` - ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster],noupdate,required"` - Role []string `json:"role,omitempty" norman:"noupdate,type=array[enum],options=etcd|worker|controlplane"` - MachineTemplateName string `json:"machineTemplateName,omitempty" norman:"type=reference[machineTemplate],noupdate"` - UseInternalIPAddress bool `json:"useInternalIpAddress,omitempty" norman:"default=true,noupdate"` + NodeSpec v1.NodeSpec `json:"nodeSpec"` + CustomConfig *CustomConfig `json:"customConfig"` + Description string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + RequestedHostname string `json:"requestedHostname,omitempty" norman:"type=dnsLabel,nullable,noupdate"` + ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster],noupdate,required"` + Role []string `json:"role,omitempty" norman:"noupdate,type=array[enum],options=etcd|worker|controlplane"` + MachineTemplateName string `json:"machineTemplateName,omitempty" norman:"type=reference[machineTemplate],noupdate"` + UseInternalIPAddress bool `json:"useInternalIpAddress,omitempty" norman:"default=true,noupdate"` } type MachineCommonParams struct { diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/rke_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/rke_types.go index 92adc20f..6acd6974 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/rke_types.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/rke_types.go @@ -12,13 +12,49 @@ type RancherKubernetesEngineConfig struct { // YAML manifest for user provided addons to be deployed on the cluster Addons string `yaml:"addons" json:"addons,omitempty"` // List of images used internally for proxy, cert downlaod and kubedns - SystemImages map[string]string `yaml:"system_images" json:"systemImages,omitempty"` + SystemImages RKESystemImages `yaml:"system_images" json:"systemImages,omitempty"` // SSH Private Key Path SSHKeyPath string `yaml:"ssh_key_path" json:"sshKeyPath,omitempty"` // Authorization mode configuration used in the cluster Authorization AuthzConfig `yaml:"authorization" json:"authorization,omitempty"` // Enable/disable strict docker version checking IgnoreDockerVersion bool `yaml:"ignore_docker_version" json:"ignoreDockerVersion"` + // Kubernetes version to use (if kubernetes image is specifed, image version takes precedence) + Version string `yaml:"kubernetes_version" json:"kubernetesVersion,omitempty"` + // List of private registries and their credentials + PrivateRegistries []PrivateRegistry `yaml:"private_registries" json:"privateRegistries,omitempty"` +} + +type PrivateRegistry struct { + // URL for the registry + URL string `yaml:"url" json:"url,omitempty"` + // User name for registry acces + User string `yaml:"user" json:"user,omitempty"` + // Password for registry access + Password string `yaml:"password" json:"password,omitempty"` +} + +type RKESystemImages struct { + // etcd image + Etcd string `yaml:"etcd" json:"etcd,omitempty" norman:"default=quay.io/coreos/etcd:latest"` + // Alpine image + Alpine string `yaml:"alpine" json:"alpine,omitempty" norman:"default=alpine"` + // rke-nginx-proxy image + NginxProxy string `yaml:"nginx_proxy" json:"nginxProxy,omitempty" norman:"default=rancher/rke-nginx-proxy"` + // rke-cert-deployer image + CertDownloader string `yaml:"cert_downloader" json:"certDownloader,omitempty" norman:"default=rancher/rke-cert-deployer"` + // rke-service-sidekick image + KubernetesServicesSidecar string `yaml:"kubernetes_services_sidecar" json:"kubernetesServicesSidecar,omitempty" norman:"default=rancher/rke-kube-services-sidecar"` + // KubeDNS image + KubeDNS string `yaml:"kubedns" json:"kubedns,omitempty" norman:"default=gcr.io/google_containers/k8s-dns-kube-dns-amd64"` + // DNSMasq image + DNSmasq string `yaml:"dnsmasq" json:"dnsmasq,omitempty" norman:"default=gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64"` + // KubeDNS side car image + KubeDNSSidecar string `yaml:"kubedns_sidecar" json:"kubednsSidecar,omitempty" norman:"default=gcr.io/google_containers/k8s-dns-sidecar-amd64"` + // KubeDNS autoscaler image + KubeDNSAutoscaler string `yaml:"kubedns_autoscaler" json:"kubednsAutoscaler,omitempty" norman:"default=gcr.io/google_containers/cluster-proportional-autoscaler-amd64"` + // Kubernetes image + Kubernetes string `yaml:"kubernetes" json:"kubernetes,omitempty" norman:"default=rancher/k8s"` } type RKEConfigNode struct { diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_logging_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_logging_controller.go new file mode 100644 index 00000000..e5b6a115 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_logging_controller.go @@ -0,0 +1,252 @@ +package v3 + +import ( + "context" + + "github.com/rancher/norman/clientbase" + "github.com/rancher/norman/controller" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + ClusterLoggingGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "ClusterLogging", + } + ClusterLoggingResource = metav1.APIResource{ + Name: "clusterloggings", + SingularName: "clusterlogging", + Namespaced: true, + + Kind: ClusterLoggingGroupVersionKind.Kind, + } +) + +type ClusterLoggingList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterLogging +} + +type ClusterLoggingHandlerFunc func(key string, obj *ClusterLogging) error + +type ClusterLoggingLister interface { + List(namespace string, selector labels.Selector) (ret []*ClusterLogging, err error) + Get(namespace, name string) (*ClusterLogging, error) +} + +type ClusterLoggingController interface { + Informer() cache.SharedIndexInformer + Lister() ClusterLoggingLister + AddHandler(name string, handler ClusterLoggingHandlerFunc) + AddClusterScopedHandler(name, clusterName string, handler ClusterLoggingHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ClusterLoggingInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*ClusterLogging) (*ClusterLogging, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ClusterLogging, error) + Get(name string, opts metav1.GetOptions) (*ClusterLogging, error) + Update(*ClusterLogging) (*ClusterLogging, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ClusterLoggingList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ClusterLoggingController + AddHandler(name string, sync ClusterLoggingHandlerFunc) + AddLifecycle(name string, lifecycle ClusterLoggingLifecycle) + AddClusterScopedHandler(name, clusterName string, sync ClusterLoggingHandlerFunc) + AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterLoggingLifecycle) +} + +type clusterLoggingLister struct { + controller *clusterLoggingController +} + +func (l *clusterLoggingLister) List(namespace string, selector labels.Selector) (ret []*ClusterLogging, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*ClusterLogging)) + }) + return +} + +func (l *clusterLoggingLister) Get(namespace, name string) (*ClusterLogging, error) { + var key string + if namespace != "" { + key = namespace + "/" + name + } else { + key = name + } + obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schema.GroupResource{ + Group: ClusterLoggingGroupVersionKind.Group, + Resource: "clusterLogging", + }, name) + } + return obj.(*ClusterLogging), nil +} + +type clusterLoggingController struct { + controller.GenericController +} + +func (c *clusterLoggingController) Lister() ClusterLoggingLister { + return &clusterLoggingLister{ + controller: c, + } +} + +func (c *clusterLoggingController) AddHandler(name string, handler ClusterLoggingHandlerFunc) { + c.GenericController.AddHandler(name, func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + return handler(key, obj.(*ClusterLogging)) + }) +} + +func (c *clusterLoggingController) AddClusterScopedHandler(name, cluster string, handler ClusterLoggingHandlerFunc) { + c.GenericController.AddHandler(name, func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + + if !controller.ObjectInCluster(cluster, obj) { + return nil + } + + return handler(key, obj.(*ClusterLogging)) + }) +} + +type clusterLoggingFactory struct { +} + +func (c clusterLoggingFactory) Object() runtime.Object { + return &ClusterLogging{} +} + +func (c clusterLoggingFactory) List() runtime.Object { + return &ClusterLoggingList{} +} + +func (s *clusterLoggingClient) Controller() ClusterLoggingController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.clusterLoggingControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ClusterLoggingGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &clusterLoggingController{ + GenericController: genericController, + } + + s.client.clusterLoggingControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type clusterLoggingClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller ClusterLoggingController +} + +func (s *clusterLoggingClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *clusterLoggingClient) Create(o *ClusterLogging) (*ClusterLogging, error) { + obj, err := s.objectClient.Create(o) + return obj.(*ClusterLogging), err +} + +func (s *clusterLoggingClient) Get(name string, opts metav1.GetOptions) (*ClusterLogging, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*ClusterLogging), err +} + +func (s *clusterLoggingClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ClusterLogging, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*ClusterLogging), err +} + +func (s *clusterLoggingClient) Update(o *ClusterLogging) (*ClusterLogging, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*ClusterLogging), err +} + +func (s *clusterLoggingClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *clusterLoggingClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *clusterLoggingClient) List(opts metav1.ListOptions) (*ClusterLoggingList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ClusterLoggingList), err +} + +func (s *clusterLoggingClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *clusterLoggingClient) Patch(o *ClusterLogging, data []byte, subresources ...string) (*ClusterLogging, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*ClusterLogging), err +} + +func (s *clusterLoggingClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *clusterLoggingClient) AddHandler(name string, sync ClusterLoggingHandlerFunc) { + s.Controller().AddHandler(name, sync) +} + +func (s *clusterLoggingClient) AddLifecycle(name string, lifecycle ClusterLoggingLifecycle) { + sync := NewClusterLoggingLifecycleAdapter(name, false, s, lifecycle) + s.AddHandler(name, sync) +} + +func (s *clusterLoggingClient) AddClusterScopedHandler(name, clusterName string, sync ClusterLoggingHandlerFunc) { + s.Controller().AddClusterScopedHandler(name, clusterName, sync) +} + +func (s *clusterLoggingClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterLoggingLifecycle) { + sync := NewClusterLoggingLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.AddClusterScopedHandler(name, clusterName, sync) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_logging_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_logging_lifecycle_adapter.go new file mode 100644 index 00000000..7934ff70 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_logging_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ClusterLoggingLifecycle interface { + Create(obj *ClusterLogging) (*ClusterLogging, error) + Remove(obj *ClusterLogging) (*ClusterLogging, error) + Updated(obj *ClusterLogging) (*ClusterLogging, error) +} + +type clusterLoggingLifecycleAdapter struct { + lifecycle ClusterLoggingLifecycle +} + +func (w *clusterLoggingLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ClusterLogging)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterLoggingLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ClusterLogging)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterLoggingLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ClusterLogging)) + if o == nil { + return nil, err + } + return o, err +} + +func NewClusterLoggingLifecycleAdapter(name string, clusterScoped bool, client ClusterLoggingInterface, l ClusterLoggingLifecycle) ClusterLoggingHandlerFunc { + adapter := &clusterLoggingLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *ClusterLogging) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_deepcopy.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_deepcopy.go index 3298f0c2..d400a7d2 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_deepcopy.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_deepcopy.go @@ -39,6 +39,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*BaseService).DeepCopyInto(out.(*BaseService)) return nil }, InType: reflect.TypeOf(&BaseService{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*BrokerList).DeepCopyInto(out.(*BrokerList)) + return nil + }, InType: reflect.TypeOf(&BrokerList{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*Catalog).DeepCopyInto(out.(*Catalog)) return nil @@ -83,6 +87,18 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*ClusterList).DeepCopyInto(out.(*ClusterList)) return nil }, InType: reflect.TypeOf(&ClusterList{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ClusterLogging).DeepCopyInto(out.(*ClusterLogging)) + return nil + }, InType: reflect.TypeOf(&ClusterLogging{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ClusterLoggingList).DeepCopyInto(out.(*ClusterLoggingList)) + return nil + }, InType: reflect.TypeOf(&ClusterLoggingList{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ClusterLoggingSpec).DeepCopyInto(out.(*ClusterLoggingSpec)) + return nil + }, InType: reflect.TypeOf(&ClusterLoggingSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*ClusterRegistrationToken).DeepCopyInto(out.(*ClusterRegistrationToken)) return nil @@ -115,6 +131,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*ClusterStatus).DeepCopyInto(out.(*ClusterStatus)) return nil }, InType: reflect.TypeOf(&ClusterStatus{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*CustomConfig).DeepCopyInto(out.(*CustomConfig)) + return nil + }, InType: reflect.TypeOf(&CustomConfig{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*DynamicSchema).DeepCopyInto(out.(*DynamicSchema)) return nil @@ -135,6 +155,14 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*ETCDService).DeepCopyInto(out.(*ETCDService)) return nil }, InType: reflect.TypeOf(&ETCDService{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ElasticsearchConfig).DeepCopyInto(out.(*ElasticsearchConfig)) + return nil + }, InType: reflect.TypeOf(&ElasticsearchConfig{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*EmbeddedConfig).DeepCopyInto(out.(*EmbeddedConfig)) + return nil + }, InType: reflect.TypeOf(&EmbeddedConfig{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*Field).DeepCopyInto(out.(*Field)) return nil @@ -187,10 +215,18 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*GroupMemberList).DeepCopyInto(out.(*GroupMemberList)) return nil }, InType: reflect.TypeOf(&GroupMemberList{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ImportedConfig).DeepCopyInto(out.(*ImportedConfig)) + return nil + }, InType: reflect.TypeOf(&ImportedConfig{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*K8sServerConfig).DeepCopyInto(out.(*K8sServerConfig)) return nil }, InType: reflect.TypeOf(&K8sServerConfig{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*KafkaConfig).DeepCopyInto(out.(*KafkaConfig)) + return nil + }, InType: reflect.TypeOf(&KafkaConfig{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*KubeAPIService).DeepCopyInto(out.(*KubeAPIService)) return nil @@ -211,10 +247,30 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*ListOpts).DeepCopyInto(out.(*ListOpts)) return nil }, InType: reflect.TypeOf(&ListOpts{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ListenConfig).DeepCopyInto(out.(*ListenConfig)) + return nil + }, InType: reflect.TypeOf(&ListenConfig{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ListenConfigList).DeepCopyInto(out.(*ListenConfigList)) + return nil + }, InType: reflect.TypeOf(&ListenConfigList{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*LocalCredential).DeepCopyInto(out.(*LocalCredential)) return nil }, InType: reflect.TypeOf(&LocalCredential{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*LoggingCommonSpec).DeepCopyInto(out.(*LoggingCommonSpec)) + return nil + }, InType: reflect.TypeOf(&LoggingCommonSpec{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*LoggingCondition).DeepCopyInto(out.(*LoggingCondition)) + return nil + }, InType: reflect.TypeOf(&LoggingCondition{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*LoggingStatus).DeepCopyInto(out.(*LoggingStatus)) + return nil + }, InType: reflect.TypeOf(&LoggingStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*LoginInput).DeepCopyInto(out.(*LoginInput)) return nil @@ -315,6 +371,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*PrincipalList).DeepCopyInto(out.(*PrincipalList)) return nil }, InType: reflect.TypeOf(&PrincipalList{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*PrivateRegistry).DeepCopyInto(out.(*PrivateRegistry)) + return nil + }, InType: reflect.TypeOf(&PrivateRegistry{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*Project).DeepCopyInto(out.(*Project)) return nil @@ -327,6 +387,18 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*ProjectList).DeepCopyInto(out.(*ProjectList)) return nil }, InType: reflect.TypeOf(&ProjectList{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ProjectLogging).DeepCopyInto(out.(*ProjectLogging)) + return nil + }, InType: reflect.TypeOf(&ProjectLogging{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ProjectLoggingList).DeepCopyInto(out.(*ProjectLoggingList)) + return nil + }, InType: reflect.TypeOf(&ProjectLoggingList{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ProjectLoggingSpec).DeepCopyInto(out.(*ProjectLoggingSpec)) + return nil + }, InType: reflect.TypeOf(&ProjectLoggingSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*ProjectRoleTemplateBinding).DeepCopyInto(out.(*ProjectRoleTemplateBinding)) return nil @@ -355,6 +427,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*RKEConfigServices).DeepCopyInto(out.(*RKEConfigServices)) return nil }, InType: reflect.TypeOf(&RKEConfigServices{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*RKESystemImages).DeepCopyInto(out.(*RKESystemImages)) + return nil + }, InType: reflect.TypeOf(&RKESystemImages{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*RancherKubernetesEngineConfig).DeepCopyInto(out.(*RancherKubernetesEngineConfig)) return nil @@ -379,6 +455,18 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*SetPasswordInput).DeepCopyInto(out.(*SetPasswordInput)) return nil }, InType: reflect.TypeOf(&SetPasswordInput{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*Setting).DeepCopyInto(out.(*Setting)) + return nil + }, InType: reflect.TypeOf(&Setting{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*SettingList).DeepCopyInto(out.(*SettingList)) + return nil + }, InType: reflect.TypeOf(&SettingList{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*SplunkConfig).DeepCopyInto(out.(*SplunkConfig)) + return nil + }, InType: reflect.TypeOf(&SplunkConfig{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*Stack).DeepCopyInto(out.(*Stack)) return nil @@ -395,6 +483,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*StackStatus).DeepCopyInto(out.(*StackStatus)) return nil }, InType: reflect.TypeOf(&StackStatus{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*SyslogConfig).DeepCopyInto(out.(*SyslogConfig)) + return nil + }, InType: reflect.TypeOf(&SyslogConfig{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*Template).DeepCopyInto(out.(*Template)) return nil @@ -447,6 +539,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*Values).DeepCopyInto(out.(*Values)) return nil }, InType: reflect.TypeOf(&Values{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*Zookeeper).DeepCopyInto(out.(*Zookeeper)) + return nil + }, InType: reflect.TypeOf(&Zookeeper{})}, ) } @@ -551,6 +647,27 @@ func (in *BaseService) DeepCopy() *BaseService { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BrokerList) DeepCopyInto(out *BrokerList) { + *out = *in + if in.BrokerList != nil { + in, out := &in.BrokerList, &out.BrokerList + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BrokerList. +func (in *BrokerList) DeepCopy() *BrokerList { + if in == nil { + return nil + } + out := new(BrokerList) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Catalog) DeepCopyInto(out *Catalog) { *out = *in @@ -823,6 +940,96 @@ func (in *ClusterList) DeepCopyObject() runtime.Object { } } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterLogging) DeepCopyInto(out *ClusterLogging) { + *out = *in + out.Namespaced = in.Namespaced + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterLogging. +func (in *ClusterLogging) DeepCopy() *ClusterLogging { + if in == nil { + return nil + } + out := new(ClusterLogging) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterLogging) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterLoggingList) DeepCopyInto(out *ClusterLoggingList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterLogging, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterLoggingList. +func (in *ClusterLoggingList) DeepCopy() *ClusterLoggingList { + if in == nil { + return nil + } + out := new(ClusterLoggingList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterLoggingList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterLoggingSpec) DeepCopyInto(out *ClusterLoggingSpec) { + *out = *in + in.LoggingCommonSpec.DeepCopyInto(&out.LoggingCommonSpec) + if in.EmbeddedConfig != nil { + in, out := &in.EmbeddedConfig, &out.EmbeddedConfig + if *in == nil { + *out = nil + } else { + *out = new(EmbeddedConfig) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterLoggingSpec. +func (in *ClusterLoggingSpec) DeepCopy() *ClusterLoggingSpec { + if in == nil { + return nil + } + out := new(ClusterLoggingSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterRegistrationToken) DeepCopyInto(out *ClusterRegistrationToken) { *out = *in @@ -925,7 +1132,6 @@ func (in *ClusterRoleTemplateBinding) DeepCopyInto(out *ClusterRoleTemplateBindi out.Namespaced = in.Namespaced out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Subject = in.Subject return } @@ -992,6 +1198,15 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.ImportedConfig != nil { + in, out := &in.ImportedConfig, &out.ImportedConfig + if *in == nil { + *out = nil + } else { + *out = new(ImportedConfig) + **out = **in + } + } if in.EmbeddedConfig != nil { in, out := &in.EmbeddedConfig, &out.EmbeddedConfig if *in == nil { @@ -1098,6 +1313,22 @@ func (in *ClusterStatus) DeepCopy() *ClusterStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomConfig) DeepCopyInto(out *CustomConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomConfig. +func (in *CustomConfig) DeepCopy() *CustomConfig { + if in == nil { + return nil + } + out := new(CustomConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DynamicSchema) DeepCopyInto(out *DynamicSchema) { *out = *in @@ -1260,6 +1491,38 @@ func (in *ETCDService) DeepCopy() *ETCDService { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ElasticsearchConfig) DeepCopyInto(out *ElasticsearchConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchConfig. +func (in *ElasticsearchConfig) DeepCopy() *ElasticsearchConfig { + if in == nil { + return nil + } + out := new(ElasticsearchConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EmbeddedConfig) DeepCopyInto(out *EmbeddedConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmbeddedConfig. +func (in *EmbeddedConfig) DeepCopy() *EmbeddedConfig { + if in == nil { + return nil + } + out := new(EmbeddedConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Field) DeepCopyInto(out *Field) { *out = *in @@ -1374,7 +1637,6 @@ func (in *GlobalRoleBinding) DeepCopyInto(out *GlobalRoleBinding) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Subject = in.Subject return } @@ -1615,6 +1877,22 @@ func (in *GroupMemberList) DeepCopyObject() runtime.Object { } } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImportedConfig) DeepCopyInto(out *ImportedConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportedConfig. +func (in *ImportedConfig) DeepCopy() *ImportedConfig { + if in == nil { + return nil + } + out := new(ImportedConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *K8sServerConfig) DeepCopyInto(out *K8sServerConfig) { *out = *in @@ -1636,6 +1914,40 @@ func (in *K8sServerConfig) DeepCopy() *K8sServerConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KafkaConfig) DeepCopyInto(out *KafkaConfig) { + *out = *in + if in.Zookeeper != nil { + in, out := &in.Zookeeper, &out.Zookeeper + if *in == nil { + *out = nil + } else { + *out = new(Zookeeper) + **out = **in + } + } + if in.Broker != nil { + in, out := &in.Broker, &out.Broker + if *in == nil { + *out = nil + } else { + *out = new(BrokerList) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KafkaConfig. +func (in *KafkaConfig) DeepCopy() *KafkaConfig { + if in == nil { + return nil + } + out := new(KafkaConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KubeAPIService) DeepCopyInto(out *KubeAPIService) { *out = *in @@ -1727,6 +2039,87 @@ func (in *ListOpts) DeepCopy() *ListOpts { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ListenConfig) DeepCopyInto(out *ListenConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Domains != nil { + in, out := &in.Domains, &out.Domains + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.TOS != nil { + in, out := &in.TOS, &out.TOS + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.KnownIPs != nil { + in, out := &in.KnownIPs, &out.KnownIPs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.SubjectAlternativeNames != nil { + in, out := &in.SubjectAlternativeNames, &out.SubjectAlternativeNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListenConfig. +func (in *ListenConfig) DeepCopy() *ListenConfig { + if in == nil { + return nil + } + out := new(ListenConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ListenConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ListenConfigList) DeepCopyInto(out *ListenConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ListenConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListenConfigList. +func (in *ListenConfigList) DeepCopy() *ListenConfigList { + if in == nil { + return nil + } + out := new(ListenConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ListenConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LocalCredential) DeepCopyInto(out *LocalCredential) { *out = *in @@ -1743,6 +2136,102 @@ func (in *LocalCredential) DeepCopy() *LocalCredential { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoggingCommonSpec) DeepCopyInto(out *LoggingCommonSpec) { + *out = *in + if in.OutputTags != nil { + in, out := &in.OutputTags, &out.OutputTags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.ElasticsearchConfig != nil { + in, out := &in.ElasticsearchConfig, &out.ElasticsearchConfig + if *in == nil { + *out = nil + } else { + *out = new(ElasticsearchConfig) + **out = **in + } + } + if in.SplunkConfig != nil { + in, out := &in.SplunkConfig, &out.SplunkConfig + if *in == nil { + *out = nil + } else { + *out = new(SplunkConfig) + **out = **in + } + } + if in.KafkaConfig != nil { + in, out := &in.KafkaConfig, &out.KafkaConfig + if *in == nil { + *out = nil + } else { + *out = new(KafkaConfig) + (*in).DeepCopyInto(*out) + } + } + if in.SyslogConfig != nil { + in, out := &in.SyslogConfig, &out.SyslogConfig + if *in == nil { + *out = nil + } else { + *out = new(SyslogConfig) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoggingCommonSpec. +func (in *LoggingCommonSpec) DeepCopy() *LoggingCommonSpec { + if in == nil { + return nil + } + out := new(LoggingCommonSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoggingCondition) DeepCopyInto(out *LoggingCondition) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoggingCondition. +func (in *LoggingCondition) DeepCopy() *LoggingCondition { + if in == nil { + return nil + } + out := new(LoggingCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoggingStatus) DeepCopyInto(out *LoggingStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]LoggingCondition, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoggingStatus. +func (in *LoggingStatus) DeepCopy() *LoggingStatus { + if in == nil { + return nil + } + out := new(LoggingStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LoginInput) DeepCopyInto(out *LoginInput) { *out = *in @@ -2039,6 +2528,15 @@ func (in *MachineList) DeepCopyObject() runtime.Object { func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { *out = *in in.NodeSpec.DeepCopyInto(&out.NodeSpec) + if in.CustomConfig != nil { + in, out := &in.CustomConfig, &out.CustomConfig + if *in == nil { + *out = nil + } else { + *out = new(CustomConfig) + **out = **in + } + } if in.Role != nil { in, out := &in.Role, &out.Role *out = make([]string, len(*in)) @@ -2112,6 +2610,13 @@ func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { (*out)[key] = val } } + if in.NodeTaints != nil { + in, out := &in.NodeTaints, &out.NodeTaints + *out = make([]v1.Taint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -2457,6 +2962,22 @@ func (in *PrincipalList) DeepCopyObject() runtime.Object { } } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrivateRegistry) DeepCopyInto(out *PrivateRegistry) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrivateRegistry. +func (in *PrivateRegistry) DeepCopy() *PrivateRegistry { + if in == nil { + return nil + } + out := new(PrivateRegistry) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Project) DeepCopyInto(out *Project) { *out = *in @@ -2537,13 +3058,93 @@ func (in *ProjectList) DeepCopyObject() runtime.Object { } } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectLogging) DeepCopyInto(out *ProjectLogging) { + *out = *in + out.Namespaced = in.Namespaced + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectLogging. +func (in *ProjectLogging) DeepCopy() *ProjectLogging { + if in == nil { + return nil + } + out := new(ProjectLogging) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectLogging) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectLoggingList) DeepCopyInto(out *ProjectLoggingList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ProjectLogging, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectLoggingList. +func (in *ProjectLoggingList) DeepCopy() *ProjectLoggingList { + if in == nil { + return nil + } + out := new(ProjectLoggingList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectLoggingList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectLoggingSpec) DeepCopyInto(out *ProjectLoggingSpec) { + *out = *in + in.LoggingCommonSpec.DeepCopyInto(&out.LoggingCommonSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectLoggingSpec. +func (in *ProjectLoggingSpec) DeepCopy() *ProjectLoggingSpec { + if in == nil { + return nil + } + out := new(ProjectLoggingSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ProjectRoleTemplateBinding) DeepCopyInto(out *ProjectRoleTemplateBinding) { *out = *in out.Namespaced = in.Namespaced out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Subject = in.Subject return } @@ -2701,6 +3302,22 @@ func (in *RKEConfigServices) DeepCopy() *RKEConfigServices { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RKESystemImages) DeepCopyInto(out *RKESystemImages) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RKESystemImages. +func (in *RKESystemImages) DeepCopy() *RKESystemImages { + if in == nil { + return nil + } + out := new(RKESystemImages) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RancherKubernetesEngineConfig) DeepCopyInto(out *RancherKubernetesEngineConfig) { *out = *in @@ -2714,14 +3331,13 @@ func (in *RancherKubernetesEngineConfig) DeepCopyInto(out *RancherKubernetesEngi in.Services.DeepCopyInto(&out.Services) in.Network.DeepCopyInto(&out.Network) in.Authentication.DeepCopyInto(&out.Authentication) - if in.SystemImages != nil { - in, out := &in.SystemImages, &out.SystemImages - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } + out.SystemImages = in.SystemImages in.Authorization.DeepCopyInto(&out.Authorization) + if in.PrivateRegistries != nil { + in, out := &in.PrivateRegistries, &out.PrivateRegistries + *out = make([]PrivateRegistry, len(*in)) + copy(*out, *in) + } return } @@ -2857,6 +3473,83 @@ func (in *SetPasswordInput) DeepCopy() *SetPasswordInput { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Setting) DeepCopyInto(out *Setting) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Setting. +func (in *Setting) DeepCopy() *Setting { + if in == nil { + return nil + } + out := new(Setting) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Setting) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SettingList) DeepCopyInto(out *SettingList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Setting, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SettingList. +func (in *SettingList) DeepCopy() *SettingList { + if in == nil { + return nil + } + out := new(SettingList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SettingList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SplunkConfig) DeepCopyInto(out *SplunkConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SplunkConfig. +func (in *SplunkConfig) DeepCopy() *SplunkConfig { + if in == nil { + return nil + } + out := new(SplunkConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Stack) DeepCopyInto(out *Stack) { *out = *in @@ -2984,6 +3677,22 @@ func (in *StackStatus) DeepCopy() *StackStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SyslogConfig) DeepCopyInto(out *SyslogConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyslogConfig. +func (in *SyslogConfig) DeepCopy() *SyslogConfig { + if in == nil { + return nil + } + out := new(SyslogConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Template) DeepCopyInto(out *Template) { *out = *in @@ -3376,3 +4085,19 @@ func (in *Values) DeepCopy() *Values { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Zookeeper) DeepCopyInto(out *Zookeeper) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Zookeeper. +func (in *Zookeeper) DeepCopy() *Zookeeper { + if in == nil { + return nil + } + out := new(Zookeeper) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_k8s_client.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_k8s_client.go index 8cae1279..9f9e1e56 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_k8s_client.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_k8s_client.go @@ -38,6 +38,10 @@ type Interface interface { DynamicSchemasGetter StacksGetter PreferencesGetter + ClusterLoggingsGetter + ProjectLoggingsGetter + ListenConfigsGetter + SettingsGetter } type Client struct { @@ -69,6 +73,10 @@ type Client struct { dynamicSchemaControllers map[string]DynamicSchemaController stackControllers map[string]StackController preferenceControllers map[string]PreferenceController + clusterLoggingControllers map[string]ClusterLoggingController + projectLoggingControllers map[string]ProjectLoggingController + listenConfigControllers map[string]ListenConfigController + settingControllers map[string]SettingController } func NewForConfig(config rest.Config) (Interface, error) { @@ -109,6 +117,10 @@ func NewForConfig(config rest.Config) (Interface, error) { dynamicSchemaControllers: map[string]DynamicSchemaController{}, stackControllers: map[string]StackController{}, preferenceControllers: map[string]PreferenceController{}, + clusterLoggingControllers: map[string]ClusterLoggingController{}, + projectLoggingControllers: map[string]ProjectLoggingController{}, + listenConfigControllers: map[string]ListenConfigController{}, + settingControllers: map[string]SettingController{}, }, nil } @@ -435,3 +447,55 @@ func (c *Client) Preferences(namespace string) PreferenceInterface { objectClient: objectClient, } } + +type ClusterLoggingsGetter interface { + ClusterLoggings(namespace string) ClusterLoggingInterface +} + +func (c *Client) ClusterLoggings(namespace string) ClusterLoggingInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ClusterLoggingResource, ClusterLoggingGroupVersionKind, clusterLoggingFactory{}) + return &clusterLoggingClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type ProjectLoggingsGetter interface { + ProjectLoggings(namespace string) ProjectLoggingInterface +} + +func (c *Client) ProjectLoggings(namespace string) ProjectLoggingInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ProjectLoggingResource, ProjectLoggingGroupVersionKind, projectLoggingFactory{}) + return &projectLoggingClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type ListenConfigsGetter interface { + ListenConfigs(namespace string) ListenConfigInterface +} + +func (c *Client) ListenConfigs(namespace string) ListenConfigInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ListenConfigResource, ListenConfigGroupVersionKind, listenConfigFactory{}) + return &listenConfigClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type SettingsGetter interface { + Settings(namespace string) SettingInterface +} + +func (c *Client) Settings(namespace string) SettingInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &SettingResource, SettingGroupVersionKind, settingFactory{}) + return &settingClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_listen_config_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_listen_config_controller.go new file mode 100644 index 00000000..5dfad4a1 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_listen_config_controller.go @@ -0,0 +1,251 @@ +package v3 + +import ( + "context" + + "github.com/rancher/norman/clientbase" + "github.com/rancher/norman/controller" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + ListenConfigGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "ListenConfig", + } + ListenConfigResource = metav1.APIResource{ + Name: "listenconfigs", + SingularName: "listenconfig", + Namespaced: false, + Kind: ListenConfigGroupVersionKind.Kind, + } +) + +type ListenConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ListenConfig +} + +type ListenConfigHandlerFunc func(key string, obj *ListenConfig) error + +type ListenConfigLister interface { + List(namespace string, selector labels.Selector) (ret []*ListenConfig, err error) + Get(namespace, name string) (*ListenConfig, error) +} + +type ListenConfigController interface { + Informer() cache.SharedIndexInformer + Lister() ListenConfigLister + AddHandler(name string, handler ListenConfigHandlerFunc) + AddClusterScopedHandler(name, clusterName string, handler ListenConfigHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ListenConfigInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*ListenConfig) (*ListenConfig, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ListenConfig, error) + Get(name string, opts metav1.GetOptions) (*ListenConfig, error) + Update(*ListenConfig) (*ListenConfig, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ListenConfigList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ListenConfigController + AddHandler(name string, sync ListenConfigHandlerFunc) + AddLifecycle(name string, lifecycle ListenConfigLifecycle) + AddClusterScopedHandler(name, clusterName string, sync ListenConfigHandlerFunc) + AddClusterScopedLifecycle(name, clusterName string, lifecycle ListenConfigLifecycle) +} + +type listenConfigLister struct { + controller *listenConfigController +} + +func (l *listenConfigLister) List(namespace string, selector labels.Selector) (ret []*ListenConfig, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*ListenConfig)) + }) + return +} + +func (l *listenConfigLister) Get(namespace, name string) (*ListenConfig, error) { + var key string + if namespace != "" { + key = namespace + "/" + name + } else { + key = name + } + obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schema.GroupResource{ + Group: ListenConfigGroupVersionKind.Group, + Resource: "listenConfig", + }, name) + } + return obj.(*ListenConfig), nil +} + +type listenConfigController struct { + controller.GenericController +} + +func (c *listenConfigController) Lister() ListenConfigLister { + return &listenConfigLister{ + controller: c, + } +} + +func (c *listenConfigController) AddHandler(name string, handler ListenConfigHandlerFunc) { + c.GenericController.AddHandler(name, func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + return handler(key, obj.(*ListenConfig)) + }) +} + +func (c *listenConfigController) AddClusterScopedHandler(name, cluster string, handler ListenConfigHandlerFunc) { + c.GenericController.AddHandler(name, func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + + if !controller.ObjectInCluster(cluster, obj) { + return nil + } + + return handler(key, obj.(*ListenConfig)) + }) +} + +type listenConfigFactory struct { +} + +func (c listenConfigFactory) Object() runtime.Object { + return &ListenConfig{} +} + +func (c listenConfigFactory) List() runtime.Object { + return &ListenConfigList{} +} + +func (s *listenConfigClient) Controller() ListenConfigController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.listenConfigControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ListenConfigGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &listenConfigController{ + GenericController: genericController, + } + + s.client.listenConfigControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type listenConfigClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller ListenConfigController +} + +func (s *listenConfigClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *listenConfigClient) Create(o *ListenConfig) (*ListenConfig, error) { + obj, err := s.objectClient.Create(o) + return obj.(*ListenConfig), err +} + +func (s *listenConfigClient) Get(name string, opts metav1.GetOptions) (*ListenConfig, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*ListenConfig), err +} + +func (s *listenConfigClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ListenConfig, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*ListenConfig), err +} + +func (s *listenConfigClient) Update(o *ListenConfig) (*ListenConfig, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*ListenConfig), err +} + +func (s *listenConfigClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *listenConfigClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *listenConfigClient) List(opts metav1.ListOptions) (*ListenConfigList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ListenConfigList), err +} + +func (s *listenConfigClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *listenConfigClient) Patch(o *ListenConfig, data []byte, subresources ...string) (*ListenConfig, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*ListenConfig), err +} + +func (s *listenConfigClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *listenConfigClient) AddHandler(name string, sync ListenConfigHandlerFunc) { + s.Controller().AddHandler(name, sync) +} + +func (s *listenConfigClient) AddLifecycle(name string, lifecycle ListenConfigLifecycle) { + sync := NewListenConfigLifecycleAdapter(name, false, s, lifecycle) + s.AddHandler(name, sync) +} + +func (s *listenConfigClient) AddClusterScopedHandler(name, clusterName string, sync ListenConfigHandlerFunc) { + s.Controller().AddClusterScopedHandler(name, clusterName, sync) +} + +func (s *listenConfigClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ListenConfigLifecycle) { + sync := NewListenConfigLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.AddClusterScopedHandler(name, clusterName, sync) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_listen_config_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_listen_config_lifecycle_adapter.go new file mode 100644 index 00000000..eb7dcff2 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_listen_config_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ListenConfigLifecycle interface { + Create(obj *ListenConfig) (*ListenConfig, error) + Remove(obj *ListenConfig) (*ListenConfig, error) + Updated(obj *ListenConfig) (*ListenConfig, error) +} + +type listenConfigLifecycleAdapter struct { + lifecycle ListenConfigLifecycle +} + +func (w *listenConfigLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ListenConfig)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *listenConfigLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ListenConfig)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *listenConfigLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ListenConfig)) + if o == nil { + return nil, err + } + return o, err +} + +func NewListenConfigLifecycleAdapter(name string, clusterScoped bool, client ListenConfigInterface, l ListenConfigLifecycle) ListenConfigHandlerFunc { + adapter := &listenConfigLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *ListenConfig) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_logging_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_logging_controller.go new file mode 100644 index 00000000..768f5067 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_logging_controller.go @@ -0,0 +1,252 @@ +package v3 + +import ( + "context" + + "github.com/rancher/norman/clientbase" + "github.com/rancher/norman/controller" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + ProjectLoggingGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "ProjectLogging", + } + ProjectLoggingResource = metav1.APIResource{ + Name: "projectloggings", + SingularName: "projectlogging", + Namespaced: true, + + Kind: ProjectLoggingGroupVersionKind.Kind, + } +) + +type ProjectLoggingList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ProjectLogging +} + +type ProjectLoggingHandlerFunc func(key string, obj *ProjectLogging) error + +type ProjectLoggingLister interface { + List(namespace string, selector labels.Selector) (ret []*ProjectLogging, err error) + Get(namespace, name string) (*ProjectLogging, error) +} + +type ProjectLoggingController interface { + Informer() cache.SharedIndexInformer + Lister() ProjectLoggingLister + AddHandler(name string, handler ProjectLoggingHandlerFunc) + AddClusterScopedHandler(name, clusterName string, handler ProjectLoggingHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ProjectLoggingInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*ProjectLogging) (*ProjectLogging, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ProjectLogging, error) + Get(name string, opts metav1.GetOptions) (*ProjectLogging, error) + Update(*ProjectLogging) (*ProjectLogging, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ProjectLoggingList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ProjectLoggingController + AddHandler(name string, sync ProjectLoggingHandlerFunc) + AddLifecycle(name string, lifecycle ProjectLoggingLifecycle) + AddClusterScopedHandler(name, clusterName string, sync ProjectLoggingHandlerFunc) + AddClusterScopedLifecycle(name, clusterName string, lifecycle ProjectLoggingLifecycle) +} + +type projectLoggingLister struct { + controller *projectLoggingController +} + +func (l *projectLoggingLister) List(namespace string, selector labels.Selector) (ret []*ProjectLogging, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*ProjectLogging)) + }) + return +} + +func (l *projectLoggingLister) Get(namespace, name string) (*ProjectLogging, error) { + var key string + if namespace != "" { + key = namespace + "/" + name + } else { + key = name + } + obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schema.GroupResource{ + Group: ProjectLoggingGroupVersionKind.Group, + Resource: "projectLogging", + }, name) + } + return obj.(*ProjectLogging), nil +} + +type projectLoggingController struct { + controller.GenericController +} + +func (c *projectLoggingController) Lister() ProjectLoggingLister { + return &projectLoggingLister{ + controller: c, + } +} + +func (c *projectLoggingController) AddHandler(name string, handler ProjectLoggingHandlerFunc) { + c.GenericController.AddHandler(name, func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + return handler(key, obj.(*ProjectLogging)) + }) +} + +func (c *projectLoggingController) AddClusterScopedHandler(name, cluster string, handler ProjectLoggingHandlerFunc) { + c.GenericController.AddHandler(name, func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + + if !controller.ObjectInCluster(cluster, obj) { + return nil + } + + return handler(key, obj.(*ProjectLogging)) + }) +} + +type projectLoggingFactory struct { +} + +func (c projectLoggingFactory) Object() runtime.Object { + return &ProjectLogging{} +} + +func (c projectLoggingFactory) List() runtime.Object { + return &ProjectLoggingList{} +} + +func (s *projectLoggingClient) Controller() ProjectLoggingController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.projectLoggingControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ProjectLoggingGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &projectLoggingController{ + GenericController: genericController, + } + + s.client.projectLoggingControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type projectLoggingClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller ProjectLoggingController +} + +func (s *projectLoggingClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *projectLoggingClient) Create(o *ProjectLogging) (*ProjectLogging, error) { + obj, err := s.objectClient.Create(o) + return obj.(*ProjectLogging), err +} + +func (s *projectLoggingClient) Get(name string, opts metav1.GetOptions) (*ProjectLogging, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*ProjectLogging), err +} + +func (s *projectLoggingClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ProjectLogging, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*ProjectLogging), err +} + +func (s *projectLoggingClient) Update(o *ProjectLogging) (*ProjectLogging, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*ProjectLogging), err +} + +func (s *projectLoggingClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *projectLoggingClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *projectLoggingClient) List(opts metav1.ListOptions) (*ProjectLoggingList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ProjectLoggingList), err +} + +func (s *projectLoggingClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *projectLoggingClient) Patch(o *ProjectLogging, data []byte, subresources ...string) (*ProjectLogging, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*ProjectLogging), err +} + +func (s *projectLoggingClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *projectLoggingClient) AddHandler(name string, sync ProjectLoggingHandlerFunc) { + s.Controller().AddHandler(name, sync) +} + +func (s *projectLoggingClient) AddLifecycle(name string, lifecycle ProjectLoggingLifecycle) { + sync := NewProjectLoggingLifecycleAdapter(name, false, s, lifecycle) + s.AddHandler(name, sync) +} + +func (s *projectLoggingClient) AddClusterScopedHandler(name, clusterName string, sync ProjectLoggingHandlerFunc) { + s.Controller().AddClusterScopedHandler(name, clusterName, sync) +} + +func (s *projectLoggingClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ProjectLoggingLifecycle) { + sync := NewProjectLoggingLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.AddClusterScopedHandler(name, clusterName, sync) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_logging_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_logging_lifecycle_adapter.go new file mode 100644 index 00000000..0b561395 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_logging_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ProjectLoggingLifecycle interface { + Create(obj *ProjectLogging) (*ProjectLogging, error) + Remove(obj *ProjectLogging) (*ProjectLogging, error) + Updated(obj *ProjectLogging) (*ProjectLogging, error) +} + +type projectLoggingLifecycleAdapter struct { + lifecycle ProjectLoggingLifecycle +} + +func (w *projectLoggingLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ProjectLogging)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *projectLoggingLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ProjectLogging)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *projectLoggingLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ProjectLogging)) + if o == nil { + return nil, err + } + return o, err +} + +func NewProjectLoggingLifecycleAdapter(name string, clusterScoped bool, client ProjectLoggingInterface, l ProjectLoggingLifecycle) ProjectLoggingHandlerFunc { + adapter := &projectLoggingLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *ProjectLogging) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_scheme.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_scheme.go index 9a6ce6f1..dcccefe9 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_scheme.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_scheme.go @@ -81,6 +81,14 @@ func addKnownTypes(scheme *runtime.Scheme) error { &StackList{}, &Preference{}, &PreferenceList{}, + &ClusterLogging{}, + &ClusterLoggingList{}, + &ProjectLogging{}, + &ProjectLoggingList{}, + &ListenConfig{}, + &ListenConfigList{}, + &Setting{}, + &SettingList{}, ) return nil } diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_setting_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_setting_controller.go new file mode 100644 index 00000000..c563c5e4 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_setting_controller.go @@ -0,0 +1,251 @@ +package v3 + +import ( + "context" + + "github.com/rancher/norman/clientbase" + "github.com/rancher/norman/controller" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + SettingGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "Setting", + } + SettingResource = metav1.APIResource{ + Name: "settings", + SingularName: "setting", + Namespaced: false, + Kind: SettingGroupVersionKind.Kind, + } +) + +type SettingList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Setting +} + +type SettingHandlerFunc func(key string, obj *Setting) error + +type SettingLister interface { + List(namespace string, selector labels.Selector) (ret []*Setting, err error) + Get(namespace, name string) (*Setting, error) +} + +type SettingController interface { + Informer() cache.SharedIndexInformer + Lister() SettingLister + AddHandler(name string, handler SettingHandlerFunc) + AddClusterScopedHandler(name, clusterName string, handler SettingHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type SettingInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*Setting) (*Setting, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*Setting, error) + Get(name string, opts metav1.GetOptions) (*Setting, error) + Update(*Setting) (*Setting, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*SettingList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() SettingController + AddHandler(name string, sync SettingHandlerFunc) + AddLifecycle(name string, lifecycle SettingLifecycle) + AddClusterScopedHandler(name, clusterName string, sync SettingHandlerFunc) + AddClusterScopedLifecycle(name, clusterName string, lifecycle SettingLifecycle) +} + +type settingLister struct { + controller *settingController +} + +func (l *settingLister) List(namespace string, selector labels.Selector) (ret []*Setting, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*Setting)) + }) + return +} + +func (l *settingLister) Get(namespace, name string) (*Setting, error) { + var key string + if namespace != "" { + key = namespace + "/" + name + } else { + key = name + } + obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schema.GroupResource{ + Group: SettingGroupVersionKind.Group, + Resource: "setting", + }, name) + } + return obj.(*Setting), nil +} + +type settingController struct { + controller.GenericController +} + +func (c *settingController) Lister() SettingLister { + return &settingLister{ + controller: c, + } +} + +func (c *settingController) AddHandler(name string, handler SettingHandlerFunc) { + c.GenericController.AddHandler(name, func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + return handler(key, obj.(*Setting)) + }) +} + +func (c *settingController) AddClusterScopedHandler(name, cluster string, handler SettingHandlerFunc) { + c.GenericController.AddHandler(name, func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + + if !controller.ObjectInCluster(cluster, obj) { + return nil + } + + return handler(key, obj.(*Setting)) + }) +} + +type settingFactory struct { +} + +func (c settingFactory) Object() runtime.Object { + return &Setting{} +} + +func (c settingFactory) List() runtime.Object { + return &SettingList{} +} + +func (s *settingClient) Controller() SettingController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.settingControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(SettingGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &settingController{ + GenericController: genericController, + } + + s.client.settingControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type settingClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller SettingController +} + +func (s *settingClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *settingClient) Create(o *Setting) (*Setting, error) { + obj, err := s.objectClient.Create(o) + return obj.(*Setting), err +} + +func (s *settingClient) Get(name string, opts metav1.GetOptions) (*Setting, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*Setting), err +} + +func (s *settingClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*Setting, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*Setting), err +} + +func (s *settingClient) Update(o *Setting) (*Setting, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*Setting), err +} + +func (s *settingClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *settingClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *settingClient) List(opts metav1.ListOptions) (*SettingList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*SettingList), err +} + +func (s *settingClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *settingClient) Patch(o *Setting, data []byte, subresources ...string) (*Setting, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*Setting), err +} + +func (s *settingClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *settingClient) AddHandler(name string, sync SettingHandlerFunc) { + s.Controller().AddHandler(name, sync) +} + +func (s *settingClient) AddLifecycle(name string, lifecycle SettingLifecycle) { + sync := NewSettingLifecycleAdapter(name, false, s, lifecycle) + s.AddHandler(name, sync) +} + +func (s *settingClient) AddClusterScopedHandler(name, clusterName string, sync SettingHandlerFunc) { + s.Controller().AddClusterScopedHandler(name, clusterName, sync) +} + +func (s *settingClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle SettingLifecycle) { + sync := NewSettingLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.AddClusterScopedHandler(name, clusterName, sync) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_setting_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_setting_lifecycle_adapter.go new file mode 100644 index 00000000..9dddd7fc --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_setting_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type SettingLifecycle interface { + Create(obj *Setting) (*Setting, error) + Remove(obj *Setting) (*Setting, error) + Updated(obj *Setting) (*Setting, error) +} + +type settingLifecycleAdapter struct { + lifecycle SettingLifecycle +} + +func (w *settingLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*Setting)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *settingLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*Setting)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *settingLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*Setting)) + if o == nil { + return nil, err + } + return o, err +} + +func NewSettingLifecycleAdapter(name string, clusterScoped bool, client SettingInterface, l SettingLifecycle) SettingHandlerFunc { + adapter := &settingLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *Setting) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/vendor.conf b/vendor/github.com/rancher/types/vendor.conf index 64878d1b..e16566eb 100644 --- a/vendor/github.com/rancher/types/vendor.conf +++ b/vendor/github.com/rancher/types/vendor.conf @@ -1,7 +1,8 @@ # package github.com/rancher/types -k8s.io/kubernetes v1.8.3 transitive=true,staging=true -bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git -github.com/rancher/norman 76d825608521a24007cfdb110d9b88d45c50d9c5 -golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5 +k8s.io/kubernetes v1.8.3 transitive=true,staging=true +bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git +golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5 + +github.com/rancher/norman 0b548c23c75c159d4351385cec07a35281c8f5f7 diff --git a/vendor/github.com/ugorji/go/LICENSE b/vendor/github.com/ugorji/go/LICENSE new file mode 100644 index 00000000..95a0f054 --- /dev/null +++ b/vendor/github.com/ugorji/go/LICENSE @@ -0,0 +1,22 @@ +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/vendor/github.com/ugorji/go/README.md b/vendor/github.com/ugorji/go/README.md new file mode 100644 index 00000000..6bb74742 --- /dev/null +++ b/vendor/github.com/ugorji/go/README.md @@ -0,0 +1,20 @@ +# go/codec + +This repository contains the `go-codec` library, +a High Performance and Feature-Rich Idiomatic encode/decode and rpc library for + + - 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 + +For more information: + + - [see the codec/Readme for quick usage information](https://github.com/ugorji/go/tree/master/codec#readme) + - [view the API on godoc](http://godoc.org/github.com/ugorji/go/codec) + - [read the detailed usage/how-to primer](http://ugorji.net/blog/go-codec-primer) + +Install using: + + go get github.com/ugorji/go/codec + diff --git a/vendor/github.com/ugorji/go/codec/0doc.go b/vendor/github.com/ugorji/go/codec/0doc.go index 6dfeee35..cfb804ec 100644 --- a/vendor/github.com/ugorji/go/codec/0doc.go +++ b/vendor/github.com/ugorji/go/codec/0doc.go @@ -1,10 +1,9 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 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. +High Performance, Feature-Rich Idiomatic Go 1.4+ codec/encoding library for +binc, msgpack, cbor, json Supported Serialization formats are: @@ -33,14 +32,15 @@ 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% ) + - Good code coverage ( > 70% ) - 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 - - Coerce types where appropriate - e.g. decode an int in the stream into a float, decode numbers from formatted strings, etc + - Multiple conversions: + Package coerces types where appropriate + e.g. decode an int in the stream into a float, etc. - Corner Cases: Overflows, nil maps/slices, nil values in streams are handled correctly - Standard field renaming via tags @@ -49,16 +49,10 @@ Rich Feature Set includes: (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. @@ -99,27 +93,6 @@ 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? - - 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 @@ -207,63 +180,6 @@ 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 -// TODO: -// - In Go 1.10, when mid-stack inlining is enabled, -// we should use committed functions for writeXXX and readXXX calls. -// This involves uncommenting the methods for decReaderSwitch and encWriterSwitch -// and using those (decReaderSwitch and encWriterSwitch) in all handles -// instead of encWriter and decReader. -// The benefit is that, for the (En|De)coder over []byte, the encWriter/decReader -// will be inlined, giving a performance bump for that typical case. -// However, it will only be inlined if mid-stack inlining is enabled, -// as we call panic to raise errors, and panic currently prevents inlining. -// -// - Unexport BasicHandle. -// If godoc can now show the embedded options, then unexport it. -// -// PUNTED: -// - To make Handle comparable, make extHandle in BasicHandle a non-embedded pointer, -// and use overlay methods on *BasicHandle to call through to extHandle after initializing -// the "xh *extHandle" to point to a real slice. -// -// - Allow mapping a concrete type to an interface, for use during decoding. -// -// BEFORE EACH RELEASE: -// - Look through and fix padding for each type, to eliminate false sharing -// - critical shared objects that are read many times -// TypeInfos -// - pooled objects: -// decNaked, decNakedContainers, codecFner, typeInfoLoadArray, -// - small objects allocated independently, that we read/use much across threads: -// codecFn, typeInfo -// - Objects allocated independently and used a lot -// Decoder, Encoder, -// xxxHandle, xxxEncDriver, xxxDecDriver (xxx = json, msgpack, cbor, binc, simple) -// - In all above, arrange values modified together to be close to each other. -// -// For all of these, either ensure that they occupy full cache lines, -// or ensure that the things just past the cache line boundary are hardly read/written -// e.g. JsonHandle.RawBytesExt - which is copied into json(En|De)cDriver at init -// -// Occupying full cache lines means they occupy 8*N words (where N is an integer). -// Check this out by running: ./run.sh -z -// - look at those tagged ****, meaning they are not occupying full cache lines -// - look at those tagged <<<<, meaning they are larger than 32 words (something to watch) -// - Run "golint -min_confidence 0.81" diff --git a/vendor/github.com/ugorji/go/codec/README.md b/vendor/github.com/ugorji/go/codec/README.md index 50d65e55..cadc41b4 100644 --- a/vendor/github.com/ugorji/go/codec/README.md +++ b/vendor/github.com/ugorji/go/codec/README.md @@ -31,14 +31,15 @@ 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% ) + - Good code coverage ( > 70% ) - 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 - - Coerce types where appropriate - e.g. decode an int in the stream into a float, decode numbers from formatted strings, etc + - Multiple conversions: + Package coerces types where appropriate + e.g. decode an int in the stream into a float, etc. - Corner Cases: Overflows, nil maps/slices, nil values in streams are handled correctly - Standard field renaming via tags @@ -47,16 +48,10 @@ Rich Feature Set includes: (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. @@ -96,27 +91,6 @@ 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? - - 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 @@ -190,17 +164,3 @@ You can run the tag 'safe' to run tests or build in safe mode. e.g. 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/vendor/github.com/ugorji/go/codec/binc.go b/vendor/github.com/ugorji/go/codec/binc.go index 39fd7d4a..be5b7d33 100644 --- a/vendor/github.com/ugorji/go/codec/binc.go +++ b/vendor/github.com/ugorji/go/codec/binc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -57,31 +57,38 @@ const ( type bincEncDriver struct { e *Encoder - h *BincHandle w encWriter m map[string]uint16 // symbols - b [16]byte // scratch, used for encoding numbers - bigendian style - s uint16 // symbols sequencer - // c containerState - encDriverTrackContainerWriter - noBuiltInTypes + b [scratchByteArrayLen]byte + s uint16 // symbols sequencer // encNoSeparator + encDriverNoopContainerWriter +} + +func (e *bincEncDriver) IsBuiltinType(rt uintptr) bool { + return rt == timeTypId +} + +func (e *bincEncDriver) EncodeBuiltin(rt uintptr, v interface{}) { + if rt == timeTypId { + var bs []byte + switch x := v.(type) { + case time.Time: + bs = encodeTime(x) + case *time.Time: + bs = encodeTime(*x) + default: + e.e.errorf("binc error encoding builtin: expect time.Time, received %T", v) + } + e.w.writen1(bincVdTimestamp<<4 | uint8(len(bs))) + e.w.writeb(bs) + } } func (e *bincEncDriver) EncodeNil() { e.w.writen1(bincVdSpecial<<4 | bincSpNil) } -func (e *bincEncDriver) EncodeTime(t time.Time) { - if t.IsZero() { - e.EncodeNil() - } else { - bs := bincEncodeTime(t) - e.w.writen1(bincVdTimestamp<<4 | uint8(len(bs))) - e.w.writeb(bs) - } -} - func (e *bincEncDriver) EncodeBool(b bool) { if b { e.w.writen1(bincVdSpecial<<4 | bincSpTrue) @@ -191,19 +198,13 @@ 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) 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 { @@ -213,7 +214,7 @@ func (e *bincEncDriver) EncodeString(c charEncoding, v string) { func (e *bincEncDriver) EncodeSymbol(v string) { // if WriteSymbolsNoRefs { - // e.encodeString(cUTF8, v) + // e.encodeString(c_UTF8, v) // return // } @@ -223,10 +224,10 @@ func (e *bincEncDriver) EncodeSymbol(v string) { l := len(v) if l == 0 { - e.encBytesLen(cUTF8, 0) + e.encBytesLen(c_UTF8, 0) return } else if l == 1 { - e.encBytesLen(cUTF8, 1) + e.encBytesLen(c_UTF8, 1) e.w.writen1(v[0]) return } @@ -276,10 +277,6 @@ func (e *bincEncDriver) EncodeSymbol(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 { @@ -289,7 +286,7 @@ func (e *bincEncDriver) EncodeStringBytes(c charEncoding, v []byte) { func (e *bincEncDriver) encBytesLen(c charEncoding, length uint64) { //TODO: support bincUnicodeOther (for now, just use string or bytearray) - if c == cRAW { + if c == c_RAW { e.encLen(bincVdByteArray<<4, length) } else { e.encLen(bincVdString<<4, length) @@ -328,9 +325,6 @@ type bincDecSymbol struct { } type bincDecDriver struct { - decDriverNoopContainerReader - noBuiltInTypes - d *Decoder h *BincHandle r decReader @@ -339,15 +333,14 @@ type bincDecDriver struct { bd byte vd byte vs byte - _ [3]byte // padding + // noStreamingCodec + // decNoSeparator + b [scratchByteArrayLen]byte + // linear searching on this slice is ok, // because we typically expect < 32 symbols in each stream. s []bincDecSymbol - - // noStreamingCodec - // decNoSeparator - - b [8 * 8]byte // scratch + decDriverNoopContainerReader } func (d *bincDecDriver) readNextBd() { @@ -378,10 +371,9 @@ func (d *bincDecDriver) ContainerType() (vt valueType) { return valueTypeArray } else if d.vd == bincVdMap { return valueTypeMap + } else { + // d.d.errorf("isContainerType: unsupported parameter: %v", vt) } - // else { - // d.d.errorf("isContainerType: unsupported parameter: %v", vt) - // } return valueTypeUnset } @@ -396,24 +388,27 @@ func (d *bincDecDriver) TryDecodeAsNil() bool { return false } -func (d *bincDecDriver) DecodeTime() (t time.Time) { +func (d *bincDecDriver) IsBuiltinType(rt uintptr) bool { + return rt == timeTypId +} + +func (d *bincDecDriver) DecodeBuiltin(rt uintptr, v interface{}) { if !d.bdRead { d.readNextBd() } - if d.bd == bincVdSpecial<<4|bincSpNil { + if rt == timeTypId { + if d.vd != bincVdTimestamp { + d.d.errorf("Invalid d.vd. Expecting 0x%x. Received: 0x%x", bincVdTimestamp, d.vd) + return + } + tt, err := decodeTime(d.r.readx(int(d.vs))) + if err != nil { + panic(err) + } + var vt *time.Time = v.(*time.Time) + *vt = tt d.bdRead = false - return } - if d.vd != bincVdTimestamp { - d.d.errorf("Invalid d.vd. Expecting 0x%x. Received: 0x%x", bincVdTimestamp, d.vd) - return - } - t, err := bincDecodeTime(d.r.readx(int(d.vs))) - if err != nil { - panic(err) - } - d.bdRead = false - return } func (d *bincDecDriver) decFloatPre(vs, defaultLen byte) { @@ -502,33 +497,45 @@ func (d *bincDecDriver) decCheckInteger() (ui uint64, neg bool) { return } } else { - d.d.errorf("integer can only be decoded from int/uint. d.bd: 0x%x, d.vd: 0x%x", d.bd, d.vd) + d.d.errorf("number can only be decoded from uint or int values. d.bd: 0x%x, d.vd: 0x%x", d.bd, d.vd) return } return } -func (d *bincDecDriver) DecodeInt64() (i int64) { +func (d *bincDecDriver) DecodeInt(bitsize uint8) (i int64) { ui, neg := d.decCheckInteger() - i = chkOvf.SignedIntV(ui) + i, overflow := chkOvf.SignedInt(ui) + if overflow { + d.d.errorf("simple: overflow converting %v to signed integer", ui) + return + } if neg { i = -i } + if chkOvf.Int(i, bitsize) { + d.d.errorf("binc: overflow integer: %v for num bits: %v", i, bitsize) + return + } d.bdRead = false return } -func (d *bincDecDriver) DecodeUint64() (ui uint64) { +func (d *bincDecDriver) DecodeUint(bitsize uint8) (ui uint64) { ui, neg := d.decCheckInteger() if neg { d.d.errorf("Assigning negative signed value to unsigned type") return } + if chkOvf.Uint(ui, bitsize) { + d.d.errorf("binc: overflow integer: %v", ui) + return + } d.bdRead = false return } -func (d *bincDecDriver) DecodeFloat64() (f float64) { +func (d *bincDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { if !d.bdRead { d.readNextBd() } @@ -550,7 +557,11 @@ func (d *bincDecDriver) DecodeFloat64() (f float64) { } else if vd == bincVdFloat { f = d.decFloat() } else { - f = float64(d.DecodeInt64()) + f = float64(d.DecodeInt(64)) + } + if chkOverflow32 && chkOvf.Float32(f) { + d.d.errorf("binc: float32 overflow: %v", f) + return } d.bdRead = false return @@ -622,8 +633,7 @@ func (d *bincDecDriver) decLenNumber() (v uint64) { return } -func (d *bincDecDriver) decStringAndBytes(bs []byte, withString, zerocopy bool) ( - bs2 []byte, s string) { +func (d *bincDecDriver) decStringAndBytes(bs []byte, withString, zerocopy bool) (bs2 []byte, s string) { if !d.bdRead { d.readNextBd() } @@ -631,7 +641,7 @@ func (d *bincDecDriver) decStringAndBytes(bs []byte, withString, zerocopy bool) d.bdRead = false return } - var slen = -1 + var slen int = -1 // var ok bool switch d.vd { case bincVdString, bincVdByteArray: @@ -733,11 +743,6 @@ func (d *bincDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { d.bdRead = false return nil } - // check if an "array" of uint8's (see ContainerType for how to infer if an array) - if d.vd == bincVdArray { - bsOut, _ = fastpathTV.DecSliceUint8V(bs, true, d.d) - return - } var clen int if d.vd == bincVdString || d.vd == bincVdByteArray { clen = d.decLen() @@ -858,8 +863,8 @@ func (d *bincDecDriver) DecodeNaked() { n.v = valueTypeBytes n.l = d.DecodeBytes(nil, false) case bincVdTimestamp: - n.v = valueTypeTime - tt, err := bincDecodeTime(d.r.readx(int(d.vs))) + n.v = valueTypeTimestamp + tt, err := decodeTime(d.r.readx(int(d.vs))) if err != nil { panic(err) } @@ -907,50 +912,27 @@ type BincHandle struct { BasicHandle binaryEncodingType noElemSeparators - - // AsSymbols defines what should be encoded as symbols. - // - // Encoding as symbols can reduce the encoded size significantly. - // - // However, during decoding, each string to be encoded as a symbol must - // be checked to see if it has been seen before. Consequently, encoding time - // will increase if using symbols, because string comparisons has a clear cost. - // - // Values: - // - 0: default: library uses best judgement - // - 1: use symbols - // - 2: do not use symbols - AsSymbols uint8 - - // AsSymbols: may later on introduce more options ... - // - m: map keys - // - s: struct fields - // - n: none - // - a: all: same as m, s, ... - - _ [1]uint64 // padding } -// Name returns the name of the handle: binc -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, &setExtWrapper{b: ext}) } func (h *BincHandle) newEncDriver(e *Encoder) encDriver { - return &bincEncDriver{e: e, h: h, w: e.w} + return &bincEncDriver{e: e, w: e.w} } func (h *BincHandle) newDecDriver(d *Decoder) decDriver { return &bincDecDriver{d: d, h: h, r: d.r, br: d.bytes} } +func (_ *BincHandle) IsBuiltinType(rt uintptr) bool { + return rt == timeTypId +} + func (e *bincEncDriver) reset() { e.w = e.e.w e.s = 0 - e.c = 0 e.m = nil } @@ -960,165 +942,5 @@ func (d *bincDecDriver) reset() { d.bd, d.bdRead, d.vd, d.vs = 0, false, 0, 0 } -// var timeDigits = [...]byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'} - -// EncodeTime encodes a time.Time as a []byte, including -// information on the instant in time and UTC offset. -// -// Format Description -// -// A timestamp is composed of 3 components: -// -// - secs: signed integer representing seconds since unix epoch -// - nsces: unsigned integer representing fractional seconds as a -// nanosecond offset within secs, in the range 0 <= nsecs < 1e9 -// - tz: signed integer representing timezone offset in minutes east of UTC, -// and a dst (daylight savings time) flag -// -// When encoding a timestamp, the first byte is the descriptor, which -// defines which components are encoded and how many bytes are used to -// encode secs and nsecs components. *If secs/nsecs is 0 or tz is UTC, it -// is not encoded in the byte array explicitly*. -// -// Descriptor 8 bits are of the form `A B C DDD EE`: -// A: Is secs component encoded? 1 = true -// B: Is nsecs component encoded? 1 = true -// C: Is tz component encoded? 1 = true -// DDD: Number of extra bytes for secs (range 0-7). -// If A = 1, secs encoded in DDD+1 bytes. -// If A = 0, secs is not encoded, and is assumed to be 0. -// If A = 1, then we need at least 1 byte to encode secs. -// DDD says the number of extra bytes beyond that 1. -// E.g. if DDD=0, then secs is represented in 1 byte. -// if DDD=2, then secs is represented in 3 bytes. -// EE: Number of extra bytes for nsecs (range 0-3). -// If B = 1, nsecs encoded in EE+1 bytes (similar to secs/DDD above) -// -// Following the descriptor bytes, subsequent bytes are: -// -// secs component encoded in `DDD + 1` bytes (if A == 1) -// nsecs component encoded in `EE + 1` bytes (if B == 1) -// tz component encoded in 2 bytes (if C == 1) -// -// secs and nsecs components are integers encoded in a BigEndian -// 2-complement encoding format. -// -// tz component is encoded as 2 bytes (16 bits). Most significant bit 15 to -// Least significant bit 0 are described below: -// -// Timezone offset has a range of -12:00 to +14:00 (ie -720 to +840 minutes). -// Bit 15 = have\_dst: set to 1 if we set the dst flag. -// Bit 14 = dst\_on: set to 1 if dst is in effect at the time, or 0 if not. -// Bits 13..0 = timezone offset in minutes. It is a signed integer in Big Endian format. -// -func bincEncodeTime(t time.Time) []byte { - //t := rv.Interface().(time.Time) - tsecs, tnsecs := t.Unix(), t.Nanosecond() - var ( - bd byte - btmp [8]byte - bs [16]byte - i int = 1 - ) - l := t.Location() - if l == time.UTC { - l = nil - } - if tsecs != 0 { - bd = bd | 0x80 - bigen.PutUint64(btmp[:], uint64(tsecs)) - f := pruneSignExt(btmp[:], tsecs >= 0) - bd = bd | (byte(7-f) << 2) - copy(bs[i:], btmp[f:]) - i = i + (8 - f) - } - if tnsecs != 0 { - bd = bd | 0x40 - bigen.PutUint32(btmp[:4], uint32(tnsecs)) - f := pruneSignExt(btmp[:4], true) - bd = bd | byte(3-f) - copy(bs[i:], btmp[f:4]) - i = i + (4 - f) - } - if l != nil { - bd = bd | 0x20 - // Note that Go Libs do not give access to dst flag. - _, zoneOffset := t.Zone() - //zoneName, zoneOffset := t.Zone() - zoneOffset /= 60 - z := uint16(zoneOffset) - bigen.PutUint16(btmp[:2], z) - // clear dst flags - bs[i] = btmp[0] & 0x3f - bs[i+1] = btmp[1] - i = i + 2 - } - bs[0] = bd - return bs[0:i] -} - -// bincDecodeTime decodes a []byte into a time.Time. -func bincDecodeTime(bs []byte) (tt time.Time, err error) { - bd := bs[0] - var ( - tsec int64 - tnsec uint32 - tz uint16 - i byte = 1 - i2 byte - n byte - ) - if bd&(1<<7) != 0 { - var btmp [8]byte - n = ((bd >> 2) & 0x7) + 1 - i2 = i + n - copy(btmp[8-n:], bs[i:i2]) - //if first bit of bs[i] is set, then fill btmp[0..8-n] with 0xff (ie sign extend it) - if bs[i]&(1<<7) != 0 { - copy(btmp[0:8-n], bsAll0xff) - //for j,k := byte(0), 8-n; j < k; j++ { btmp[j] = 0xff } - } - i = i2 - tsec = int64(bigen.Uint64(btmp[:])) - } - if bd&(1<<6) != 0 { - var btmp [4]byte - n = (bd & 0x3) + 1 - i2 = i + n - copy(btmp[4-n:], bs[i:i2]) - i = i2 - tnsec = bigen.Uint32(btmp[:]) - } - if bd&(1<<5) == 0 { - tt = time.Unix(tsec, int64(tnsec)).UTC() - 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. - // Zone name is in form: UTC-08:00. - // Note that Go Libs do not give access to dst flag, so we ignore dst bits - - i2 = i + 2 - tz = bigen.Uint16(bs[i:i2]) - // i = i2 - // sign extend sign bit into top 2 MSB (which were dst bits): - if tz&(1<<13) == 0 { // positive - tz = tz & 0x3fff //clear 2 MSBs: dst bits - } else { // negative - tz = tz | 0xc000 //set 2 MSBs: dst bits - } - tzint := int16(tz) - if tzint == 0 { - tt = time.Unix(tsec, int64(tnsec)).UTC() - } else { - // For Go Time, do not use a descriptive timezone. - // It's unnecessary, and makes it harder to do a reflect.DeepEqual. - // The Offset already tells what the offset should be, if not on UTC and unknown zone name. - // var zoneName = timeLocUTCName(tzint) - tt = time.Unix(tsec, int64(tnsec)).In(time.FixedZone("", int(tzint)*60)) - } - return -} - var _ decDriver = (*bincDecDriver)(nil) var _ encDriver = (*bincEncDriver)(nil) diff --git a/vendor/github.com/ugorji/go/codec/cbor.go b/vendor/github.com/ugorji/go/codec/cbor.go index be01e19e..592cee85 100644 --- a/vendor/github.com/ugorji/go/codec/cbor.go +++ b/vendor/github.com/ugorji/go/codec/cbor.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -6,7 +6,6 @@ package codec import ( "math" "reflect" - "time" ) const ( @@ -39,8 +38,6 @@ const ( cborBdBreak = 0xff ) -// These define some in-stream descriptors for -// manual encoding e.g. when doing explicit indefinite-length const ( CborStreamBytes byte = 0x5f CborStreamString = 0x7f @@ -70,7 +67,6 @@ type cborEncDriver struct { w encWriter h *CborHandle x [8]byte - _ [3]uint64 // padding } func (e *cborEncDriver) EncodeNil() { @@ -128,24 +124,6 @@ func (e *cborEncDriver) encLen(bd byte, length int) { e.encUint(uint64(length), bd) } -func (e *cborEncDriver) EncodeTime(t time.Time) { - if t.IsZero() { - e.EncodeNil() - } else if e.h.TimeRFC3339 { - e.encUint(0, cborBaseTag) - e.EncodeString(cUTF8, t.Format(time.RFC3339Nano)) - } else { - e.encUint(1, cborBaseTag) - t = t.UTC().Round(time.Microsecond) - sec, nsec := t.Unix(), uint64(t.Nanosecond()) - if nsec == 0 { - e.EncodeInt(sec) - } else { - e.EncodeFloat64(float64(sec) + float64(nsec)/1e9) - } - } -} - func (e *cborEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Encoder) { e.encUint(uint64(xtag), cborBaseTag) if v := ext.ConvertExt(rv); v == nil { @@ -195,65 +173,36 @@ func (e *cborEncDriver) WriteArrayEnd() { } func (e *cborEncDriver) EncodeString(c charEncoding, v string) { - e.encStringBytesS(cborBaseString, v) + e.encLen(cborBaseString, len(v)) + e.w.writestr(v) +} + +func (e *cborEncDriver) EncodeSymbol(v string) { + e.EncodeString(c_UTF8, v) } func (e *cborEncDriver) EncodeStringBytes(c charEncoding, v []byte) { - if v == nil { - e.EncodeNil() - } else if c == cRAW { - e.encStringBytesS(cborBaseBytes, stringView(v)) + if c == c_RAW { + e.encLen(cborBaseBytes, len(v)) } else { - e.encStringBytesS(cborBaseString, stringView(v)) - } -} - -func (e *cborEncDriver) encStringBytesS(bb byte, v string) { - if e.h.IndefiniteLength { - if bb == cborBaseBytes { - e.w.writen1(cborBdIndefiniteBytes) - } else { - e.w.writen1(cborBdIndefiniteString) - } - blen := len(v) / 4 - if blen == 0 { - blen = 64 - } else if blen > 1024 { - blen = 1024 - } - for i := 0; i < len(v); { - var v2 string - i2 := i + blen - if i2 < len(v) { - v2 = v[i:i2] - } else { - v2 = v[i:] - } - e.encLen(bb, len(v2)) - e.w.writestr(v2) - i = i2 - } - e.w.writen1(cborBdBreak) - } else { - e.encLen(bb, len(v)) - e.w.writestr(v) + e.encLen(cborBaseString, len(v)) } + e.w.writeb(v) } // ---------------------- type cborDecDriver struct { - d *Decoder - h *CborHandle - r decReader - // b [scratchByteArrayLen]byte + d *Decoder + h *CborHandle + r decReader + b [scratchByteArrayLen]byte br bool // bytes reader bdRead bool bd byte noBuiltInTypes // decNoSeparator decDriverNoopContainerReader - _ [3]uint64 // padding } func (d *cborDecDriver) readNextBd() { @@ -282,10 +231,9 @@ func (d *cborDecDriver) ContainerType() (vt valueType) { return valueTypeArray } else if d.bd == cborBdIndefiniteMap || (d.bd >= cborBaseMap && d.bd < cborBaseTag) { return valueTypeMap + } else { + // d.d.errorf("isContainerType: unsupported parameter: %v", vt) } - // else { - // d.d.errorf("isContainerType: unsupported parameter: %v", vt) - // } return valueTypeUnset } @@ -348,30 +296,46 @@ func (d *cborDecDriver) decCheckInteger() (neg bool) { return } -func (d *cborDecDriver) DecodeInt64() (i int64) { +func (d *cborDecDriver) DecodeInt(bitsize uint8) (i int64) { neg := d.decCheckInteger() ui := d.decUint() // check if this number can be converted to an int without overflow + var overflow bool if neg { - i = -(chkOvf.SignedIntV(ui + 1)) + if i, overflow = chkOvf.SignedInt(ui + 1); overflow { + d.d.errorf("cbor: overflow converting %v to signed integer", ui+1) + return + } + i = -i } else { - i = chkOvf.SignedIntV(ui) + if i, overflow = chkOvf.SignedInt(ui); overflow { + d.d.errorf("cbor: overflow converting %v to signed integer", ui) + return + } + } + if chkOvf.Int(i, bitsize) { + d.d.errorf("cbor: overflow integer: %v", i) + return } d.bdRead = false return } -func (d *cborDecDriver) DecodeUint64() (ui uint64) { +func (d *cborDecDriver) DecodeUint(bitsize uint8) (ui uint64) { if d.decCheckInteger() { d.d.errorf("Assigning negative signed value to unsigned type") return } ui = d.decUint() + if chkOvf.Uint(ui, bitsize) { + d.d.errorf("cbor: overflow integer: %v", ui) + return + } d.bdRead = false return } -func (d *cborDecDriver) DecodeFloat64() (f float64) { +func (d *cborDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { if !d.bdRead { d.readNextBd() } @@ -382,11 +346,15 @@ func (d *cborDecDriver) DecodeFloat64() (f float64) { } else if bd == cborBdFloat64 { f = math.Float64frombits(bigen.Uint64(d.r.readx(8))) } else if bd >= cborBaseUint && bd < cborBaseBytes { - f = float64(d.DecodeInt64()) + f = float64(d.DecodeInt(64)) } else { d.d.errorf("Float only valid from float16/32/64: Invalid descriptor: %v", bd) return } + if chkOverflow32 && chkOvf.Float32(f) { + d.d.errorf("cbor: float32 overflow: %v", f) + return + } d.bdRead = false return } @@ -440,8 +408,7 @@ func (d *cborDecDriver) decAppendIndefiniteBytes(bs []byte) []byte { break } if major := d.bd >> 5; major != cborMajorBytes && major != cborMajorText { - d.d.errorf("expect bytes/string major type in indefinite string/bytes;"+ - " got: %v, byte: %v", major, d.bd) + d.d.errorf("cbor: expect bytes or string major type in indefinite string/bytes; got: %v, byte: %v", major, d.bd) return nil } n := d.decLen() @@ -471,84 +438,29 @@ func (d *cborDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { return nil } if d.bd == cborBdIndefiniteBytes || d.bd == cborBdIndefiniteString { - d.bdRead = false if bs == nil { - if zerocopy { - return d.decAppendIndefiniteBytes(d.d.b[:0]) - } - return d.decAppendIndefiniteBytes(zeroByteSlice) + return d.decAppendIndefiniteBytes(nil) } return d.decAppendIndefiniteBytes(bs[:0]) } - // check if an "array" of uint8's (see ContainerType for how to infer if an array) - if d.bd == cborBdIndefiniteArray || (d.bd >= cborBaseArray && d.bd < cborBaseMap) { - bsOut, _ = fastpathTV.DecSliceUint8V(bs, true, d.d) - return - } clen := d.decLen() d.bdRead = false if zerocopy { if d.br { return d.r.readx(clen) } else if len(bs) == 0 { - bs = d.d.b[:] + bs = d.b[:] } } - return decByteSlice(d.r, clen, d.h.MaxInitLen, bs) + return decByteSlice(d.r, clen, d.d.h.MaxInitLen, bs) } func (d *cborDecDriver) DecodeString() (s string) { - return string(d.DecodeBytes(d.d.b[:], true)) + return string(d.DecodeBytes(d.b[:], true)) } func (d *cborDecDriver) DecodeStringAsBytes() (s []byte) { - return d.DecodeBytes(d.d.b[:], true) -} - -func (d *cborDecDriver) DecodeTime() (t time.Time) { - if !d.bdRead { - d.readNextBd() - } - if d.bd == cborBdNil || d.bd == cborBdUndefined { - d.bdRead = false - return - } - xtag := d.decUint() - d.bdRead = false - return d.decodeTime(xtag) -} - -func (d *cborDecDriver) decodeTime(xtag uint64) (t time.Time) { - if !d.bdRead { - d.readNextBd() - } - switch xtag { - case 0: - var err error - if t, err = time.Parse(time.RFC3339, stringView(d.DecodeStringAsBytes())); err != nil { - d.d.errorv(err) - } - case 1: - // decode an int64 or a float, and infer time.Time from there. - // for floats, round to microseconds, as that is what is guaranteed to fit well. - switch { - case d.bd == cborBdFloat16, d.bd == cborBdFloat32: - f1, f2 := math.Modf(d.DecodeFloat64()) - t = time.Unix(int64(f1), int64(f2*1e9)) - case d.bd == cborBdFloat64: - f1, f2 := math.Modf(d.DecodeFloat64()) - t = time.Unix(int64(f1), int64(f2*1e9)) - case d.bd >= cborBaseUint && d.bd < cborBaseNegInt, - d.bd >= cborBaseNegInt && d.bd < cborBaseBytes: - t = time.Unix(d.DecodeInt64(), 0) - default: - d.d.errorf("time.Time can only be decoded from a number (or RFC3339 string)") - } - default: - d.d.errorf("invalid tag for time.Time - expecting 0 or 1, got 0x%x", xtag) - } - t = t.UTC().Round(time.Microsecond) - return + return d.DecodeBytes(d.b[:], true) } func (d *cborDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) { @@ -591,9 +503,12 @@ func (d *cborDecDriver) DecodeNaked() { case cborBdTrue: n.v = valueTypeBool n.b = true - case cborBdFloat16, cborBdFloat32, cborBdFloat64: + case cborBdFloat16, cborBdFloat32: n.v = valueTypeFloat - n.f = d.DecodeFloat64() + n.f = d.DecodeFloat(true) + case cborBdFloat64: + n.v = valueTypeFloat + n.f = d.DecodeFloat(false) case cborBdIndefiniteBytes: n.v = valueTypeBytes n.l = d.DecodeBytes(nil, false) @@ -611,14 +526,14 @@ func (d *cborDecDriver) DecodeNaked() { case d.bd >= cborBaseUint && d.bd < cborBaseNegInt: if d.h.SignedInteger { n.v = valueTypeInt - n.i = d.DecodeInt64() + n.i = d.DecodeInt(64) } else { n.v = valueTypeUint - n.u = d.DecodeUint64() + n.u = d.DecodeUint(64) } case d.bd >= cborBaseNegInt && d.bd < cborBaseBytes: n.v = valueTypeInt - n.i = d.DecodeInt64() + n.i = d.DecodeInt(64) case d.bd >= cborBaseBytes && d.bd < cborBaseString: n.v = valueTypeBytes n.l = d.DecodeBytes(nil, false) @@ -635,11 +550,6 @@ func (d *cborDecDriver) DecodeNaked() { n.v = valueTypeExt n.u = d.decUint() n.l = nil - if n.u == 0 || n.u == 1 { - d.bdRead = false - n.v = valueTypeTime - n.t = d.decodeTime(n.u) - } // d.bdRead = false // d.d.decode(&re.Value) // handled by decode itself. // decodeFurther = true @@ -670,8 +580,23 @@ func (d *cborDecDriver) DecodeNaked() { // // None of the optional extensions (with tags) defined in the spec are supported out-of-the-box. // Users can implement them as needed (using SetExt), including spec-documented ones: -// - timestamp, BigNum, BigFloat, Decimals, -// - Encoded Text (e.g. URL, regexp, base64, MIME Message), etc. +// - timestamp, BigNum, BigFloat, Decimals, Encoded Text (e.g. URL, regexp, base64, MIME Message), etc. +// +// To encode with indefinite lengths (streaming), users will use +// (Must)Encode methods of *Encoder, along with writing CborStreamXXX constants. +// +// For example, to encode "one-byte" as an indefinite length string: +// var buf bytes.Buffer +// e := NewEncoder(&buf, new(CborHandle)) +// buf.WriteByte(CborStreamString) +// e.MustEncode("one-") +// e.MustEncode("byte") +// buf.WriteByte(CborStreamBreak) +// encodedBytes := buf.Bytes() +// var vv interface{} +// NewDecoderBytes(buf.Bytes(), new(CborHandle)).MustDecode(&vv) +// // Now, vv contains the same string "one-byte" +// type CborHandle struct { binaryEncodingType noElemSeparators @@ -679,20 +604,10 @@ type CborHandle struct { // IndefiniteLength=true, means that we encode using indefinitelength IndefiniteLength bool - - // TimeRFC3339 says to encode time.Time using RFC3339 format. - // If unset, we encode time.Time using seconds past epoch. - TimeRFC3339 bool - - _ [1]uint64 // padding } -// Name returns the name of the handle: cbor -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, &setExtWrapper{i: ext}) } func (h *CborHandle) newEncDriver(e *Encoder) encDriver { diff --git a/vendor/github.com/ugorji/go/codec/decode.go b/vendor/github.com/ugorji/go/codec/decode.go index 148c609c..246533f3 100644 --- a/vendor/github.com/ugorji/go/codec/decode.go +++ b/vendor/github.com/ugorji/go/codec/decode.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -9,7 +9,6 @@ import ( "fmt" "io" "reflect" - "strconv" "sync" "time" ) @@ -21,17 +20,12 @@ const ( ) var ( - errstrOnlyMapOrArrayCanDecodeIntoStruct = "only encoded map or array can be decoded into a struct" - errstrCannotDecodeIntoNil = "cannot decode into nil" + onlyMapOrArrayCanDecodeIntoStructErr = errors.New("only encoded map or array can be decoded into a struct") + cannotDecodeIntoNilErr = errors.New("cannot decode into nil") - errmsgExpandSliceOverflow = "expand slice: slice overflow" - errmsgExpandSliceCannotChange = "expand slice: cannot change" - - errDecoderNotInitialized = errors.New("Decoder not initialized") - - errDecUnreadByteNothingToRead = errors.New("cannot unread - nothing has been read") - errDecUnreadByteLastByteNotRead = errors.New("cannot unread - last byte has not been read") - errDecUnreadByteUnknown = errors.New("cannot unread - reason unknown") + decUnreadByteNothingToReadErr = errors.New("cannot unread - nothing has been read") + decUnreadByteLastByteNotReadErr = errors.New("cannot unread - last byte has not been read") + decUnreadByteUnknownErr = errors.New("cannot unread - reason unknown") ) // decReader abstracts the reading source, allowing implementations that can @@ -45,6 +39,9 @@ type decReader interface { readx(n int) []byte readb([]byte) readn1() uint8 + readn3() (uint8, uint8, uint8) + readn4() (uint8, uint8, uint8, uint8) + // readn1eof() (v uint8, eof bool) numread() int // number of bytes read track() stopTrack() []byte @@ -57,6 +54,11 @@ type decReader interface { readUntil(in []byte, stop byte) (out []byte) } +// type decReaderByteScanner interface { +// io.Reader +// io.ByteScanner +// } + type decDriver interface { // this will check if the next token is a break. CheckBreak() bool @@ -68,6 +70,7 @@ type decDriver interface { // vt is one of: Bytes, String, Nil, Slice or Map. Return unSet if not known. ContainerType() (vt valueType) // IsBuiltinType(rt uintptr) bool + DecodeBuiltin(rt uintptr, v interface{}) // DecodeNaked will decode primitives (number, bool, string, []byte) and RawExt. // For maps and arrays, it will not do the decoding in-band, but will signal @@ -81,15 +84,9 @@ type decDriver interface { // extensions should also use readx to decode them, for efficiency. // 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) - - DecodeFloat64() (f float64) + DecodeInt(bitsize uint8) (i int64) + DecodeUint(bitsize uint8) (ui uint64) + DecodeFloat(chkOverflow32 bool) (f float64) DecodeBool() (b bool) // DecodeString can also decode symbols. // It looks redundant as DecodeBytes is available. @@ -107,9 +104,6 @@ type decDriver interface { // decodeExt will decode into a *RawExt or into an extension. DecodeExt(v interface{}, xtag uint64, ext Ext) (realxtag uint64) // decodeExt(verifyTag bool, tag byte) (xtag byte, xbs []byte) - - DecodeTime() (t time.Time) - ReadArrayStart() int ReadArrayElem() ReadArrayEnd() @@ -122,44 +116,39 @@ type decDriver interface { uncacheRead() } +// type decNoSeparator struct {} +// func (_ decNoSeparator) ReadEnd() {} + 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 (_ decDriverNoopContainerReader) ReadArrayStart() (v int) { return } +func (_ decDriverNoopContainerReader) ReadArrayElem() {} +func (_ decDriverNoopContainerReader) ReadArrayEnd() {} +func (_ decDriverNoopContainerReader) ReadMapStart() (v int) { return } +func (_ decDriverNoopContainerReader) ReadMapElemKey() {} +func (_ decDriverNoopContainerReader) ReadMapElemValue() {} +func (_ decDriverNoopContainerReader) ReadMapEnd() {} +func (_ decDriverNoopContainerReader) CheckBreak() (v bool) { return } -// func (x decNoSeparator) uncacheRead() {} +// func (_ decNoSeparator) uncacheRead() {} -// DecodeOptions captures configuration options during decode. type DecodeOptions struct { // MapType specifies type to use during schema-less decoding of a map in the stream. - // If nil (unset), we default to map[string]interface{} iff json handle and MapStringAsKey=true, - // else map[interface{}]interface{}. + // If nil, we use map[interface{}]interface{} MapType reflect.Type // SliceType specifies type to use during schema-less decoding of an array in the stream. - // If nil (unset), we default to []interface{} for all formats. + // If nil, we use []interface{} SliceType reflect.Type - // MaxInitLen defines the maxinum initial length that we "make" a collection - // (string, slice, map, chan). If 0 or negative, we default to a sensible value - // based on the size of an element in the collection. + // MaxInitLen defines the maxinum initial length that we "make" a collection (string, slice, map, chan). + // If 0 or negative, we default to a sensible value based on the size of an element in the collection. // // For example, when decoding, a stream may say that it has 2^64 elements. - // We should not auto-matically provision a slice of that size, to prevent Out-Of-Memory crash. + // We should not auto-matically provision a slice of that length, to prevent Out-Of-Memory crash. // Instead, we provision up to MaxInitLen, fill that up, and start appending after that. MaxInitLen int - // ReaderBufferSize is the size of the buffer used when reading. - // - // if > 0, we use a smart buffer internally for performance purposes. - ReaderBufferSize int - // If ErrorIfNoField, return an error when decoding a map // from a codec stream into a struct, and no matching struct field is found. ErrorIfNoField bool @@ -230,6 +219,11 @@ type DecodeOptions struct { // If true, we will delete the mapping of the key. // Else, just set the mapping to the zero value of the type. DeleteOnNilMapValue bool + + // ReaderBufferSize is the size of the buffer used when reading. + // + // if > 0, we use a smart buffer internally for performance purposes. + ReaderBufferSize int } // ------------------------------------ @@ -242,9 +236,10 @@ type bufioDecReader struct { n int // num read err error - tr []byte trb bool - b [4]byte + tr []byte + + b [8]byte } func (z *bufioDecReader) reset(r io.Reader) { @@ -347,7 +342,7 @@ func (z *bufioDecReader) UnreadByte() (err error) { } return } - return errDecUnreadByteNothingToRead + return decUnreadByteNothingToReadErr } func (z *bufioDecReader) numread() int { @@ -402,6 +397,16 @@ func (z *bufioDecReader) readn1() (b uint8) { return } +func (z *bufioDecReader) readn3() (b1, b2, b3 uint8) { + z.readb(z.b[:3]) + return z.b[0], z.b[1], z.b[2] +} + +func (z *bufioDecReader) readn4() (b1, b2, b3, b4 uint8) { + z.readb(z.b[:4]) + return z.b[0], z.b[1], z.b[2], z.b[3] +} + func (z *bufioDecReader) search(in []byte, accept *bitset256, stop, flag uint8) (token byte, out []byte) { // flag: 1 (skip), 2 (readTo), 4 (readUntil) if flag == 4 { @@ -544,15 +549,16 @@ type ioDecReader struct { rr io.Reader br io.ByteScanner - l byte // last byte - ls byte // last byte status. 0: init-canDoNothing, 1: canRead, 2: canUnread - trb bool // tracking bytes turned on - _ bool + l byte // last byte + ls byte // last byte status. 0: init-canDoNothing, 1: canRead, 2: canUnread b [4]byte // tiny buffer for reading single bytes + trb bool // tracking bytes turned on - x [scratchByteArrayLen]byte // for: get struct field name, swallow valueTypeBytes, etc - n int // num read - tr []byte // tracking bytes read + // temp byte array re-used internally for efficiency during read. + // shares buffer with Decoder, so we keep size of struct within 8 words. + x *[scratchByteArrayLen]byte + n int // num read + tr []byte // tracking bytes read } func (z *ioDecReader) reset(r io.Reader) { @@ -614,11 +620,11 @@ func (z *ioDecReader) UnreadByte() (err error) { case 2: z.ls = 1 case 0: - err = errDecUnreadByteNothingToRead + err = decUnreadByteNothingToReadErr case 1: - err = errDecUnreadByteLastByteNotRead + err = decUnreadByteLastByteNotReadErr default: - err = errDecUnreadByteUnknown + err = decUnreadByteUnknownErr } return } @@ -686,6 +692,16 @@ func (z *ioDecReader) readn1() (b uint8) { panic(err) } +func (z *ioDecReader) readn3() (b1, b2, b3 uint8) { + z.readb(z.b[:3]) + return z.b[0], z.b[1], z.b[2] +} + +func (z *ioDecReader) readn4() (b1, b2, b3, b4 uint8) { + z.readb(z.b[:4]) + return z.b[0], z.b[1], z.b[2], z.b[3] +} + func (z *ioDecReader) skip(accept *bitset256) (token byte) { for { var eof bool @@ -757,7 +773,7 @@ func (z *ioDecReader) stopTrack() (bs []byte) { // ------------------------------------ -var errBytesDecReaderCannotUnread = errors.New("cannot unread last byte read") +var bytesDecReaderCannotUnreadErr = errors.New("cannot unread last byte read") // bytesDecReader is a decReader that reads off a byte slice with zero copying type bytesDecReader struct { @@ -780,7 +796,7 @@ func (z *bytesDecReader) numread() int { func (z *bytesDecReader) unreadn1() { if z.c == 0 || len(z.b) == 0 { - panic(errBytesDecReaderCannotUnread) + panic(bytesDecReaderCannotUnreadErr) } z.c-- z.a++ @@ -820,6 +836,31 @@ func (z *bytesDecReader) readn1() (v uint8) { return } +func (z *bytesDecReader) readn3() (b1, b2, b3 uint8) { + if 3 > z.a { + panic(io.ErrUnexpectedEOF) + } + b3 = z.b[z.c+2] + b2 = z.b[z.c+1] + b1 = z.b[z.c] + z.c += 3 + z.a -= 3 + return +} + +func (z *bytesDecReader) readn4() (b1, b2, b3, b4 uint8) { + if 4 > z.a { + panic(io.ErrUnexpectedEOF) + } + b4 = z.b[z.c+3] + b3 = z.b[z.c+2] + b2 = z.b[z.c+1] + b1 = z.b[z.c] + z.c += 4 + z.a -= 4 + return +} + // func (z *bytesDecReader) readn1eof() (v uint8, eof bool) { // if z.a == 0 { // eof = true @@ -895,9 +936,9 @@ func (z *bytesDecReader) stopTrack() (bs []byte) { // ---------------------------------------- -// func (d *Decoder) builtin(f *codecFnInfo, rv reflect.Value) { -// d.d.DecodeBuiltin(f.ti.rtid, rv2i(rv)) -// } +func (d *Decoder) builtin(f *codecFnInfo, rv reflect.Value) { + d.d.DecodeBuiltin(f.ti.rtid, rv2i(rv)) +} func (d *Decoder) rawExt(f *codecFnInfo, rv reflect.Value) { d.d.DecodeExt(rv2i(rv), 0, nil) @@ -907,12 +948,29 @@ func (d *Decoder) ext(f *codecFnInfo, rv reflect.Value) { d.d.DecodeExt(rv2i(rv), f.xfTag, f.xfFn) } +func (d *Decoder) getValueForUnmarshalInterface(rv reflect.Value, indir int8) (v interface{}) { + if indir == -1 { + v = rv2i(rv.Addr()) + } else if indir == 0 { + v = rv2i(rv) + } else { + for j := int8(0); j < indir; j++ { + if rv.IsNil() { + rv.Set(reflect.New(rv.Type().Elem())) + } + rv = rv.Elem() + } + v = rv2i(rv) + } + return +} + func (d *Decoder) selferUnmarshal(f *codecFnInfo, rv reflect.Value) { - rv2i(rv).(Selfer).CodecDecodeSelf(d) + d.getValueForUnmarshalInterface(rv, f.ti.csIndir).(Selfer).CodecDecodeSelf(d) } func (d *Decoder) binaryUnmarshal(f *codecFnInfo, rv reflect.Value) { - bm := rv2i(rv).(encoding.BinaryUnmarshaler) + bm := d.getValueForUnmarshalInterface(rv, f.ti.bunmIndir).(encoding.BinaryUnmarshaler) xbs := d.d.DecodeBytes(nil, true) if fnerr := bm.UnmarshalBinary(xbs); fnerr != nil { panic(fnerr) @@ -920,7 +978,7 @@ func (d *Decoder) binaryUnmarshal(f *codecFnInfo, rv reflect.Value) { } func (d *Decoder) textUnmarshal(f *codecFnInfo, rv reflect.Value) { - tm := rv2i(rv).(encoding.TextUnmarshaler) + tm := d.getValueForUnmarshalInterface(rv, f.ti.tunmIndir).(encoding.TextUnmarshaler) fnerr := tm.UnmarshalText(d.d.DecodeStringAsBytes()) if fnerr != nil { panic(fnerr) @@ -928,7 +986,7 @@ func (d *Decoder) textUnmarshal(f *codecFnInfo, rv reflect.Value) { } func (d *Decoder) jsonUnmarshal(f *codecFnInfo, rv reflect.Value) { - tm := rv2i(rv).(jsonUnmarshaler) + tm := d.getValueForUnmarshalInterface(rv, f.ti.junmIndir).(jsonUnmarshaler) // bs := d.d.DecodeBytes(d.b[:], true, true) // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself. fnerr := tm.UnmarshalJSON(d.nextValueBytes()) @@ -953,6 +1011,7 @@ func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { return } // We cannot decode non-nil stream value into nil interface with methods (e.g. io.Reader). + // if num := f.ti.rt.NumMethod(); num > 0 { if f.ti.numMeth > 0 { d.errorf("cannot decode non-nil codec value into nil %v (%v methods)", f.ti.rt, f.ti.numMeth) return @@ -960,20 +1019,10 @@ func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { // var useRvn bool switch n.v { case valueTypeMap: - // if json, default to a map type with string keys - mtid := d.mtid - if mtid == 0 { - if d.jsms { - mtid = mapStrIntfTypId - } else { - mtid = mapIntfIntfTypId - } - } - if mtid == mapIntfIntfTypId { - n.initContainers() + if d.mtid == 0 || d.mtid == mapIntfIntfTypId { if n.lm < arrayCacheLen { n.ma[n.lm] = nil - rvn = n.rma[n.lm] + rvn = n.rr[decNakedMapIntfIntfIdx*arrayCacheLen+n.lm] n.lm++ d.decode(&n.ma[n.lm-1]) n.lm-- @@ -982,11 +1031,10 @@ func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { d.decode(&v2) rvn = reflect.ValueOf(&v2).Elem() } - } else if mtid == mapStrIntfTypId { // for json performance - n.initContainers() + } else if d.mtid == mapStrIntfTypId { // for json performance if n.ln < arrayCacheLen { n.na[n.ln] = nil - rvn = n.rna[n.ln] + rvn = n.rr[decNakedMapStrIntfIdx*arrayCacheLen+n.ln] n.ln++ d.decode(&n.na[n.ln-1]) n.ln-- @@ -996,21 +1044,20 @@ func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { rvn = reflect.ValueOf(&v2).Elem() } } else { - if d.mtr { - rvn = reflect.New(d.h.MapType) + rvn = reflect.New(d.h.MapType) + if useLookupRecognizedTypes && d.mtr { // isRecognizedRtid(d.mtid) { d.decode(rv2i(rvn)) rvn = rvn.Elem() } else { - rvn = reflect.New(d.h.MapType).Elem() - d.decodeValue(rvn, nil, true) + rvn = rvn.Elem() + d.decodeValue(rvn, nil, false, true) } } case valueTypeArray: if d.stid == 0 || d.stid == intfSliceTypId { - n.initContainers() if n.ls < arrayCacheLen { n.sa[n.ls] = nil - rvn = n.rsa[n.ls] + rvn = n.rr[decNakedSliceIntfIdx*arrayCacheLen+n.ls] n.ls++ d.decode(&n.sa[n.ls-1]) n.ls-- @@ -1025,20 +1072,19 @@ func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { rvn = rvn2 } } else { - if d.str { - rvn = reflect.New(d.h.SliceType) + rvn = reflect.New(d.h.SliceType) + if useLookupRecognizedTypes && d.str { // isRecognizedRtid(d.stid) { d.decode(rv2i(rvn)) rvn = rvn.Elem() } else { - rvn = reflect.New(d.h.SliceType).Elem() - d.decodeValue(rvn, nil, true) + rvn = rvn.Elem() + d.decodeValue(rvn, nil, false, true) } } case valueTypeExt: var v interface{} tag, bytes := n.u, n.l // calling decode below might taint the values if bytes == nil { - n.initContainers() if n.li < arrayCacheLen { n.ia[n.li] = nil n.li++ @@ -1070,21 +1116,21 @@ func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { case valueTypeNil: // no-op case valueTypeInt: - rvn = n.ri + rvn = n.rr[decNakedIntIdx] // d.np.get(&n.i) case valueTypeUint: - rvn = n.ru + rvn = n.rr[decNakedUintIdx] // d.np.get(&n.u) case valueTypeFloat: - rvn = n.rf + rvn = n.rr[decNakedFloatIdx] // d.np.get(&n.f) case valueTypeBool: - rvn = n.rb + rvn = n.rr[decNakedBoolIdx] // d.np.get(&n.b) case valueTypeString, valueTypeSymbol: - rvn = n.rs + rvn = n.rr[decNakedStringIdx] // d.np.get(&n.s) case valueTypeBytes: - rvn = n.rl - case valueTypeTime: - rvn = n.rt + rvn = n.rr[decNakedBytesIdx] // d.np.get(&n.l) + case valueTypeTimestamp: + rvn = n.rr[decNakedTimeIdx] // d.np.get(&n.t) default: - panicv.errorf("kInterfaceNaked: unexpected valueType: %d", n.v) + panic(fmt.Errorf("kInterfaceNaked: unexpected valueType: %d", n.v)) } return } @@ -1098,25 +1144,24 @@ func (d *Decoder) kInterface(f *codecFnInfo, rv reflect.Value) { // every interface passed here MUST be settable. var rvn reflect.Value - if rv.IsNil() || d.h.InterfaceReset { - // check if mapping to a type: if so, initialize it and move on - rvn = d.h.intf2impl(f.ti.rtid) - if rvn.IsValid() { + if rv.IsNil() { + if rvn = d.kInterfaceNaked(f); rvn.IsValid() { + rv.Set(rvn) + } + return + } + if d.h.InterfaceReset { + if rvn = d.kInterfaceNaked(f); rvn.IsValid() { rv.Set(rvn) } else { - rvn = d.kInterfaceNaked(f) - if rvn.IsValid() { - rv.Set(rvn) - } else if d.h.InterfaceReset { - // reset to zero value based on current type in there. - rv.Set(reflect.Zero(rv.Elem().Type())) - } - return + // reset to zero value based on current type in there. + rv.Set(reflect.Zero(rv.Elem().Type())) } - } else { - // now we have a non-nil interface value, meaning it contains a type - rvn = rv.Elem() + return } + + // now we have a non-nil interface value, meaning it contains a type + rvn = rv.Elem() if d.d.TryDecodeAsNil() { rv.Set(reflect.Zero(rvn.Type())) return @@ -1129,38 +1174,28 @@ func (d *Decoder) kInterface(f *codecFnInfo, rv reflect.Value) { rvn2, canDecode := isDecodeable(rvn) if canDecode { - d.decodeValue(rvn2, nil, true) + d.decodeValue(rvn2, nil, true, true) return } rvn2 = reflect.New(rvn.Type()).Elem() rvn2.Set(rvn) - d.decodeValue(rvn2, nil, true) + d.decodeValue(rvn2, nil, true, true) rv.Set(rvn2) } -func decStructFieldKey(dd decDriver, keyType valueType, b *[decScratchByteArrayLen]byte) (rvkencname []byte) { - // use if-else-if, not switch (which compiles to binary-search) - // since keyType is typically valueTypeString, branch prediction is pretty good. - - if keyType == valueTypeString { - rvkencname = dd.DecodeStringAsBytes() - } else if keyType == valueTypeInt { - rvkencname = strconv.AppendInt(b[:0], dd.DecodeInt64(), 10) - } else if keyType == valueTypeUint { - rvkencname = strconv.AppendUint(b[:0], dd.DecodeUint64(), 10) - } else if keyType == valueTypeFloat { - rvkencname = strconv.AppendFloat(b[:0], dd.DecodeFloat64(), 'f', -1, 64) - } else { - rvkencname = dd.DecodeStringAsBytes() - } - return rvkencname -} - func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { + // checking if recognized within kstruct is too expensive. + // only check where you can determine if valid outside the loop + // ie on homogenous collections: slices, arrays and maps. + // + // if true, we don't create too many decFn's. + // It's a delicate balance. + const checkRecognized bool = false // false: TODO + fti := f.ti dd := d.d - elemsep := d.esep + elemsep := d.hh.hasElemSeparators() sfn := structFieldNode{v: rv, update: true} ctyp := dd.ContainerType() if ctyp == valueTypeMap { @@ -1169,15 +1204,17 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { dd.ReadMapEnd() return } - tisfi := fti.sfiSort + tisfi := fti.sfi hasLen := containerLen >= 0 - var rvkencname []byte for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + // rvkencname := dd.DecodeString() if elemsep { dd.ReadMapElemKey() } - rvkencname = decStructFieldKey(dd, fti.keyType, &d.b) + rvkencnameB := dd.DecodeStringAsBytes() + rvkencname := stringView(rvkencnameB) + // rvksi := ti.getForEncName(rvkencname) if elemsep { dd.ReadMapElemValue() } @@ -1186,12 +1223,12 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { if dd.TryDecodeAsNil() { si.setToZeroValue(rv) } else { - d.decodeValue(sfn.field(si), nil, true) + d.decodeValue(sfn.field(si), nil, checkRecognized, true) } } else { - d.structFieldNotFound(-1, stringView(rvkencname)) + d.structFieldNotFound(-1, rvkencname) } - // keepAlive4StringView(rvkencnameB) // not needed, as reference is outside loop + // keepAlive4StringView(rvkencnameB) // maintain ref 4 stringView // not needed, as reference is outside loop } dd.ReadMapEnd() } else if ctyp == valueTypeArray { @@ -1203,7 +1240,7 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { // Not much gain from doing it two ways for array. // Arrays are not used as much for structs. hasLen := containerLen >= 0 - for j, si := range fti.sfiSrc { + for j, si := range fti.sfip { if (hasLen && j == containerLen) || (!hasLen && dd.CheckBreak()) { break } @@ -1213,12 +1250,12 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { if dd.TryDecodeAsNil() { si.setToZeroValue(rv) } else { - d.decodeValue(sfn.field(si), nil, true) + d.decodeValue(sfn.field(si), nil, checkRecognized, true) } } - if containerLen > len(fti.sfiSrc) { + if containerLen > len(fti.sfip) { // read remaining values and throw away - for j := len(fti.sfiSrc); j < containerLen; j++ { + for j := len(fti.sfip); j < containerLen; j++ { if elemsep { dd.ReadArrayElem() } @@ -1227,7 +1264,7 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { } dd.ReadArrayEnd() } else { - d.errorstr(errstrOnlyMapOrArrayCanDecodeIntoStruct) + d.error(onlyMapOrArrayCanDecodeIntoStructErr) return } } @@ -1236,35 +1273,27 @@ 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 { - d.errorf("receive-only channel cannot be used for sending byte(s)") - } dd := d.d - rtelem0 := ti.elem + rtelem0 := ti.rt.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) + d.errorf("bytes or string in the stream must be decoded into a slice or array of bytes, not %v", ti.rt) } if f.seq == seqTypeChan { bs2 := dd.DecodeBytes(nil, true) - irv := rv2i(rv) - ch, ok := irv.(chan<- byte) - if !ok { - ch = irv.(chan byte) - } + ch := rv2i(rv).(chan<- byte) for _, b := range bs2 { ch <- b } } else { rvbs := rv.Bytes() bs2 := dd.DecodeBytes(rvbs, false) - // if rvbs == nil && bs2 != nil || rvbs != nil && bs2 == nil || len(bs2) != len(rvbs) { - if !(len(bs2) > 0 && len(bs2) == len(rvbs) && &bs2[0] == &rvbs[0]) { + if rvbs == nil && bs2 != nil || rvbs != nil && bs2 == nil || len(bs2) != len(rvbs) { if rv.CanSet() { rv.SetBytes(bs2) - } else if len(rvbs) > 0 && len(bs2) > 0 { + } else { copy(rvbs, bs2) } } @@ -1297,6 +1326,7 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { rtelem0Size := int(rtelem0.Size()) rtElem0Kind := rtelem0.Kind() + rtElem0Id := rt2id(rtelem0) rtelem0Mut := !isImmutableKind(rtElem0Kind) rtelem := rtelem0 rtelemkind := rtelem.Kind() @@ -1307,10 +1337,9 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { var fn *codecFn - var rvCanset = rv.CanSet() - var rvChanged bool - var rv0 = rv - var rv9 reflect.Value + var rv0, rv9 reflect.Value + rv0 = rv + rvChanged := false rvlen := rv.Len() rvcap := rv.Cap() @@ -1320,38 +1349,42 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { oldRvlenGtZero := rvlen > 0 rvlen = decInferLen(containerLenS, d.h.MaxInitLen, int(rtelem0.Size())) if rvlen <= rvcap { - if rvCanset { + if rv.CanSet() { rv.SetLen(rvlen) + } else { + rv = rv.Slice(0, rvlen) + rvChanged = true } - } else if rvCanset { + } else { rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) rvcap = rvlen rvChanged = true - } else { - d.errorf("cannot decode into non-settable slice") } if rvChanged && oldRvlenGtZero && !isImmutableKind(rtelem0.Kind()) { reflect.Copy(rv, rv0) // only copy up to length NOT cap i.e. rv0.Slice(0, rvcap) } } else if containerLenS != rvlen { rvlen = containerLenS - if rvCanset { + if rv.CanSet() { rv.SetLen(rvlen) + } else { + rv = rv.Slice(0, rvlen) + rvChanged = true } - // else { - // rv = rv.Slice(0, rvlen) - // rvChanged = true - // d.errorf("cannot decode into non-settable slice") - // } } } + var recognizedRtid, recognizedRtidPtr bool + if useLookupRecognizedTypes { + recognizedRtid = isRecognizedRtid(rtElem0Id) + recognizedRtidPtr = isRecognizedRtidPtr(rtElem0Id) + } + // consider creating new element once, and just decoding into it. var rtelem0Zero reflect.Value var rtelem0ZeroValid bool var decodeAsNil bool var j int - d.cfer() for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { if j == 0 && (f.seq == seqTypeSlice || f.seq == seqTypeChan) && rv.IsNil() { if hasLen { @@ -1359,16 +1392,11 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { } else { rvlen = 8 } - if rvCanset { - if f.seq == seqTypeSlice { - rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) - rvChanged = true - } else { // chan - rv = reflect.MakeChan(ti.rt, rvlen) - rvChanged = true - } - } else { - d.errorf("cannot decode into non-settable slice") + if f.seq == seqTypeSlice { + rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) + rvChanged = true + } else if f.seq == seqTypeChan { + rv.Set(reflect.MakeChan(ti.rt, rvlen)) } } slh.ElemContainerState(j) @@ -1381,10 +1409,14 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { if rtelem0Mut || !rv9.IsValid() { // || (rtElem0Kind == reflect.Ptr && rv9.IsNil()) { rv9 = reflect.New(rtelem0).Elem() } - if fn == nil { - fn = d.cf.get(rtelem, true, true) + if useLookupRecognizedTypes && (recognizedRtid || recognizedRtidPtr) { + d.decode(rv2i(rv9.Addr())) + } else { + if fn == nil { + fn = d.cf.get(rtelem, true, true) + } + d.decodeValue(rv9, fn, false, true) } - d.decodeValue(rv9, fn, true) rv.Send(rv9) } else { // if indefinite, etc, then expand the slice if necessary @@ -1394,14 +1426,9 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { d.arrayCannotExpand(rvlen, j+1) decodeIntoBlank = true } else { // if f.seq == seqTypeSlice - // rv = reflect.Append(rv, reflect.Zero(rtelem0)) // append logic + varargs + // rv = reflect.Append(rv, reflect.Zero(rtelem0)) // uses append logic, plus varargs var rvcap2 int - var rvErrmsg2 string - rv9, rvcap2, rvChanged, rvErrmsg2 = - expandSliceRV(rv, ti.rt, rvCanset, rtelem0Size, 1, rvlen, rvcap) - if rvErrmsg2 != "" { - d.errorf(rvErrmsg2) - } + rv9, rvcap2, rvChanged = decExpandSliceRV(rv, ti.rt, rtelem0Size, 1, rvlen, rvcap) rvlen++ if rvChanged { rv = rv9 @@ -1426,10 +1453,19 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { continue } - if fn == nil { - fn = d.cf.get(rtelem, true, true) + if useLookupRecognizedTypes && recognizedRtid { + d.decode(rv2i(rv9.Addr())) + } else if useLookupRecognizedTypes && recognizedRtidPtr { // && !rv9.IsNil() { + if rv9.IsNil() { + rv9.Set(reflect.New(rtelem)) + } + d.decode(rv2i(rv9)) + } else { + if fn == nil { + fn = d.cf.get(rtelem, true, true) + } + d.decodeValue(rv9, fn, false, true) } - d.decodeValue(rv9, fn, true) } } } @@ -1437,21 +1473,19 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { if j < rvlen { if rv.CanSet() { rv.SetLen(j) - } else if rvCanset { + } else { rv = rv.Slice(0, j) rvChanged = true - } // else { d.errorf("kSlice: cannot change non-settable slice") } + } rvlen = j } else if j == 0 && rv.IsNil() { - if rvCanset { - rv = reflect.MakeSlice(ti.rt, 0, 0) - rvChanged = true - } // else { d.errorf("kSlice: cannot change non-settable slice") } + rv = reflect.MakeSlice(ti.rt, 0, 0) + rvChanged = true } } slh.End() - if rvChanged { // infers rvCanset=true, so it can be reset + if rvChanged { rv0.Set(rv) } } @@ -1464,7 +1498,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 + elemsep := d.hh.hasElemSeparators() ti := f.ti if rv.IsNil() { rv.Set(makeMapReflect(ti.rt, containerLen)) @@ -1475,13 +1509,20 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { return } - ktype, vtype := ti.key, ti.elem + ktype, vtype := ti.rt.Key(), ti.rt.Elem() ktypeId := rt2id(ktype) + vtypeId := rt2id(vtype) vtypeKind := vtype.Kind() + var recognizedKtyp, recognizedVtyp, recognizedPtrKtyp, recognizedPtrVtyp bool + if useLookupRecognizedTypes { + recognizedKtyp = isRecognizedRtid(ktypeId) + recognizedVtyp = isRecognizedRtid(vtypeId) + recognizedPtrKtyp = isRecognizedRtidPtr(ktypeId) + recognizedPtrVtyp = isRecognizedRtidPtr(vtypeId) + } var keyFn, valFn *codecFn var ktypeLo, vtypeLo reflect.Type - for ktypeLo = ktype; ktypeLo.Kind() == reflect.Ptr; ktypeLo = ktypeLo.Elem() { } @@ -1512,39 +1553,45 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { ktypeIsIntf := ktypeId == intfTypId hasLen := containerLen > 0 var kstrbs []byte - d.cfer() for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if elemsep { + dd.ReadMapElemKey() + } + // if a nil key, just ignore the mapped value and continue + if dd.TryDecodeAsNil() { + if elemsep { + dd.ReadMapElemValue() + } + d.swallow() + continue + } if rvkMut || !rvkp.IsValid() { rvkp = reflect.New(ktype) rvk = rvkp.Elem() } - if elemsep { - dd.ReadMapElemKey() - } - 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} - // to be an empty map. - // Instead, we treat a nil key as the zero value of the type. - rvk.Set(reflect.Zero(ktype)) - } else if ktypeIsString { + if ktypeIsString { kstrbs = dd.DecodeStringAsBytes() rvk.SetString(stringView(kstrbs)) // NOTE: if doing an insert, you MUST use a real string (not stringview) + } else if useLookupRecognizedTypes && recognizedKtyp { + d.decode(rv2i(rvkp)) + // rvk = rvkp.Elem() //TODO: remove, unnecessary + } else if useLookupRecognizedTypes && recognizedPtrKtyp { + if rvk.IsNil() { + rvk = reflect.New(ktypeLo) + } + d.decode(rv2i(rvk)) } else { if keyFn == nil { keyFn = d.cf.get(ktypeLo, true, true) } - d.decodeValue(rvk, keyFn, true) + d.decodeValue(rvk, keyFn, false, true) } // special case if a byte array. if ktypeIsIntf { - if rvk2 := rvk.Elem(); rvk2.IsValid() { - if rvk2.Type() == uint8SliceTyp { - rvk = reflect.ValueOf(d.string(rvk2.Bytes())) - } else { - rvk = rvk2 - } + rvk = rvk.Elem() + if rvk.Type() == uint8SliceTyp { + rvk = reflect.ValueOf(d.string(rvk.Bytes())) } } @@ -1602,11 +1649,21 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { if mapSet && ktypeIsString { rvk.SetString(d.string(kstrbs)) } - if valFn == nil { - valFn = d.cf.get(vtypeLo, true, true) + if useLookupRecognizedTypes && recognizedVtyp && rvv.CanAddr() { + d.decode(rv2i(rvv.Addr())) + } else if useLookupRecognizedTypes && recognizedPtrVtyp { + if rvv.IsNil() { + rvv = reflect.New(vtypeLo) + mapSet = true + } + d.decode(rv2i(rvv)) + } else { + if valFn == nil { + valFn = d.cf.get(vtypeLo, true, true) + } + d.decodeValue(rvv, valFn, false, true) + // d.decodeValueFn(rvv, valFn) } - d.decodeValue(rvv, valFn, true) - // d.decodeValueFn(rvv, valFn) if mapSet { rv.SetMapIndex(rvk, rvv) } @@ -1636,77 +1693,78 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { // // kInterfaceNaked will ensure that there is no allocation for the common // uses. +type decNaked struct { + // r RawExt // used for RawExt, uint, []byte. + u uint64 + i int64 + f float64 + l []byte + s string + t time.Time + + b bool + + inited bool + + v valueType + + li, lm, ln, ls int8 -type decNakedContainers struct { // array/stacks for reducing allocation // keep arrays at the bottom? Chance is that they are not used much. ia [arrayCacheLen]interface{} ma [arrayCacheLen]map[interface{}]interface{} na [arrayCacheLen]map[string]interface{} sa [arrayCacheLen][]interface{} + // ra [2]RawExt - // ria [arrayCacheLen]reflect.Value // not needed, as we decode directly into &ia[n] - rma, rna, rsa [arrayCacheLen]reflect.Value // reflect.Value mapping to above + rr [5 * arrayCacheLen]reflect.Value } -func (n *decNakedContainers) init() { - for i := 0; i < arrayCacheLen; i++ { - // n.ria[i] = reflect.ValueOf(&(n.ia[i])).Elem() - n.rma[i] = reflect.ValueOf(&(n.ma[i])).Elem() - n.rna[i] = reflect.ValueOf(&(n.na[i])).Elem() - n.rsa[i] = reflect.ValueOf(&(n.sa[i])).Elem() - } -} - -type decNaked struct { - // r RawExt // used for RawExt, uint, []byte. - - // primitives below - u uint64 - i int64 - f float64 - l []byte - s string - - // ---- cpu cache line boundary? - t time.Time - b bool - - // state - v valueType - li, lm, ln, ls int8 - inited bool - - *decNakedContainers - - ru, ri, rf, rl, rs, rb, rt reflect.Value // mapping to the primitives above - - // _ [6]uint64 // padding // no padding - rt goes into next cache line -} +const ( + decNakedUintIdx = iota + decNakedIntIdx + decNakedFloatIdx + decNakedBytesIdx + decNakedStringIdx + decNakedTimeIdx + decNakedBoolIdx +) +const ( + _ = iota // maps to the scalars above + decNakedIntfIdx + decNakedMapIntfIntfIdx + decNakedMapStrIntfIdx + decNakedSliceIntfIdx +) func (n *decNaked) init() { if n.inited { return } - n.ru = reflect.ValueOf(&n.u).Elem() - n.ri = reflect.ValueOf(&n.i).Elem() - n.rf = reflect.ValueOf(&n.f).Elem() - n.rl = reflect.ValueOf(&n.l).Elem() - n.rs = reflect.ValueOf(&n.s).Elem() - n.rt = reflect.ValueOf(&n.t).Elem() - n.rb = reflect.ValueOf(&n.b).Elem() + // n.ms = n.ma[:0] + // n.is = n.ia[:0] + // n.ns = n.na[:0] + // n.ss = n.sa[:0] + n.rr[decNakedUintIdx] = reflect.ValueOf(&n.u).Elem() + n.rr[decNakedIntIdx] = reflect.ValueOf(&n.i).Elem() + n.rr[decNakedFloatIdx] = reflect.ValueOf(&n.f).Elem() + n.rr[decNakedBytesIdx] = reflect.ValueOf(&n.l).Elem() + n.rr[decNakedStringIdx] = reflect.ValueOf(&n.s).Elem() + n.rr[decNakedTimeIdx] = reflect.ValueOf(&n.t).Elem() + n.rr[decNakedBoolIdx] = reflect.ValueOf(&n.b).Elem() + + for i := range [arrayCacheLen]struct{}{} { + n.rr[decNakedIntfIdx*arrayCacheLen+i] = reflect.ValueOf(&(n.ia[i])).Elem() + n.rr[decNakedMapIntfIntfIdx*arrayCacheLen+i] = reflect.ValueOf(&(n.ma[i])).Elem() + n.rr[decNakedMapStrIntfIdx*arrayCacheLen+i] = reflect.ValueOf(&(n.na[i])).Elem() + n.rr[decNakedSliceIntfIdx*arrayCacheLen+i] = reflect.ValueOf(&(n.sa[i])).Elem() + } n.inited = true // n.rr[] = reflect.ValueOf(&n.) } -func (n *decNaked) initContainers() { - if n.decNakedContainers == nil { - n.decNakedContainers = new(decNakedContainers) - n.decNakedContainers.init() - } -} - func (n *decNaked) reset() { if n == nil { return @@ -1719,92 +1777,8 @@ type rtid2rv struct { rv reflect.Value } -// -------------- - -type decReaderSwitch struct { - rb bytesDecReader - // ---- cpu cache line boundary? - ri *ioDecReader - mtr, str bool // whether maptype or slicetype are known types - - be bool // is binary encoding - bytes bool // is bytes reader - js bool // is json handle - jsms bool // is json handle, and MapKeyAsString - esep bool // has elem separators -} - -// TODO: Uncomment after mid-stack inlining enabled in go 1.10 -// -// func (z *decReaderSwitch) unreadn1() { -// if z.bytes { -// z.rb.unreadn1() -// } else { -// z.ri.unreadn1() -// } -// } -// func (z *decReaderSwitch) readx(n int) []byte { -// if z.bytes { -// return z.rb.readx(n) -// } -// return z.ri.readx(n) -// } -// func (z *decReaderSwitch) readb(s []byte) { -// if z.bytes { -// z.rb.readb(s) -// } else { -// z.ri.readb(s) -// } -// } -// func (z *decReaderSwitch) readn1() uint8 { -// if z.bytes { -// return z.rb.readn1() -// } -// return z.ri.readn1() -// } -// func (z *decReaderSwitch) numread() int { -// if z.bytes { -// return z.rb.numread() -// } -// return z.ri.numread() -// } -// func (z *decReaderSwitch) track() { -// if z.bytes { -// z.rb.track() -// } else { -// z.ri.track() -// } -// } -// func (z *decReaderSwitch) stopTrack() []byte { -// if z.bytes { -// return z.rb.stopTrack() -// } -// return z.ri.stopTrack() -// } -// func (z *decReaderSwitch) skip(accept *bitset256) (token byte) { -// if z.bytes { -// return z.rb.skip(accept) -// } -// return z.ri.skip(accept) -// } -// func (z *decReaderSwitch) readTo(in []byte, accept *bitset256) (out []byte) { -// if z.bytes { -// return z.rb.readTo(in, accept) -// } -// return z.ri.readTo(in, accept) -// } -// func (z *decReaderSwitch) readUntil(in []byte, stop byte) (out []byte) { -// if z.bytes { -// return z.rb.readUntil(in, stop) -// } -// return z.ri.readUntil(in, stop) -// } - -const decScratchByteArrayLen = cacheLineSize - 8 - // A Decoder reads and decodes an object from an input stream in the codec format. type Decoder struct { - panicHdl // hopefully, reduce derefencing cost by laying the decReader inside the Decoder. // Try to put things that go together to fit within a cache line (8 words). @@ -1812,28 +1786,42 @@ type Decoder struct { // NOTE: Decoder shouldn't call it's read methods, // as the handler MAY need to do some coordination. r decReader + hh Handle h *BasicHandle - bi *bufioDecReader + + mtr, mtrp, str, strp bool // + + be bool // is binary encoding + bytes bool // is bytes reader + js bool // is json handle + + // ---- cpu cache line boundary? + + rb bytesDecReader + ri ioDecReader + bi bufioDecReader + + // cr containerStateRecv + + n *decNaked + nsp *sync.Pool + + // ---- cpu cache line boundary? + + is map[string]string // used for interning strings + // cache the mapTypeId and sliceTypeId for faster comparisons mtid uintptr stid uintptr - // ---- cpu cache line boundary? - decReaderSwitch + b [scratchByteArrayLen]byte + // _ uintptr // for alignment purposes, so next one starts from a cache line - // ---- cpu cache line boundary? - codecFnPooler - // cr containerStateRecv - n *decNaked - nsp *sync.Pool err error - // ---- cpu cache line boundary? - b [decScratchByteArrayLen]byte // scratch buffer, used by Decoder and xxxEncDrivers - is map[string]string // used for interning strings - // padding - false sharing help // modify 232 if Decoder struct changes. - // _ [cacheLineSize - 232%cacheLineSize]byte + cf codecFner + // _ [64]byte // force alignment??? } // NewDecoder returns a Decoder for decoding a stream of bytes from an io.Reader. @@ -1857,16 +1845,11 @@ func NewDecoderBytes(in []byte, h Handle) *Decoder { var defaultDecNaked decNaked func newDecoder(h Handle) *Decoder { - d := &Decoder{h: h.getBasicHandle(), err: errDecoderNotInitialized} - d.hh = h - d.be = h.isBinary() + d := &Decoder{hh: h, h: h.getBasicHandle(), 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) - if d.js { - d.jsms = jh.MapKeyAsString - } - d.esep = d.hh.hasElemSeparators() + + _, d.js = h.(*JsonHandle) if d.h.InternString { d.is = make(map[string]string, 32) } @@ -1875,61 +1858,6 @@ func newDecoder(h Handle) *Decoder { return d } -func (d *Decoder) resetCommon() { - d.n.reset() - d.d.reset() - d.err = nil - // reset all things which were cached from the Handle, but could change - d.mtid, d.stid = 0, 0 - d.mtr, d.str = false, false - if d.h.MapType != nil { - d.mtid = rt2id(d.h.MapType) - d.mtr = fastpathAV.index(d.mtid) != -1 - } - if d.h.SliceType != nil { - d.stid = rt2id(d.h.SliceType) - d.str = fastpathAV.index(d.stid) != -1 - } -} - -// Reset the Decoder with a new Reader to decode from, -// clearing all state from last run(s). -func (d *Decoder) Reset(r io.Reader) { - if r == nil { - return - } - if d.bi == nil { - d.bi = new(bufioDecReader) - } - d.bytes = false - if d.h.ReaderBufferSize > 0 { - d.bi.buf = make([]byte, 0, d.h.ReaderBufferSize) - d.bi.reset(r) - d.r = d.bi - } else { - // d.ri.x = &d.b - // d.s = d.sa[:0] - if d.ri == nil { - d.ri = new(ioDecReader) - } - d.ri.reset(r) - d.r = d.ri - } - d.resetCommon() -} - -// ResetBytes resets the Decoder with a new []byte to decode from, -// clearing all state from last run(s). -func (d *Decoder) ResetBytes(in []byte) { - if in == nil { - return - } - d.bytes = true - d.rb.reset(in) - d.r = &d.rb - d.resetCommon() -} - // naked must be called before each call to .DecodeNaked, // as they will use it. func (d *Decoder) naked() *decNaked { @@ -1949,6 +1877,52 @@ func (d *Decoder) naked() *decNaked { return d.n } +func (d *Decoder) resetCommon() { + d.n.reset() + d.d.reset() + d.cf.reset(d.hh) + d.err = nil + // reset all things which were cached from the Handle, + // but could be changed. + d.mtid, d.stid = 0, 0 + d.mtr, d.mtrp, d.str, d.strp = false, false, false, false + if d.h.MapType != nil { + d.mtid = rt2id(d.h.MapType) + if useLookupRecognizedTypes { + d.mtr = isRecognizedRtid(d.mtid) + d.mtrp = isRecognizedRtidPtr(d.mtid) + } + } + if d.h.SliceType != nil { + d.stid = rt2id(d.h.SliceType) + if useLookupRecognizedTypes { + d.str = isRecognizedRtid(d.stid) + d.strp = isRecognizedRtidPtr(d.stid) + } + } +} + +func (d *Decoder) Reset(r io.Reader) { + if d.h.ReaderBufferSize > 0 { + d.bi.buf = make([]byte, 0, d.h.ReaderBufferSize) + d.bi.reset(r) + d.r = &d.bi + } else { + d.ri.x = &d.b + // d.s = d.sa[:0] + d.ri.reset(r) + d.r = &d.ri + } + d.resetCommon() +} + +func (d *Decoder) ResetBytes(in []byte) { + d.bytes = true + d.rb.reset(in) + d.r = &d.rb + d.resetCommon() +} + // Decode decodes the stream from reader and stores the result in the // value pointed to by v. v cannot be a nil pointer. v can also be // a reflect.Value of a pointer. @@ -1999,12 +1973,8 @@ func (d *Decoder) naked() *decNaked { // However, when decoding a stream nil, we reset the destination container // to its "zero" value (e.g. nil for slice/map, etc). // -// Note: we allow nil values in the stream anywhere except for map keys. -// A nil value in the encoded stream where a map key is expected is treated as an error. func (d *Decoder) Decode(v interface{}) (err error) { - // need to call defer directly, else it seems the recover is not fully handled - defer panicToErrs2(d, &d.err, &err) - defer d.alwaysAtEnd() + defer panicToErrs2(&d.err, &err) d.MustDecode(v) return } @@ -2017,11 +1987,18 @@ func (d *Decoder) MustDecode(v interface{}) { panic(d.err) } if d.d.TryDecodeAsNil() { - setZero(v) + d.setZero(v) } else { d.decode(v) } - d.alwaysAtEnd() + if d.nsp != nil { + if d.n != nil { + d.nsp.Put(d.n) + d.n = nil + } + d.nsp = nil + } + d.n = nil // xprintf(">>>>>>>> >>>>>>>> num decFns: %v\n", d.cf.sn) } @@ -2031,22 +2008,13 @@ func (d *Decoder) MustDecode(v interface{}) { // d.decodeValueNoFn(reflect.ValueOf(&blank).Elem()) // } -func (d *Decoder) alwaysAtEnd() { - if d.n != nil { - // if n != nil, then nsp != nil (they are always set together) - d.nsp.Put(d.n) - d.n, d.nsp = nil, nil - } - d.codecFnPooler.alwaysAtEnd() -} - func (d *Decoder) swallow() { // smarter decode that just swallows the content dd := d.d if dd.TryDecodeAsNil() { return } - elemsep := d.esep + elemsep := d.hh.hasElemSeparators() switch dd.ContainerType() { case valueTypeMap: containerLen := dd.ReadMapStart() @@ -2083,7 +2051,6 @@ func (d *Decoder) swallow() { n := d.naked() dd.DecodeNaked() if n.v == valueTypeExt && n.l == nil { - n.initContainers() if n.li < arrayCacheLen { n.ia[n.li] = nil n.li++ @@ -2098,11 +2065,10 @@ func (d *Decoder) swallow() { } } -func setZero(iv interface{}) { +func (d *Decoder) setZero(iv interface{}) { if iv == nil || definitelyNil(iv) { return } - var canDecode bool switch v := iv.(type) { case *string: *v = "" @@ -2136,16 +2102,16 @@ func setZero(iv interface{}) { *v = nil case *Raw: *v = nil - case *time.Time: - *v = time.Time{} case reflect.Value: - if v, canDecode = isDecodeable(v); canDecode && v.CanSet() { + v = d.ensureDecodeable(v) + if v.CanSet() { v.Set(reflect.Zero(v.Type())) } // TODO: else drain if chan, clear if map, set all to nil if slice??? default: - if !fastpathDecodeSetZeroTypeSwitch(iv) { + if !fastpathDecodeSetZeroTypeSwitch(iv, d) { v := reflect.ValueOf(iv) - if v, canDecode = isDecodeable(v); canDecode && v.CanSet() { + v = d.ensureDecodeable(v) + if v.CanSet() { v.Set(reflect.Zero(v.Type())) } // TODO: else drain if chan, clear if map, set all to nil if slice??? } @@ -2156,7 +2122,7 @@ func (d *Decoder) decode(iv interface{}) { // check nil and interfaces explicitly, // so that type switches just have a run of constant non-interface types. if iv == nil { - d.errorstr(errstrCannotDecodeIntoNil) + d.error(cannotDecodeIntoNilErr) return } if v, ok := iv.(Selfer); ok { @@ -2170,67 +2136,57 @@ func (d *Decoder) decode(iv interface{}) { case reflect.Value: v = d.ensureDecodeable(v) - d.decodeValue(v, nil, true) + d.decodeValue(v, nil, false, true) // TODO: maybe ask to recognize ... case *string: *v = d.d.DecodeString() case *bool: *v = d.d.DecodeBool() case *int: - *v = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + *v = int(d.d.DecodeInt(intBitsize)) case *int8: - *v = int8(chkOvf.IntV(d.d.DecodeInt64(), 8)) + *v = int8(d.d.DecodeInt(8)) case *int16: - *v = int16(chkOvf.IntV(d.d.DecodeInt64(), 16)) + *v = int16(d.d.DecodeInt(16)) case *int32: - *v = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) + *v = int32(d.d.DecodeInt(32)) case *int64: - *v = d.d.DecodeInt64() + *v = d.d.DecodeInt(64) case *uint: - *v = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + *v = uint(d.d.DecodeUint(uintBitsize)) case *uint8: - *v = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + *v = uint8(d.d.DecodeUint(8)) case *uint16: - *v = uint16(chkOvf.UintV(d.d.DecodeUint64(), 16)) + *v = uint16(d.d.DecodeUint(16)) case *uint32: - *v = uint32(chkOvf.UintV(d.d.DecodeUint64(), 32)) + *v = uint32(d.d.DecodeUint(32)) case *uint64: - *v = d.d.DecodeUint64() + *v = d.d.DecodeUint(64) case *float32: - f64 := d.d.DecodeFloat64() - if chkOvf.Float32(f64) { - d.errorf("float32 overflow: %v", f64) - } - *v = float32(f64) + *v = float32(d.d.DecodeFloat(true)) case *float64: - *v = d.d.DecodeFloat64() + *v = d.d.DecodeFloat(false) case *[]uint8: *v = d.d.DecodeBytes(*v, false) - case []uint8: - b := d.d.DecodeBytes(v, false) - if !(len(b) > 0 && len(b) == len(v) && &b[0] == &v[0]) { - copy(v, b) - } - case *time.Time: - *v = d.d.DecodeTime() + case *Raw: *v = d.rawBytes() case *interface{}: - d.decodeValue(reflect.ValueOf(iv).Elem(), nil, true) + d.decodeValue(reflect.ValueOf(iv).Elem(), nil, false, true) // TODO: consider recognize here // d.decodeValueNotNil(reflect.ValueOf(iv).Elem()) default: if !fastpathDecodeTypeSwitch(iv, d) { v := reflect.ValueOf(iv) v = d.ensureDecodeable(v) - d.decodeValue(v, nil, false) + d.decodeValue(v, nil, false, false) // d.decodeValueFallback(v) } } } -func (d *Decoder) decodeValue(rv reflect.Value, fn *codecFn, chkAll bool) { +func (d *Decoder) decodeValue(rv reflect.Value, fn *codecFn, tryRecognized, chkAll bool) { // If stream is not containing a nil value, then we can deref to the base // non-pointer value, and decode into that. var rvp reflect.Value @@ -2249,19 +2205,27 @@ func (d *Decoder) decodeValue(rv reflect.Value, fn *codecFn, chkAll bool) { } } + if useLookupRecognizedTypes && tryRecognized && isRecognizedRtid(rv2rtid(rv)) { + if rvpValid { + d.decode(rv2i(rvp)) + return + } else if rv.CanAddr() { + d.decode(rv2i(rv.Addr())) + return + } + } + if fn == nil { // always pass checkCodecSelfer=true, in case T or ****T is passed, where *T is a Selfer - fn = d.cfer().get(rv.Type(), chkAll, true) // chkAll, chkAll) + fn = d.cf.get(rv.Type(), chkAll, true) // chkAll, chkAll) } - if fn.i.addrD { + if fn.i.addr { if rvpValid { fn.fd(d, &fn.i, rvp) } else if rv.CanAddr() { fn.fd(d, &fn.i, rv.Addr()) - } else if !fn.i.addrF { - fn.fd(d, &fn.i, rv) } else { - d.errorf("cannot decode into a non-pointer value") + fn.fd(d, &fn.i, rv) } } else { fn.fd(d, &fn.i, rv) @@ -2317,7 +2281,7 @@ func (d *Decoder) ensureDecodeable(rv reflect.Value) (rv2 reflect.Value) { return } if !rv.IsValid() { - d.errorstr(errstrCannotDecodeIntoNil) + d.error(cannotDecodeIntoNilErr) return } if !rv.CanInterface() { @@ -2325,11 +2289,43 @@ func (d *Decoder) ensureDecodeable(rv reflect.Value) (rv2 reflect.Value) { return } rvi := rv2i(rv) - rvk := rv.Kind() - d.errorf("cannot decode into value of kind: %v, type: %T, %v", rvk, rvi, rvi) + d.errorf("cannot decode into value of kind: %v, type: %T, %v", rv.Kind(), rvi, rvi) return } +// func (d *Decoder) chkPtrValue(rv reflect.Value) { +// // We can only decode into a non-nil pointer +// if rv.Kind() == reflect.Ptr && !rv.IsNil() { +// return +// } +// d.errNotValidPtrValue(rv) +// } + +// func (d *Decoder) errNotValidPtrValue(rv reflect.Value) { +// if !rv.IsValid() { +// d.error(cannotDecodeIntoNilErr) +// return +// } +// if !rv.CanInterface() { +// d.errorf("cannot decode into a value without an interface: %v", rv) +// return +// } +// rvi := rv2i(rv) +// d.errorf("cannot decode into non-pointer or nil pointer. Got: %v, %T, %v", rv.Kind(), rvi, rvi) +// } + +func (d *Decoder) error(err error) { + panic(err) +} + +func (d *Decoder) errorf(format string, params ...interface{}) { + params2 := make([]interface{}, len(params)+1) + params2[0] = d.r.numread() + copy(params2[1:], params) + err := fmt.Errorf("[pos %d]: "+format, params2...) + panic(err) +} + // Possibly get an interned version of a string // // This should mostly be used for map keys, where the key type is string. @@ -2364,10 +2360,6 @@ func (d *Decoder) rawBytes() []byte { return bs2 } -func (d *Decoder) wrapErrstr(v interface{}, err *error) { - *err = fmt.Errorf("%s decode error [pos %d]: %v", d.hh.Name(), d.r.numread(), v) -} - // -------------------------------------------------- // decSliceHelper assists when decoding into a slice, from a map or an array in the stream. @@ -2381,13 +2373,12 @@ type decSliceHelper struct { func (d *Decoder) decSliceHelperStart() (x decSliceHelper, clen int) { dd := d.d ctyp := dd.ContainerType() - switch ctyp { - case valueTypeArray: + if ctyp == valueTypeArray { x.array = true clen = dd.ReadArrayStart() - case valueTypeMap: + } else if ctyp == valueTypeMap { clen = dd.ReadMapStart() * 2 - default: + } else { d.errorf("only encoded map or array can be decoded into a slice (%d)", ctyp) } // x.ct = ctyp @@ -2406,10 +2397,12 @@ func (x decSliceHelper) End() { func (x decSliceHelper) ElemContainerState(index int) { if x.array { x.d.d.ReadArrayElem() - } else if index%2 == 0 { - x.d.d.ReadMapElemKey() } else { - x.d.d.ReadMapElemValue() + if index%2 == 0 { + x.d.d.ReadMapElemKey() + } else { + x.d.d.ReadMapElemValue() + } } } @@ -2465,9 +2458,6 @@ func decInferLen(clen, maxlen, unit int) (rvlen int) { if clen <= 0 { return } - if unit == 0 { - return clen - } if maxlen <= 0 { // no maxlen defined. Use maximum of 256K memory, with a floor of 4K items. // maxlen = 256 * 1024 / unit @@ -2488,30 +2478,22 @@ func decInferLen(clen, maxlen, unit int) (rvlen int) { return } -func expandSliceRV(s reflect.Value, st reflect.Type, canChange bool, stElemSize, num, slen, scap int) ( - s2 reflect.Value, scap2 int, changed bool, err string) { +func decExpandSliceRV(s reflect.Value, st reflect.Type, stElemSize, num, slen, scap int) ( + s2 reflect.Value, scap2 int, changed bool) { l1 := slen + num // new slice length if l1 < slen { - err = errmsgExpandSliceOverflow - return + panic("expandSlice: slice overflow") } if l1 <= scap { if s.CanSet() { s.SetLen(l1) - } else if canChange { + } else { s2 = s.Slice(0, l1) scap2 = scap changed = true - } else { - err = errmsgExpandSliceCannotChange - return } return } - if !canChange { - err = errmsgExpandSliceCannotChange - return - } scap2 = growCap(scap, stElemSize, num) s2 = reflect.MakeSlice(st, l1, scap2) changed = true diff --git a/vendor/github.com/ugorji/go/codec/encode.go b/vendor/github.com/ugorji/go/codec/encode.go index 48053d24..dd15a2f4 100644 --- a/vendor/github.com/ugorji/go/codec/encode.go +++ b/vendor/github.com/ugorji/go/codec/encode.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -6,19 +6,36 @@ package codec import ( "bufio" "encoding" - "errors" "fmt" "io" "reflect" "sort" - "strconv" "sync" - "time" ) const defEncByteBufSize = 1 << 6 // 4:16, 6:64, 8:256, 10:1024 -var errEncoderNotInitialized = errors.New("Encoder not initialized") +// AsSymbolFlag defines what should be encoded as symbols. +type AsSymbolFlag uint8 + +const ( + // AsSymbolDefault is default. + // Currently, this means only encode struct field names as symbols. + // The default is subject to change. + AsSymbolDefault AsSymbolFlag = iota + + // AsSymbolAll means encode anything which could be a symbol as a symbol. + AsSymbolAll = 0xfe + + // AsSymbolNone means do not encode anything as a symbol. + AsSymbolNone = 1 << iota + + // AsSymbolMapStringKeys means encode keys in map[string]XXX as symbols. + AsSymbolMapStringKeysFlag + + // AsSymbolStructFieldName means encode struct field names as symbols. + AsSymbolStructFieldNameFlag +) // encWriter abstracts writing to a byte array or to an io.Writer. type encWriter interface { @@ -26,11 +43,15 @@ type encWriter interface { writestr(string) writen1(byte) writen2(byte, byte) + writen4(byte, byte, byte, byte) + writen5(byte, byte, byte, byte, byte) atEndOfEncode() } // encDriver abstracts the actual codec (binc vs msgpack, etc) type encDriver interface { + // IsBuiltinType(rt uintptr) bool + EncodeBuiltin(rt uintptr, v interface{}) EncodeNil() EncodeInt(i int64) EncodeUint(i uint64) @@ -40,12 +61,6 @@ type encDriver interface { // encodeExtPreamble(xtag byte, length int) EncodeRawExt(re *RawExt, e *Encoder) EncodeExt(v interface{}, xtag uint64, ext Ext, e *Encoder) - EncodeString(c charEncoding, v string) - // EncodeSymbol(v string) - EncodeStringBytes(c charEncoding, v []byte) - EncodeTime(time.Time) - //encBignum(f *big.Int) - //encStringRunes(c charEncoding, v []rune) WriteArrayStart(length int) WriteArrayElem() WriteArrayEnd() @@ -53,6 +68,12 @@ type encDriver interface { WriteMapElemKey() WriteMapElemValue() WriteMapEnd() + EncodeString(c charEncoding, v string) + EncodeSymbol(v string) + EncodeStringBytes(c charEncoding, v []byte) + //TODO + //encBignum(f *big.Int) + //encStringRunes(c charEncoding, v []rune) reset() atEndOfEncode() @@ -62,33 +83,27 @@ type ioEncStringWriter interface { WriteString(s string) (n int, err error) } +type ioEncFlusher interface { + Flush() error +} + type encDriverAsis interface { EncodeAsis(v []byte) } +// type encNoSeparator struct{} +// func (_ encNoSeparator) EncodeEnd() {} + 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 (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() {} +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 ioEncWriterWriter interface { // WriteByte(c byte) error @@ -96,13 +111,7 @@ func (e *encDriverTrackContainerWriter) atEndOfEncode() {} // Write(p []byte) (n int, err error) // } -// EncodeOptions captures configuration options during encode. type EncodeOptions struct { - // WriterBufferSize is the size of the buffer used when writing. - // - // if > 0, we use a smart buffer internally for performance purposes. - WriterBufferSize int - // Encode a struct as an array, and not as a map StructToArray bool @@ -144,35 +153,70 @@ type EncodeOptions struct { // If unset, we error out. Raw bool - // // AsSymbols defines what should be encoded as symbols. - // // - // // Encoding as symbols can reduce the encoded size significantly. - // // - // // However, during decoding, each string to be encoded as a symbol must - // // be checked to see if it has been seen before. Consequently, encoding time - // // will increase if using symbols, because string comparisons has a clear cost. - // // - // // Sample values: - // // AsSymbolNone - // // AsSymbolAll - // // AsSymbolMapStringKeys - // // AsSymbolMapStringKeysFlag | AsSymbolStructFieldNameFlag - // AsSymbols AsSymbolFlag + // AsSymbols defines what should be encoded as symbols. + // + // Encoding as symbols can reduce the encoded size significantly. + // + // However, during decoding, each string to be encoded as a symbol must + // be checked to see if it has been seen before. Consequently, encoding time + // will increase if using symbols, because string comparisons has a clear cost. + // + // Sample values: + // AsSymbolNone + // AsSymbolAll + // AsSymbolMapStringKeys + // AsSymbolMapStringKeysFlag | AsSymbolStructFieldNameFlag + AsSymbols AsSymbolFlag + + // WriterBufferSize is the size of the buffer used when writing. + // + // if > 0, we use a smart buffer internally for performance purposes. + WriterBufferSize int } // --------------------------------------------- +type simpleIoEncWriter struct { + io.Writer +} + +// type bufIoEncWriter struct { +// w io.Writer +// buf []byte +// err error +// } + +// func (x *bufIoEncWriter) Write(b []byte) (n int, err error) { +// if x.err != nil { +// return 0, x.err +// } +// if cap(x.buf)-len(x.buf) >= len(b) { +// x.buf = append(x.buf, b) +// return len(b), nil +// } +// n, err = x.w.Write(x.buf) +// if err != nil { +// x.err = err +// return 0, x.err +// } +// n, err = x.w.Write(b) +// x.err = err +// return +// } + // ioEncWriter implements encWriter and can write to an io.Writer implementation type ioEncWriter struct { w io.Writer ww io.Writer bw io.ByteWriter sw ioEncStringWriter - fw ioFlusher + fw ioEncFlusher b [8]byte } func (z *ioEncWriter) WriteByte(b byte) (err error) { + // x.bs[0] = b + // _, err = x.ww.Write(x.bs[:]) z.b[0] = b _, err = z.w.Write(z.b[:1]) return @@ -183,12 +227,18 @@ func (z *ioEncWriter) WriteString(s string) (n int, err error) { } func (z *ioEncWriter) writeb(bs []byte) { + // if len(bs) == 0 { + // return + // } if _, err := z.ww.Write(bs); err != nil { panic(err) } } func (z *ioEncWriter) writestr(s string) { + // if len(s) == 0 { + // return + // } if _, err := z.sw.WriteString(s); err != nil { panic(err) } @@ -210,12 +260,19 @@ func (z *ioEncWriter) writen2(b1, b2 byte) { panic(err) } -// func (z *ioEncWriter) writen5(b1, b2, b3, b4, b5 byte) { -// z.b[0], z.b[1], z.b[2], z.b[3], z.b[4] = b1, b2, b3, b4, b5 -// if _, err := z.ww.Write(z.b[:5]); err != nil { -// panic(err) -// } -// } +func (z *ioEncWriter) writen4(b1, b2, b3, b4 byte) { + z.b[0], z.b[1], z.b[2], z.b[3] = b1, b2, b3, b4 + if _, err := z.ww.Write(z.b[:4]); err != nil { + panic(err) + } +} + +func (z *ioEncWriter) writen5(b1, b2, b3, b4, b5 byte) { + z.b[0], z.b[1], z.b[2], z.b[3], z.b[4] = b1, b2, b3, b4, b5 + if _, err := z.ww.Write(z.b[:5]); err != nil { + panic(err) + } +} func (z *ioEncWriter) atEndOfEncode() { if z.fw != nil { @@ -223,67 +280,209 @@ func (z *ioEncWriter) atEndOfEncode() { } } -// --------------------------------------------- +// ---------------------------------------- -// bytesEncAppender implements encWriter and can write to an byte slice. -type bytesEncAppender struct { +// bytesEncWriter implements encWriter and can write to an byte slice. +// It is used by Marshal function. +type bytesEncWriter struct { b []byte - out *[]byte + c int // cursor + out *[]byte // write out on atEndOfEncode } -func (z *bytesEncAppender) writeb(s []byte) { - z.b = append(z.b, s...) +func (z *bytesEncWriter) writeb(s []byte) { + oc, a := z.growNoAlloc(len(s)) + if a { + z.growAlloc(len(s), oc) + } + copy(z.b[oc:], s) } -func (z *bytesEncAppender) writestr(s string) { - z.b = append(z.b, s...) + +func (z *bytesEncWriter) writestr(s string) { + oc, a := z.growNoAlloc(len(s)) + if a { + z.growAlloc(len(s), oc) + } + copy(z.b[oc:], s) } -func (z *bytesEncAppender) writen1(b1 byte) { - z.b = append(z.b, b1) + +func (z *bytesEncWriter) writen1(b1 byte) { + oc, a := z.growNoAlloc(1) + if a { + z.growAlloc(1, oc) + } + z.b[oc] = b1 } -func (z *bytesEncAppender) writen2(b1, b2 byte) { - z.b = append(z.b, b1, b2) + +func (z *bytesEncWriter) writen2(b1, b2 byte) { + oc, a := z.growNoAlloc(2) + if a { + z.growAlloc(2, oc) + } + z.b[oc+1] = b2 + z.b[oc] = b1 } -func (z *bytesEncAppender) atEndOfEncode() { - *(z.out) = z.b + +func (z *bytesEncWriter) writen4(b1, b2, b3, b4 byte) { + oc, a := z.growNoAlloc(4) + if a { + z.growAlloc(4, oc) + } + z.b[oc+3] = b4 + z.b[oc+2] = b3 + z.b[oc+1] = b2 + z.b[oc] = b1 } -func (z *bytesEncAppender) reset(in []byte, out *[]byte) { - z.b = in[:0] - z.out = out + +func (z *bytesEncWriter) writen5(b1, b2, b3, b4, b5 byte) { + oc, a := z.growNoAlloc(5) + if a { + z.growAlloc(5, oc) + } + z.b[oc+4] = b5 + z.b[oc+3] = b4 + z.b[oc+2] = b3 + z.b[oc+1] = b2 + z.b[oc] = b1 +} + +func (z *bytesEncWriter) atEndOfEncode() { + *(z.out) = z.b[:z.c] +} + +// have a growNoalloc(n int), which can be inlined. +// if allocation is needed, then call growAlloc(n int) + +func (z *bytesEncWriter) growNoAlloc(n int) (oldcursor int, allocNeeded bool) { + oldcursor = z.c + z.c = z.c + n + if z.c > len(z.b) { + if z.c > cap(z.b) { + allocNeeded = true + } else { + z.b = z.b[:cap(z.b)] + } + } + return +} + +func (z *bytesEncWriter) growAlloc(n int, oldcursor int) { + // appendslice logic (if cap < 1024, *2, else *1.25): more expensive. many copy calls. + // bytes.Buffer model (2*cap + n): much better + // bs := make([]byte, 2*cap(z.b)+n) + bs := make([]byte, growCap(cap(z.b), 1, n)) + copy(bs, z.b[:oldcursor]) + z.b = bs } // --------------------------------------------- -func (e *Encoder) rawExt(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeRawExt(rv2i(rv).(*RawExt), e) -} - -func (e *Encoder) ext(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeExt(rv2i(rv), f.xfTag, f.xfFn, e) -} - -func (e *Encoder) selferMarshal(f *codecFnInfo, rv reflect.Value) { - rv2i(rv).(Selfer).CodecEncodeSelf(e) -} - -func (e *Encoder) binaryMarshal(f *codecFnInfo, rv reflect.Value) { - bs, fnerr := rv2i(rv).(encoding.BinaryMarshaler).MarshalBinary() - e.marshal(bs, fnerr, false, cRAW) -} - -func (e *Encoder) textMarshal(f *codecFnInfo, rv reflect.Value) { - bs, fnerr := rv2i(rv).(encoding.TextMarshaler).MarshalText() - e.marshal(bs, fnerr, false, cUTF8) -} - -func (e *Encoder) jsonMarshal(f *codecFnInfo, rv reflect.Value) { - bs, fnerr := rv2i(rv).(jsonMarshaler).MarshalJSON() - e.marshal(bs, fnerr, true, cUTF8) +func (e *Encoder) builtin(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeBuiltin(f.ti.rtid, rv2i(rv)) } func (e *Encoder) raw(f *codecFnInfo, rv reflect.Value) { e.rawBytes(rv2i(rv).(Raw)) } +func (e *Encoder) rawExt(f *codecFnInfo, rv reflect.Value) { + // rev := rv2i(rv).(RawExt) + // e.e.EncodeRawExt(&rev, e) + var re *RawExt + if rv.CanAddr() { + re = rv2i(rv.Addr()).(*RawExt) + } else { + rev := rv2i(rv).(RawExt) + re = &rev + } + e.e.EncodeRawExt(re, e) +} + +func (e *Encoder) ext(f *codecFnInfo, rv reflect.Value) { + // if this is a struct|array and it was addressable, then pass the address directly (not the value) + if k := rv.Kind(); (k == reflect.Struct || k == reflect.Array) && rv.CanAddr() { + rv = rv.Addr() + } + e.e.EncodeExt(rv2i(rv), f.xfTag, f.xfFn, e) +} + +func (e *Encoder) getValueForMarshalInterface(rv reflect.Value, indir int8) (v interface{}, proceed bool) { + if indir == 0 { + v = rv2i(rv) + } else if indir == -1 { + // If a non-pointer was passed to Encode(), then that value is not addressable. + // Take addr if addressable, else copy value to an addressable value. + if rv.CanAddr() { + v = rv2i(rv.Addr()) + } else { + rv2 := reflect.New(rv.Type()) + rv2.Elem().Set(rv) + v = rv2i(rv2) + } + } else { + for j := int8(0); j < indir; j++ { + if rv.IsNil() { + e.e.EncodeNil() + return + } + rv = rv.Elem() + } + v = rv2i(rv) + } + return v, true +} + +func (e *Encoder) selferMarshal(f *codecFnInfo, rv reflect.Value) { + if v, proceed := e.getValueForMarshalInterface(rv, f.ti.csIndir); proceed { + v.(Selfer).CodecEncodeSelf(e) + } +} + +func (e *Encoder) binaryMarshal(f *codecFnInfo, rv reflect.Value) { + if v, proceed := e.getValueForMarshalInterface(rv, f.ti.bmIndir); proceed { + bs, fnerr := v.(encoding.BinaryMarshaler).MarshalBinary() + e.marshal(bs, fnerr, false, c_RAW) + } +} + +func (e *Encoder) textMarshal(f *codecFnInfo, rv reflect.Value) { + if v, proceed := e.getValueForMarshalInterface(rv, f.ti.tmIndir); proceed { + bs, fnerr := v.(encoding.TextMarshaler).MarshalText() + e.marshal(bs, fnerr, false, c_UTF8) + } +} + +func (e *Encoder) jsonMarshal(f *codecFnInfo, rv reflect.Value) { + if v, proceed := e.getValueForMarshalInterface(rv, f.ti.jmIndir); proceed { + bs, fnerr := v.(jsonMarshaler).MarshalJSON() + e.marshal(bs, fnerr, true, c_UTF8) + } +} + +func (e *Encoder) kBool(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeBool(rv.Bool()) +} + +func (e *Encoder) kString(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeString(c_UTF8, rv.String()) +} + +func (e *Encoder) kFloat64(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeFloat64(rv.Float()) +} + +func (e *Encoder) kFloat32(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeFloat32(float32(rv.Float())) +} + +func (e *Encoder) kInt(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeInt(rv.Int()) +} + +func (e *Encoder) kUint(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeUint(rv.Uint()) +} + func (e *Encoder) kInvalid(f *codecFnInfo, rv reflect.Value) { e.e.EncodeNil() } @@ -307,25 +506,18 @@ func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { // If in this method, then there was no extension function defined. // So it's okay to treat as []byte. if ti.rtid == uint8SliceTypId { - ee.EncodeStringBytes(cRAW, rv.Bytes()) + ee.EncodeStringBytes(c_RAW, rv.Bytes()) return } } - if f.seq == seqTypeChan && ti.chandir&uint8(reflect.RecvDir) == 0 { - e.errorf("send-only channel cannot be used for receiving byte(s)") - } - elemsep := e.esep + elemsep := e.hh.hasElemSeparators() + rtelem := ti.rt.Elem() l := rv.Len() - rtelem := ti.elem - rtelemIsByte := uint8TypId == rt2id(rtelem) // NOT rtelem.Kind() == reflect.Uint8 - // if a slice, array or chan of bytes, treat specially - if rtelemIsByte { + if ti.rtid == uint8SliceTypId || rtelem.Kind() == reflect.Uint8 { switch f.seq { - case seqTypeSlice: - ee.EncodeStringBytes(cRAW, rv.Bytes()) case seqTypeArray: if rv.CanAddr() { - ee.EncodeStringBytes(cRAW, rv.Slice(0, l).Bytes()) + ee.EncodeStringBytes(c_RAW, rv.Slice(0, l).Bytes()) } else { var bs []byte if l <= cap(e.b) { @@ -334,24 +526,24 @@ func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { bs = make([]byte, l) } reflect.Copy(reflect.ValueOf(bs), rv) - ee.EncodeStringBytes(cRAW, bs) + ee.EncodeStringBytes(c_RAW, bs) } - case seqTypeChan: - bs := e.b[:0] - // 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. - irv := rv2i(rv) - ch, ok := irv.(<-chan byte) - if !ok { - ch = irv.(chan byte) - } - for i := 0; i < l; i++ { - bs = append(bs, <-ch) - } - ee.EncodeStringBytes(cRAW, bs) + return + case seqTypeSlice: + ee.EncodeStringBytes(c_RAW, rv.Bytes()) + return } + } + if ti.rtid == uint8SliceTypId && f.seq == seqTypeChan { + bs := e.b[:0] + // 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) + for i := 0; i < l; i++ { + bs = append(bs, <-ch) + } + ee.EncodeStringBytes(c_RAW, bs) return } @@ -367,15 +559,19 @@ func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { if l > 0 { var fn *codecFn - for rtelem.Kind() == reflect.Ptr { - rtelem = rtelem.Elem() - } - // if kind is reflect.Interface, do not pre-determine the - // encoding type, because preEncodeValue may break it down to - // a concrete type and kInterface will bomb. - if rtelem.Kind() != reflect.Interface { - fn = e.cfer().get(rtelem, true, true) + var recognizedVtyp = useLookupRecognizedTypes && isRecognizedRtidOrPtr(rt2id(rtelem)) + if !recognizedVtyp { + for rtelem.Kind() == reflect.Ptr { + rtelem = rtelem.Elem() + } + // if kind is reflect.Interface, do not pre-determine the + // encoding type, because preEncodeValue may break it down to + // a concrete type and kInterface will bomb. + if rtelem.Kind() != reflect.Interface { + fn = e.cf.get(rtelem, true, true) + } } + // TODO: Consider perf implication of encoding odd index values as symbols if type is string for j := 0; j < l; j++ { if elemsep { if ti.mbs { @@ -390,12 +586,20 @@ func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { } if f.seq == seqTypeChan { if rv2, ok2 := rv.Recv(); ok2 { - e.encodeValue(rv2, fn, true) + if useLookupRecognizedTypes && recognizedVtyp { + e.encode(rv2i(rv2)) + } else { + e.encodeValue(rv2, fn, true) + } } else { ee.EncodeNil() // WE HAVE TO DO SOMETHING, so nil if nothing received. } } else { - e.encodeValue(rv.Index(j), fn, true) + if useLookupRecognizedTypes && recognizedVtyp { + e.encode(rv2i(rv.Index(j))) + } else { + e.encodeValue(rv.Index(j), fn, true) + } } } } @@ -409,42 +613,50 @@ func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { func (e *Encoder) kStructNoOmitempty(f *codecFnInfo, rv reflect.Value) { fti := f.ti - elemsep := e.esep - tisfi := fti.sfiSrc + elemsep := e.hh.hasElemSeparators() + tisfi := fti.sfip toMap := !(fti.toArray || e.h.StructToArray) if toMap { - tisfi = fti.sfiSort + tisfi = fti.sfi } ee := e.e sfn := structFieldNode{v: rv, update: false} if toMap { ee.WriteMapStart(len(tisfi)) - if elemsep { + // asSymbols := e.h.AsSymbols&AsSymbolStructFieldNameFlag != 0 + asSymbols := e.h.AsSymbols == AsSymbolDefault || e.h.AsSymbols&AsSymbolStructFieldNameFlag != 0 + if !elemsep { for _, si := range tisfi { - ee.WriteMapElemKey() - // ee.EncodeString(cUTF8, si.encName) - encStructFieldKey(ee, fti.keyType, si.encName) - ee.WriteMapElemValue() + if asSymbols { + ee.EncodeSymbol(si.encName) + } else { + ee.EncodeString(c_UTF8, si.encName) + } e.encodeValue(sfn.field(si), nil, true) } } else { for _, si := range tisfi { - // ee.EncodeString(cUTF8, si.encName) - encStructFieldKey(ee, fti.keyType, si.encName) + ee.WriteMapElemKey() + if asSymbols { + ee.EncodeSymbol(si.encName) + } else { + ee.EncodeString(c_UTF8, si.encName) + } + ee.WriteMapElemValue() e.encodeValue(sfn.field(si), nil, true) } } ee.WriteMapEnd() } else { ee.WriteArrayStart(len(tisfi)) - if elemsep { + if !elemsep { for _, si := range tisfi { - ee.WriteArrayElem() e.encodeValue(sfn.field(si), nil, true) } } else { for _, si := range tisfi { + ee.WriteArrayElem() e.encodeValue(sfn.field(si), nil, true) } } @@ -452,35 +664,16 @@ func (e *Encoder) kStructNoOmitempty(f *codecFnInfo, rv reflect.Value) { } } -func encStructFieldKey(ee encDriver, keyType valueType, s string) { - var m must - - // use if-else-if, not switch (which compiles to binary-search) - // since keyType is typically valueTypeString, branch prediction is pretty good. - - if keyType == valueTypeString { - ee.EncodeString(cUTF8, s) - } else if keyType == valueTypeInt { - ee.EncodeInt(m.Int(strconv.ParseInt(s, 10, 64))) - } else if keyType == valueTypeUint { - ee.EncodeUint(m.Uint(strconv.ParseUint(s, 10, 64))) - } else if keyType == valueTypeFloat { - ee.EncodeFloat64(m.Float(strconv.ParseFloat(s, 64))) - } else { - ee.EncodeString(cUTF8, s) - } -} - func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) { fti := f.ti - elemsep := e.esep - tisfi := fti.sfiSrc + elemsep := e.hh.hasElemSeparators() + tisfi := fti.sfip toMap := !(fti.toArray || e.h.StructToArray) // if toMap, use the sorted array. If toArray, use unsorted array (to match sequence in struct) if toMap { - tisfi = fti.sfiSort + tisfi = fti.sfi } - newlen := len(fti.sfiSort) + newlen := len(fti.sfi) ee := e.e // Use sync.Pool to reduce allocating slices unnecessarily. @@ -498,7 +691,6 @@ func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) { var spool *sync.Pool var poolv interface{} var fkvs []stringRv - // fmt.Printf(">>>>>>>>>>>>>> encode.kStruct: newlen: %d\n", newlen) if newlen <= 8 { spool, poolv = pool.stringRv8() fkvs = poolv.(*[8]stringRv)[:newlen] @@ -526,14 +718,14 @@ func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) { // kv.r = si.field(rv, false) kv.r = sfn.field(si) if toMap { - if si.omitEmpty() && isEmptyValue(kv.r, e.h.TypeInfos, recur, recur) { + if si.omitEmpty && isEmptyValue(kv.r, recur, recur) { continue } kv.v = si.encName } else { // 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) { + if si.omitEmpty && isEmptyValue(kv.r, recur, recur) { switch kv.r.Kind() { case reflect.Struct, reflect.Interface, reflect.Ptr, reflect.Array, reflect.Map, reflect.Slice: kv.r = reflect.Value{} //encode as nil @@ -546,33 +738,41 @@ func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) { if toMap { ee.WriteMapStart(newlen) - if elemsep { + // asSymbols := e.h.AsSymbols&AsSymbolStructFieldNameFlag != 0 + asSymbols := e.h.AsSymbols == AsSymbolDefault || e.h.AsSymbols&AsSymbolStructFieldNameFlag != 0 + if !elemsep { for j := 0; j < newlen; j++ { kv = fkvs[j] - ee.WriteMapElemKey() - // ee.EncodeString(cUTF8, kv.v) - encStructFieldKey(ee, fti.keyType, kv.v) - ee.WriteMapElemValue() + if asSymbols { + ee.EncodeSymbol(kv.v) + } else { + ee.EncodeString(c_UTF8, kv.v) + } e.encodeValue(kv.r, nil, true) } } else { for j := 0; j < newlen; j++ { kv = fkvs[j] - // ee.EncodeString(cUTF8, kv.v) - encStructFieldKey(ee, fti.keyType, kv.v) + ee.WriteMapElemKey() + if asSymbols { + ee.EncodeSymbol(kv.v) + } else { + ee.EncodeString(c_UTF8, kv.v) + } + ee.WriteMapElemValue() e.encodeValue(kv.r, nil, true) } } ee.WriteMapEnd() } else { ee.WriteArrayStart(newlen) - if elemsep { + if !elemsep { for j := 0; j < newlen; j++ { - ee.WriteArrayElem() e.encodeValue(fkvs[j].r, nil, true) } } else { for j := 0; j < newlen; j++ { + ee.WriteArrayElem() e.encodeValue(fkvs[j].r, nil, true) } } @@ -596,12 +796,12 @@ func (e *Encoder) kMap(f *codecFnInfo, rv reflect.Value) { l := rv.Len() ee.WriteMapStart(l) - elemsep := e.esep + elemsep := e.hh.hasElemSeparators() if l == 0 { ee.WriteMapEnd() return } - // var asSymbols bool + var asSymbols bool // determine the underlying key and val encFn's for the map. // This eliminates some work which is done for each loop iteration i.e. // rv.Type(), ref.ValueOf(rt).Pointer(), then check map/list for fn. @@ -611,61 +811,103 @@ func (e *Encoder) kMap(f *codecFnInfo, rv reflect.Value) { // a concrete type and kInterface will bomb. var keyFn, valFn *codecFn ti := f.ti - rtkey0 := ti.key + rtkey0 := ti.rt.Key() rtkey := rtkey0 - rtval0 := ti.elem + rtval0 := ti.rt.Elem() rtval := rtval0 - // rtkeyid := rt2id(rtkey0) + rtkeyid := rt2id(rtkey0) + rtvalid := rt2id(rtval0) for rtval.Kind() == reflect.Ptr { rtval = rtval.Elem() } if rtval.Kind() != reflect.Interface { - valFn = e.cfer().get(rtval, true, true) + valFn = e.cf.get(rtval, true, true) } mks := rv.MapKeys() if e.h.Canonical { - e.kMapCanonical(rtkey, rv, mks, valFn) + e.kMapCanonical(rtkey, rv, mks, valFn, asSymbols) ee.WriteMapEnd() return } - var keyTypeIsString = stringTypId == rt2id(rtkey0) // rtkeyid - if !keyTypeIsString { + var recognizedKtyp, recognizedVtyp bool + var keyTypeIsString = rtkeyid == stringTypId + if keyTypeIsString { + asSymbols = e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + } else { + if useLookupRecognizedTypes { + if recognizedKtyp = isRecognizedRtidOrPtr(rtkeyid); recognizedKtyp { + goto LABEL1 + } + } for rtkey.Kind() == reflect.Ptr { rtkey = rtkey.Elem() } if rtkey.Kind() != reflect.Interface { - // rtkeyid = rt2id(rtkey) - keyFn = e.cfer().get(rtkey, true, true) + rtkeyid = rt2id(rtkey) + keyFn = e.cf.get(rtkey, true, true) } } // for j, lmks := 0, len(mks); j < lmks; j++ { +LABEL1: + recognizedVtyp = useLookupRecognizedTypes && isRecognizedRtidOrPtr(rtvalid) for j := range mks { if elemsep { ee.WriteMapElemKey() } if keyTypeIsString { - ee.EncodeString(cUTF8, mks[j].String()) + if asSymbols { + ee.EncodeSymbol(mks[j].String()) + } else { + ee.EncodeString(c_UTF8, mks[j].String()) + } + } else if useLookupRecognizedTypes && recognizedKtyp { + e.encode(rv2i(mks[j])) } else { e.encodeValue(mks[j], keyFn, true) } if elemsep { ee.WriteMapElemValue() } - e.encodeValue(rv.MapIndex(mks[j]), valFn, true) - + if useLookupRecognizedTypes && recognizedVtyp { + e.encode(rv2i(rv.MapIndex(mks[j]))) + } else { + e.encodeValue(rv.MapIndex(mks[j]), valFn, true) + } } ee.WriteMapEnd() } -func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []reflect.Value, valFn *codecFn) { +func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []reflect.Value, valFn *codecFn, asSymbols bool) { ee := e.e - elemsep := e.esep + elemsep := e.hh.hasElemSeparators() // we previously did out-of-band if an extension was registered. // This is not necessary, as the natural kind is sufficient for ordering. + // WHAT IS THIS? rtkeyid can never be a []uint8, per spec + // if rtkeyid == uint8SliceTypId { + // mksv := make([]bytesRv, len(mks)) + // for i, k := range mks { + // v := &mksv[i] + // v.r = k + // v.v = k.Bytes() + // } + // sort.Sort(bytesRvSlice(mksv)) + // for i := range mksv { + // if elemsep { + // ee.WriteMapElemKey() + // } + // ee.EncodeStringBytes(c_RAW, mksv[i].v) + // if elemsep { + // ee.WriteMapElemValue() + // } + // e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) + // } + // return + // } + switch rtkey.Kind() { case reflect.Bool: mksv := make([]boolRv, len(mks)) @@ -697,7 +939,11 @@ func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []refl if elemsep { ee.WriteMapElemKey() } - ee.EncodeString(cUTF8, mksv[i].v) + if asSymbols { + ee.EncodeSymbol(mksv[i].v) + } else { + ee.EncodeString(c_UTF8, mksv[i].v) + } if elemsep { ee.WriteMapElemValue() } @@ -775,28 +1021,6 @@ func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []refl } e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) } - case reflect.Struct: - if rv.Type() == timeTyp { - mksv := make([]timeRv, len(mks)) - for i, k := range mks { - v := &mksv[i] - v.r = k - v.v = rv2i(k).(time.Time) - } - sort.Sort(timeRvSlice(mksv)) - for i := range mksv { - if elemsep { - ee.WriteMapElemKey() - } - ee.EncodeTime(mksv[i].v) - if elemsep { - ee.WriteMapElemValue() - } - e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) - } - break - } - fallthrough default: // out-of-band // first encode each key to a []byte first, then sort them, then record @@ -826,78 +1050,32 @@ func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []refl // // -------------------------------------------------- -type encWriterSwitch struct { - wi *ioEncWriter - // wb bytesEncWriter - wb bytesEncAppender - wx bool // if bytes, wx=true - esep bool // whether it has elem separators - isas bool // whether e.as != nil -} - -// // TODO: Uncomment after mid-stack inlining enabled in go 1.10 - -// func (z *encWriterSwitch) writeb(s []byte) { -// if z.wx { -// z.wb.writeb(s) -// } else { -// z.wi.writeb(s) -// } -// } -// func (z *encWriterSwitch) writestr(s string) { -// if z.wx { -// z.wb.writestr(s) -// } else { -// z.wi.writestr(s) -// } -// } -// func (z *encWriterSwitch) writen1(b1 byte) { -// if z.wx { -// z.wb.writen1(b1) -// } else { -// z.wi.writen1(b1) -// } -// } -// func (z *encWriterSwitch) writen2(b1, b2 byte) { -// if z.wx { -// z.wb.writen2(b1, b2) -// } else { -// z.wi.writen2(b1, b2) -// } -// } - // An Encoder writes an object to an output stream in the codec format. type Encoder struct { - panicHdl // hopefully, reduce derefencing cost by laying the encWriter inside the Encoder e encDriver // NOTE: Encoder shouldn't call it's write methods, // as the handler MAY need to do some coordination. w encWriter + hh Handle h *BasicHandle - bw *bufio.Writer + + // ---- cpu cache line boundary? + + wi ioEncWriter + wb bytesEncWriter + bw bufio.Writer + + // cr containerStateRecv as encDriverAsis - // ---- cpu cache line boundary? - // ---- cpu cache line boundary? - encWriterSwitch + ci set err error - // ---- cpu cache line boundary? - codecFnPooler - ci set - js bool // here, so that no need to piggy back on *codecFner for this - be bool // here, so that no need to piggy back on *codecFner for this - _ [6]byte // padding - - // ---- writable fields during execution --- *try* to keep in sep cache line - - // ---- cpu cache line boundary? - // b [scratchByteArrayLen]byte - // _ [cacheLineSize - scratchByteArrayLen]byte // padding - b [cacheLineSize - 0]byte // used for encoding a chan or (non-addressable) array of bytes + b [scratchByteArrayLen]byte + cf codecFner } // NewEncoder returns an Encoder for encoding into an io.Writer. @@ -922,74 +1100,53 @@ func NewEncoderBytes(out *[]byte, h Handle) *Encoder { } func newEncoder(h Handle) *Encoder { - e := &Encoder{h: h.getBasicHandle(), err: errEncoderNotInitialized} - e.hh = h - e.esep = h.hasElemSeparators() + e := &Encoder{hh: h, h: h.getBasicHandle()} + e.e = h.newEncDriver(e) + e.as, _ = e.e.(encDriverAsis) + // e.cr, _ = e.e.(containerStateRecv) return e } -func (e *Encoder) resetCommon() { - if e.e == nil || e.hh.recreateEncDriver(e.e) { - e.e = e.hh.newEncDriver(e) - e.as, e.isas = e.e.(encDriverAsis) - // e.cr, _ = e.e.(containerStateRecv) - } - e.be = e.hh.isBinary() - _, e.js = e.hh.(*JsonHandle) - e.e.reset() - e.err = nil -} - -// Reset resets the Encoder with a new output stream. +// Reset the Encoder with a new output stream. // // This accommodates using the state of the Encoder, // where it has "cached" information about sub-engines. func (e *Encoder) Reset(w io.Writer) { - if w == nil { - return - } - if e.wi == nil { - e.wi = new(ioEncWriter) - } var ok bool - e.wx = false e.wi.w = w if e.h.WriterBufferSize > 0 { - e.bw = bufio.NewWriterSize(w, e.h.WriterBufferSize) - e.wi.bw = e.bw - e.wi.sw = e.bw - e.wi.fw = e.bw - e.wi.ww = e.bw + bw := bufio.NewWriterSize(w, e.h.WriterBufferSize) + e.bw = *bw + e.wi.bw = &e.bw + e.wi.sw = &e.bw + e.wi.fw = &e.bw + e.wi.ww = &e.bw } else { if e.wi.bw, ok = w.(io.ByteWriter); !ok { - e.wi.bw = e.wi + e.wi.bw = &e.wi } if e.wi.sw, ok = w.(ioEncStringWriter); !ok { - e.wi.sw = e.wi + e.wi.sw = &e.wi } - e.wi.fw, _ = w.(ioFlusher) + e.wi.fw, _ = w.(ioEncFlusher) e.wi.ww = w } - e.w = e.wi - e.resetCommon() + e.w = &e.wi + e.e.reset() + e.cf.reset(e.hh) + e.err = nil } -// ResetBytes resets the Encoder with a new destination output []byte. func (e *Encoder) ResetBytes(out *[]byte) { - if out == nil { - return - } - var in []byte - if out != nil { - in = *out - } + in := *out if in == nil { in = make([]byte, defEncByteBufSize) } - e.wx = true - e.wb.reset(in, out) + e.wb.b, e.wb.out, e.wb.c = in, out, 0 e.w = &e.wb - e.resetCommon() + e.e.reset() + e.cf.reset(e.hh) + e.err = nil } // Encode writes an object into a stream. @@ -1000,14 +1157,7 @@ func (e *Encoder) ResetBytes(out *[]byte) { // Note that the "json" key is used in the absence of the "codec" key. // // To set an option on all fields (e.g. omitempty on all fields), you -// can create a field called _struct, and set flags on it. The options -// which can be set on _struct are: -// - omitempty: so all fields are omitted if empty -// - toarray: so struct is encoded as an array -// - int: so struct key names are encoded as signed integers (instead of strings) -// - uint: so struct key names are encoded as unsigned integers (instead of strings) -// - float: so struct key names are encoded as floats (instead of strings) -// More details on these below. +// can create a field called _struct, and set flags on it. // // Struct values "usually" encode as maps. Each exported struct field is encoded unless: // - the field's tag is "-", OR @@ -1015,13 +1165,6 @@ func (e *Encoder) ResetBytes(out *[]byte) { // // When encoding as a map, the first string in the tag (before the comma) // is the map key string to use when encoding. -// ... -// This key is typically encoded as a string. -// However, there are instances where the encoded stream has mapping keys encoded as numbers. -// For example, some cbor streams have keys as integer codes in the stream, but they should map -// to fields in a structured object. Consequently, a struct is the natural representation in code. -// For these, configure the struct to encode/decode the keys as numbers (instead of string). -// This is done with the int,uint or float option on the _struct field (see above). // // However, struct values may encode as arrays. This happens when: // - StructToArray Encode option is set, OR @@ -1054,27 +1197,20 @@ func (e *Encoder) ResetBytes(out *[]byte) { // } // // type MyStruct struct { -// _struct bool `codec:",toarray"` //encode struct as an array -// } -// -// type MyStruct struct { -// _struct bool `codec:",uint"` //encode struct with "unsigned integer" keys -// Field1 string `codec:"1"` //encode Field1 key using: EncodeInt(1) -// Field2 string `codec:"2"` //encode Field2 key using: EncodeInt(2) +// _struct bool `codec:",toarray"` //encode struct as an array // } // // The mode of encoding is based on the type of the value. When a value is seen: // - If a Selfer, call its CodecEncodeSelf method // - If an extension is registered for it, call that extension function -// - If implements encoding.(Binary|Text|JSON)Marshaler, call Marshal(Binary|Text|JSON) method +// - If it implements encoding.(Binary|Text|JSON)Marshaler, call its Marshal(Binary|Text|JSON) method // - Else encode it based on its reflect.Kind // // Note that struct field names and keys in map[string]XXX will be treated as symbols. // Some formats support symbols (e.g. binc) and will properly encode the string // only once in the stream, and use a tag to refer to it thereafter. func (e *Encoder) Encode(v interface{}) (err error) { - defer panicToErrs2(e, &e.err, &err) - defer e.alwaysAtEnd() + defer panicToErrs2(&e.err, &err) e.MustEncode(v) return } @@ -1088,13 +1224,8 @@ func (e *Encoder) MustEncode(v interface{}) { e.encode(v) e.e.atEndOfEncode() e.w.atEndOfEncode() - e.alwaysAtEnd() } -// func (e *Encoder) alwaysAtEnd() { -// e.codecFnPooler.alwaysAtEnd() -// } - func (e *Encoder) encode(iv interface{}) { if iv == nil || definitelyNil(iv) { e.e.EncodeNil() @@ -1105,17 +1236,18 @@ func (e *Encoder) encode(iv interface{}) { return } - // a switch with only concrete types can be optimized. - // consequently, we deal with nil and interfaces outside. - switch v := iv.(type) { + // case nil: + // e.e.EncodeNil() + // case Selfer: + // v.CodecEncodeSelf(e) case Raw: e.rawBytes(v) case reflect.Value: e.encodeValue(v, nil, true) case string: - e.e.EncodeString(cUTF8, v) + e.e.EncodeString(c_UTF8, v) case bool: e.e.EncodeBool(v) case int: @@ -1144,16 +1276,12 @@ func (e *Encoder) encode(iv interface{}) { e.e.EncodeFloat32(v) case float64: e.e.EncodeFloat64(v) - case time.Time: - e.e.EncodeTime(v) - case []uint8: - e.e.EncodeStringBytes(cRAW, v) - case *Raw: - e.rawBytes(*v) + case []uint8: + e.e.EncodeStringBytes(c_RAW, v) case *string: - e.e.EncodeString(cUTF8, *v) + e.e.EncodeString(c_UTF8, *v) case *bool: e.e.EncodeBool(*v) case *int: @@ -1182,16 +1310,13 @@ func (e *Encoder) encode(iv interface{}) { e.e.EncodeFloat32(*v) case *float64: e.e.EncodeFloat64(*v) - case *time.Time: - e.e.EncodeTime(*v) case *[]uint8: - e.e.EncodeStringBytes(cRAW, *v) + e.e.EncodeStringBytes(c_RAW, *v) default: if !fastpathEncodeTypeSwitch(iv, e) { - // checkfastpath=true (not false), as underlying slice/map type may be fast-path - e.encodeValue(reflect.ValueOf(iv), nil, true) + e.encodeValue(reflect.ValueOf(iv), nil, false) } } } @@ -1199,8 +1324,6 @@ func (e *Encoder) encode(iv interface{}) { func (e *Encoder) encodeValue(rv reflect.Value, fn *codecFn, checkFastpath bool) { // if a valid fn is passed, it MUST BE for the dereferenced type of rv var sptr uintptr - var rvp reflect.Value - var rvpValid bool TOP: switch rv.Kind() { case reflect.Ptr: @@ -1208,8 +1331,6 @@ TOP: e.e.EncodeNil() return } - rvpValid = true - rvp = rv rv = rv.Elem() if e.h.CheckCircularRef && rv.Kind() == reflect.Struct { // TODO: Movable pointers will be an issue here. Future problem. @@ -1240,22 +1361,15 @@ TOP: if fn == nil { rt := rv.Type() - // always pass checkCodecSelfer=true, in case T or ****T is passed, where *T is a Selfer - fn = e.cfer().get(rt, checkFastpath, true) - } - if fn.i.addrE { - if rvpValid { - fn.fe(e, &fn.i, rvp) - } else if rv.CanAddr() { - fn.fe(e, &fn.i, rv.Addr()) - } else { - rv2 := reflect.New(rv.Type()) - rv2.Elem().Set(rv) - fn.fe(e, &fn.i, rv2) + // TODO: calling isRecognizedRtid here is a major slowdown + if false && useLookupRecognizedTypes && isRecognizedRtidOrPtr(rt2id(rt)) { + e.encode(rv2i(rv)) + return } - } else { - fn.fe(e, &fn.i, rv) + // always pass checkCodecSelfer=true, in case T or ****T is passed, where *T is a Selfer + fn = e.cf.get(rt, checkFastpath, true) } + fn.fe(e, &fn.i, rv) if sptr != 0 { (&e.ci).remove(sptr) } @@ -1275,10 +1389,10 @@ func (e *Encoder) marshal(bs []byte, fnerr error, asis bool, c charEncoding) { } func (e *Encoder) asis(v []byte) { - if e.isas { - e.as.EncodeAsis(v) - } else { + if e.as == nil { e.w.writeb(v) + } else { + e.as.EncodeAsis(v) } } @@ -1287,9 +1401,14 @@ func (e *Encoder) rawBytes(vv Raw) { if !e.h.Raw { e.errorf("Raw values cannot be encoded: %v", v) } - e.asis(v) + if e.as == nil { + e.w.writeb(v) + } else { + e.as.EncodeAsis(v) + } } -func (e *Encoder) wrapErrstr(v interface{}, err *error) { - *err = fmt.Errorf("%s encode error: %v", e.hh.Name(), v) +func (e *Encoder) errorf(format string, params ...interface{}) { + err := fmt.Errorf(format, params...) + panic(err) } diff --git a/vendor/github.com/ugorji/go/codec/fast-path.generated.go b/vendor/github.com/ugorji/go/codec/fast-path.generated.go index 87f2562f..69b11fcf 100644 --- a/vendor/github.com/ugorji/go/codec/fast-path.generated.go +++ b/vendor/github.com/ugorji/go/codec/fast-path.generated.go @@ -3,7 +3,10 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. -// Code generated from fast-path.go.tmpl - DO NOT EDIT. +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED from fast-path.go.tmpl +// ************************************************************ package codec @@ -15,19 +18,19 @@ package codec // This file can be omitted without causing a build failure. // // The advantage of fast paths is: -// - Many calls bypass reflection altogether +// - 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, +// - map of all builtin types to string or interface value +// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8) // This should provide adequate "typical" implementations. // // Note that fast track decode functions must handle values for which an address cannot be obtained. // For example: -// m2 := map[string]int{} -// p2 := []interface{}{m2} -// // decoding into p2 will bomb if fast track functions do not treat like unaddressable. +// m2 := map[string]int{} +// p2 := []interface{}{m2} +// // decoding into p2 will bomb if fast track functions do not treat like unaddressable. // import ( @@ -83,6 +86,10 @@ func init() { fd func(*Decoder, *codecFnInfo, reflect.Value)) (f fastpathE) { xrt := reflect.TypeOf(v) xptr := rt2id(xrt) + if useLookupRecognizedTypes { + recognizedRtids = append(recognizedRtids, xptr) + recognizedRtidPtrs = append(recognizedRtidPtrs, rt2id(reflect.PtrTo(xrt))) + } fastpathAV[i] = fastpathE{xptr, xrt, fe, fd} i++ return @@ -374,1090 +381,2734 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceIntfV(v, e) case *[]interface{}: fastpathTV.EncSliceIntfV(*v, e) - case []string: - fastpathTV.EncSliceStringV(v, e) - case *[]string: - fastpathTV.EncSliceStringV(*v, e) - case []float32: - fastpathTV.EncSliceFloat32V(v, e) - case *[]float32: - fastpathTV.EncSliceFloat32V(*v, e) - case []float64: - fastpathTV.EncSliceFloat64V(v, e) - case *[]float64: - fastpathTV.EncSliceFloat64V(*v, e) - case []uint: - fastpathTV.EncSliceUintV(v, e) - case *[]uint: - fastpathTV.EncSliceUintV(*v, e) - case []uint16: - fastpathTV.EncSliceUint16V(v, e) - case *[]uint16: - fastpathTV.EncSliceUint16V(*v, e) - case []uint32: - fastpathTV.EncSliceUint32V(v, e) - case *[]uint32: - fastpathTV.EncSliceUint32V(*v, e) - case []uint64: - fastpathTV.EncSliceUint64V(v, e) - case *[]uint64: - fastpathTV.EncSliceUint64V(*v, e) - case []uintptr: - fastpathTV.EncSliceUintptrV(v, e) - case *[]uintptr: - fastpathTV.EncSliceUintptrV(*v, e) - case []int: - fastpathTV.EncSliceIntV(v, e) - case *[]int: - fastpathTV.EncSliceIntV(*v, e) - case []int8: - fastpathTV.EncSliceInt8V(v, e) - case *[]int8: - fastpathTV.EncSliceInt8V(*v, e) - case []int16: - fastpathTV.EncSliceInt16V(v, e) - case *[]int16: - fastpathTV.EncSliceInt16V(*v, e) - case []int32: - fastpathTV.EncSliceInt32V(v, e) - case *[]int32: - fastpathTV.EncSliceInt32V(*v, e) - case []int64: - fastpathTV.EncSliceInt64V(v, e) - case *[]int64: - fastpathTV.EncSliceInt64V(*v, e) - case []bool: - fastpathTV.EncSliceBoolV(v, e) - 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 []string: + fastpathTV.EncSliceStringV(v, e) + case *[]string: + fastpathTV.EncSliceStringV(*v, e) + case map[string]interface{}: fastpathTV.EncMapStringIntfV(v, e) case *map[string]interface{}: fastpathTV.EncMapStringIntfV(*v, e) + case map[string]string: fastpathTV.EncMapStringStringV(v, e) case *map[string]string: fastpathTV.EncMapStringStringV(*v, e) + case map[string]uint: fastpathTV.EncMapStringUintV(v, e) case *map[string]uint: fastpathTV.EncMapStringUintV(*v, e) + case map[string]uint8: 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: fastpathTV.EncMapStringUint64V(*v, e) + case map[string]uintptr: fastpathTV.EncMapStringUintptrV(v, e) case *map[string]uintptr: fastpathTV.EncMapStringUintptrV(*v, e) + case map[string]int: 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: fastpathTV.EncMapStringInt64V(*v, e) + case map[string]float32: fastpathTV.EncMapStringFloat32V(v, e) case *map[string]float32: fastpathTV.EncMapStringFloat32V(*v, e) + case map[string]float64: fastpathTV.EncMapStringFloat64V(v, e) case *map[string]float64: fastpathTV.EncMapStringFloat64V(*v, e) + case map[string]bool: fastpathTV.EncMapStringBoolV(v, e) case *map[string]bool: fastpathTV.EncMapStringBoolV(*v, e) + + case []float32: + fastpathTV.EncSliceFloat32V(v, e) + case *[]float32: + fastpathTV.EncSliceFloat32V(*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 []float64: + fastpathTV.EncSliceFloat64V(v, e) + case *[]float64: + fastpathTV.EncSliceFloat64V(*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 []uint: + fastpathTV.EncSliceUintV(v, e) + case *[]uint: + fastpathTV.EncSliceUintV(*v, e) + case map[uint]interface{}: fastpathTV.EncMapUintIntfV(v, e) case *map[uint]interface{}: fastpathTV.EncMapUintIntfV(*v, e) + case map[uint]string: fastpathTV.EncMapUintStringV(v, e) case *map[uint]string: fastpathTV.EncMapUintStringV(*v, e) + case map[uint]uint: fastpathTV.EncMapUintUintV(v, e) case *map[uint]uint: fastpathTV.EncMapUintUintV(*v, e) + case map[uint]uint8: 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: fastpathTV.EncMapUintUint64V(*v, e) + case map[uint]uintptr: fastpathTV.EncMapUintUintptrV(v, e) case *map[uint]uintptr: fastpathTV.EncMapUintUintptrV(*v, e) + case map[uint]int: 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: fastpathTV.EncMapUintInt64V(*v, e) + case map[uint]float32: fastpathTV.EncMapUintFloat32V(v, e) case *map[uint]float32: fastpathTV.EncMapUintFloat32V(*v, e) + case map[uint]float64: fastpathTV.EncMapUintFloat64V(v, e) case *map[uint]float64: fastpathTV.EncMapUintFloat64V(*v, e) + case map[uint]bool: fastpathTV.EncMapUintBoolV(v, e) case *map[uint]bool: fastpathTV.EncMapUintBoolV(*v, e) + case map[uint8]interface{}: fastpathTV.EncMapUint8IntfV(v, e) case *map[uint8]interface{}: fastpathTV.EncMapUint8IntfV(*v, e) + case map[uint8]string: fastpathTV.EncMapUint8StringV(v, e) case *map[uint8]string: fastpathTV.EncMapUint8StringV(*v, e) + case map[uint8]uint: fastpathTV.EncMapUint8UintV(v, e) case *map[uint8]uint: fastpathTV.EncMapUint8UintV(*v, e) + case map[uint8]uint8: 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: fastpathTV.EncMapUint8Uint64V(*v, e) + case map[uint8]uintptr: fastpathTV.EncMapUint8UintptrV(v, e) case *map[uint8]uintptr: fastpathTV.EncMapUint8UintptrV(*v, e) + case map[uint8]int: 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: fastpathTV.EncMapUint8Int64V(*v, e) + case map[uint8]float32: fastpathTV.EncMapUint8Float32V(v, e) case *map[uint8]float32: fastpathTV.EncMapUint8Float32V(*v, e) + case map[uint8]float64: fastpathTV.EncMapUint8Float64V(v, e) case *map[uint8]float64: fastpathTV.EncMapUint8Float64V(*v, e) + case map[uint8]bool: fastpathTV.EncMapUint8BoolV(v, e) case *map[uint8]bool: fastpathTV.EncMapUint8BoolV(*v, e) + + case []uint16: + fastpathTV.EncSliceUint16V(v, e) + case *[]uint16: + fastpathTV.EncSliceUint16V(*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 []uint32: + fastpathTV.EncSliceUint32V(v, e) + case *[]uint32: + fastpathTV.EncSliceUint32V(*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 []uint64: + fastpathTV.EncSliceUint64V(v, e) + case *[]uint64: + fastpathTV.EncSliceUint64V(*v, e) + case map[uint64]interface{}: fastpathTV.EncMapUint64IntfV(v, e) case *map[uint64]interface{}: fastpathTV.EncMapUint64IntfV(*v, e) + case map[uint64]string: fastpathTV.EncMapUint64StringV(v, e) case *map[uint64]string: fastpathTV.EncMapUint64StringV(*v, e) + case map[uint64]uint: fastpathTV.EncMapUint64UintV(v, e) case *map[uint64]uint: fastpathTV.EncMapUint64UintV(*v, e) + case map[uint64]uint8: 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: fastpathTV.EncMapUint64Uint64V(*v, e) + case map[uint64]uintptr: fastpathTV.EncMapUint64UintptrV(v, e) case *map[uint64]uintptr: fastpathTV.EncMapUint64UintptrV(*v, e) + case map[uint64]int: 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: fastpathTV.EncMapUint64Int64V(*v, e) + case map[uint64]float32: fastpathTV.EncMapUint64Float32V(v, e) case *map[uint64]float32: fastpathTV.EncMapUint64Float32V(*v, e) + case map[uint64]float64: fastpathTV.EncMapUint64Float64V(v, e) case *map[uint64]float64: fastpathTV.EncMapUint64Float64V(*v, e) + case map[uint64]bool: fastpathTV.EncMapUint64BoolV(v, e) case *map[uint64]bool: fastpathTV.EncMapUint64BoolV(*v, e) + + case []uintptr: + fastpathTV.EncSliceUintptrV(v, e) + case *[]uintptr: + fastpathTV.EncSliceUintptrV(*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 []int: + fastpathTV.EncSliceIntV(v, e) + case *[]int: + fastpathTV.EncSliceIntV(*v, e) + case map[int]interface{}: fastpathTV.EncMapIntIntfV(v, e) case *map[int]interface{}: fastpathTV.EncMapIntIntfV(*v, e) + case map[int]string: fastpathTV.EncMapIntStringV(v, e) case *map[int]string: fastpathTV.EncMapIntStringV(*v, e) + case map[int]uint: fastpathTV.EncMapIntUintV(v, e) case *map[int]uint: fastpathTV.EncMapIntUintV(*v, e) + case map[int]uint8: 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: fastpathTV.EncMapIntUint64V(*v, e) + case map[int]uintptr: fastpathTV.EncMapIntUintptrV(v, e) case *map[int]uintptr: fastpathTV.EncMapIntUintptrV(*v, e) + case map[int]int: 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: fastpathTV.EncMapIntInt64V(*v, e) + case map[int]float32: fastpathTV.EncMapIntFloat32V(v, e) case *map[int]float32: fastpathTV.EncMapIntFloat32V(*v, e) + case map[int]float64: fastpathTV.EncMapIntFloat64V(v, e) case *map[int]float64: fastpathTV.EncMapIntFloat64V(*v, e) + case map[int]bool: fastpathTV.EncMapIntBoolV(v, e) case *map[int]bool: fastpathTV.EncMapIntBoolV(*v, e) + + case []int8: + fastpathTV.EncSliceInt8V(v, e) + case *[]int8: + fastpathTV.EncSliceInt8V(*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 []int16: + fastpathTV.EncSliceInt16V(v, e) + case *[]int16: + fastpathTV.EncSliceInt16V(*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 []int32: + fastpathTV.EncSliceInt32V(v, e) + case *[]int32: + fastpathTV.EncSliceInt32V(*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 []int64: + fastpathTV.EncSliceInt64V(v, e) + case *[]int64: + fastpathTV.EncSliceInt64V(*v, e) + case map[int64]interface{}: fastpathTV.EncMapInt64IntfV(v, e) case *map[int64]interface{}: fastpathTV.EncMapInt64IntfV(*v, e) + case map[int64]string: fastpathTV.EncMapInt64StringV(v, e) case *map[int64]string: fastpathTV.EncMapInt64StringV(*v, e) + case map[int64]uint: fastpathTV.EncMapInt64UintV(v, e) case *map[int64]uint: fastpathTV.EncMapInt64UintV(*v, e) + case map[int64]uint8: 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: fastpathTV.EncMapInt64Uint64V(*v, e) + case map[int64]uintptr: fastpathTV.EncMapInt64UintptrV(v, e) case *map[int64]uintptr: fastpathTV.EncMapInt64UintptrV(*v, e) + case map[int64]int: 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: fastpathTV.EncMapInt64Int64V(*v, e) + case map[int64]float32: fastpathTV.EncMapInt64Float32V(v, e) case *map[int64]float32: fastpathTV.EncMapInt64Float32V(*v, e) + case map[int64]float64: fastpathTV.EncMapInt64Float64V(v, e) case *map[int64]float64: fastpathTV.EncMapInt64Float64V(*v, e) + case map[int64]bool: fastpathTV.EncMapInt64BoolV(v, e) case *map[int64]bool: fastpathTV.EncMapInt64BoolV(*v, e) + + case []bool: + fastpathTV.EncSliceBoolV(v, e) + case *[]bool: + fastpathTV.EncSliceBoolV(*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 + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) + return false + } + return true +} + +func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { + switch v := iv.(type) { + + case []interface{}: + fastpathTV.EncSliceIntfV(v, e) + case *[]interface{}: + fastpathTV.EncSliceIntfV(*v, e) + + case []string: + fastpathTV.EncSliceStringV(v, e) + case *[]string: + fastpathTV.EncSliceStringV(*v, e) + + case []float32: + fastpathTV.EncSliceFloat32V(v, e) + case *[]float32: + fastpathTV.EncSliceFloat32V(*v, e) + + case []float64: + fastpathTV.EncSliceFloat64V(v, e) + case *[]float64: + fastpathTV.EncSliceFloat64V(*v, e) + + case []uint: + fastpathTV.EncSliceUintV(v, e) + case *[]uint: + fastpathTV.EncSliceUintV(*v, e) + + case []uint16: + fastpathTV.EncSliceUint16V(v, e) + case *[]uint16: + fastpathTV.EncSliceUint16V(*v, e) + + case []uint32: + fastpathTV.EncSliceUint32V(v, e) + case *[]uint32: + fastpathTV.EncSliceUint32V(*v, e) + + case []uint64: + fastpathTV.EncSliceUint64V(v, e) + case *[]uint64: + fastpathTV.EncSliceUint64V(*v, e) + + case []uintptr: + fastpathTV.EncSliceUintptrV(v, e) + case *[]uintptr: + fastpathTV.EncSliceUintptrV(*v, e) + + case []int: + fastpathTV.EncSliceIntV(v, e) + case *[]int: + fastpathTV.EncSliceIntV(*v, e) + + case []int8: + fastpathTV.EncSliceInt8V(v, e) + case *[]int8: + fastpathTV.EncSliceInt8V(*v, e) + + case []int16: + fastpathTV.EncSliceInt16V(v, e) + case *[]int16: + fastpathTV.EncSliceInt16V(*v, e) + + case []int32: + fastpathTV.EncSliceInt32V(v, e) + case *[]int32: + fastpathTV.EncSliceInt32V(*v, e) + + case []int64: + fastpathTV.EncSliceInt64V(v, e) + case *[]int64: + fastpathTV.EncSliceInt64V(*v, e) + + case []bool: + fastpathTV.EncSliceBoolV(v, e) + case *[]bool: + fastpathTV.EncSliceBoolV(*v, e) + + default: + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) + return false + } + return true +} + +func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { + switch v := iv.(type) { + + 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{}: + fastpathTV.EncMapStringIntfV(*v, e) + + case map[string]string: + fastpathTV.EncMapStringStringV(v, e) + case *map[string]string: + fastpathTV.EncMapStringStringV(*v, e) + + case map[string]uint: + fastpathTV.EncMapStringUintV(v, e) + case *map[string]uint: + fastpathTV.EncMapStringUintV(*v, e) + + case map[string]uint8: + 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: + fastpathTV.EncMapStringUint64V(*v, e) + + case map[string]uintptr: + fastpathTV.EncMapStringUintptrV(v, e) + case *map[string]uintptr: + fastpathTV.EncMapStringUintptrV(*v, e) + + case map[string]int: + 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: + fastpathTV.EncMapStringInt64V(*v, e) + + case map[string]float32: + fastpathTV.EncMapStringFloat32V(v, e) + case *map[string]float32: + fastpathTV.EncMapStringFloat32V(*v, e) + + case map[string]float64: + fastpathTV.EncMapStringFloat64V(v, e) + case *map[string]float64: + fastpathTV.EncMapStringFloat64V(*v, e) + + case map[string]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{}: + fastpathTV.EncMapUintIntfV(*v, e) + + case map[uint]string: + fastpathTV.EncMapUintStringV(v, e) + case *map[uint]string: + fastpathTV.EncMapUintStringV(*v, e) + + case map[uint]uint: + fastpathTV.EncMapUintUintV(v, e) + case *map[uint]uint: + fastpathTV.EncMapUintUintV(*v, e) + + case map[uint]uint8: + 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: + fastpathTV.EncMapUintUint64V(*v, e) + + case map[uint]uintptr: + fastpathTV.EncMapUintUintptrV(v, e) + case *map[uint]uintptr: + fastpathTV.EncMapUintUintptrV(*v, e) + + case map[uint]int: + 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: + fastpathTV.EncMapUintInt64V(*v, e) + + case map[uint]float32: + fastpathTV.EncMapUintFloat32V(v, e) + case *map[uint]float32: + fastpathTV.EncMapUintFloat32V(*v, e) + + case map[uint]float64: + fastpathTV.EncMapUintFloat64V(v, e) + case *map[uint]float64: + fastpathTV.EncMapUintFloat64V(*v, e) + + case map[uint]bool: + fastpathTV.EncMapUintBoolV(v, e) + case *map[uint]bool: + fastpathTV.EncMapUintBoolV(*v, e) + + case map[uint8]interface{}: + fastpathTV.EncMapUint8IntfV(v, e) + case *map[uint8]interface{}: + fastpathTV.EncMapUint8IntfV(*v, e) + + case map[uint8]string: + fastpathTV.EncMapUint8StringV(v, e) + case *map[uint8]string: + fastpathTV.EncMapUint8StringV(*v, e) + + case map[uint8]uint: + fastpathTV.EncMapUint8UintV(v, e) + case *map[uint8]uint: + fastpathTV.EncMapUint8UintV(*v, e) + + case map[uint8]uint8: + 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: + fastpathTV.EncMapUint8Uint64V(*v, e) + + case map[uint8]uintptr: + fastpathTV.EncMapUint8UintptrV(v, e) + case *map[uint8]uintptr: + fastpathTV.EncMapUint8UintptrV(*v, e) + + case map[uint8]int: + 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: + fastpathTV.EncMapUint8Int64V(*v, e) + + case map[uint8]float32: + fastpathTV.EncMapUint8Float32V(v, e) + case *map[uint8]float32: + fastpathTV.EncMapUint8Float32V(*v, e) + + case map[uint8]float64: + fastpathTV.EncMapUint8Float64V(v, e) + case *map[uint8]float64: + fastpathTV.EncMapUint8Float64V(*v, e) + + case map[uint8]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{}: + fastpathTV.EncMapUint64IntfV(*v, e) + + case map[uint64]string: + fastpathTV.EncMapUint64StringV(v, e) + case *map[uint64]string: + fastpathTV.EncMapUint64StringV(*v, e) + + case map[uint64]uint: + fastpathTV.EncMapUint64UintV(v, e) + case *map[uint64]uint: + fastpathTV.EncMapUint64UintV(*v, e) + + case map[uint64]uint8: + 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: + fastpathTV.EncMapUint64Uint64V(*v, e) + + case map[uint64]uintptr: + fastpathTV.EncMapUint64UintptrV(v, e) + case *map[uint64]uintptr: + fastpathTV.EncMapUint64UintptrV(*v, e) + + case map[uint64]int: + 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: + fastpathTV.EncMapUint64Int64V(*v, e) + + case map[uint64]float32: + fastpathTV.EncMapUint64Float32V(v, e) + case *map[uint64]float32: + fastpathTV.EncMapUint64Float32V(*v, e) + + case map[uint64]float64: + fastpathTV.EncMapUint64Float64V(v, e) + case *map[uint64]float64: + fastpathTV.EncMapUint64Float64V(*v, e) + + case map[uint64]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{}: + fastpathTV.EncMapIntIntfV(*v, e) + + case map[int]string: + fastpathTV.EncMapIntStringV(v, e) + case *map[int]string: + fastpathTV.EncMapIntStringV(*v, e) + + case map[int]uint: + fastpathTV.EncMapIntUintV(v, e) + case *map[int]uint: + fastpathTV.EncMapIntUintV(*v, e) + + case map[int]uint8: + 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: + fastpathTV.EncMapIntUint64V(*v, e) + + case map[int]uintptr: + fastpathTV.EncMapIntUintptrV(v, e) + case *map[int]uintptr: + fastpathTV.EncMapIntUintptrV(*v, e) + + case map[int]int: + 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: + fastpathTV.EncMapIntInt64V(*v, e) + + case map[int]float32: + fastpathTV.EncMapIntFloat32V(v, e) + case *map[int]float32: + fastpathTV.EncMapIntFloat32V(*v, e) + + case map[int]float64: + fastpathTV.EncMapIntFloat64V(v, e) + case *map[int]float64: + fastpathTV.EncMapIntFloat64V(*v, e) + + case map[int]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{}: + fastpathTV.EncMapInt64IntfV(*v, e) + + case map[int64]string: + fastpathTV.EncMapInt64StringV(v, e) + case *map[int64]string: + fastpathTV.EncMapInt64StringV(*v, e) + + case map[int64]uint: + fastpathTV.EncMapInt64UintV(v, e) + case *map[int64]uint: + fastpathTV.EncMapInt64UintV(*v, e) + + case map[int64]uint8: + 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: + fastpathTV.EncMapInt64Uint64V(*v, e) + + case map[int64]uintptr: + fastpathTV.EncMapInt64UintptrV(v, e) + case *map[int64]uintptr: + fastpathTV.EncMapInt64UintptrV(*v, e) + + case map[int64]int: + 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: + fastpathTV.EncMapInt64Int64V(*v, e) + + case map[int64]float32: + fastpathTV.EncMapInt64Float32V(v, e) + case *map[int64]float32: + fastpathTV.EncMapInt64Float32V(*v, e) + + case map[int64]float64: + fastpathTV.EncMapInt64Float64V(v, e) + case *map[int64]float64: + fastpathTV.EncMapInt64Float64V(*v, e) + + case map[int64]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 // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true @@ -1473,24 +3124,17 @@ func (e *Encoder) fastpathEncSliceIntfR(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - e.encode(v2) - } - } else { - for _, v2 := range v { - e.encode(v2) } + e.encode(v2) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceIntfV(v []interface{}, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -1498,19 +3142,15 @@ func (_ fastpathT) EncAsMapSliceIntfV(v []interface{}, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - e.encode(v2) - } - } else { - for _, v2 := range v { - e.encode(v2) } + e.encode(v2) } ee.WriteMapEnd() } @@ -1523,24 +3163,17 @@ func (e *Encoder) fastpathEncSliceStringR(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - ee.EncodeString(cUTF8, v2) - } - } else { - for _, v2 := range v { - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceStringV(v []string, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -1548,19 +3181,15 @@ func (_ fastpathT) EncAsMapSliceStringV(v []string, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - ee.EncodeString(cUTF8, v2) - } - } else { - for _, v2 := range v { - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } ee.WriteMapEnd() } @@ -1573,24 +3202,17 @@ func (e *Encoder) fastpathEncSliceFloat32R(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - ee.EncodeFloat32(v2) - } - } else { - for _, v2 := range v { - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceFloat32V(v []float32, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -1598,19 +3220,15 @@ func (_ fastpathT) EncAsMapSliceFloat32V(v []float32, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - ee.EncodeFloat32(v2) - } - } else { - for _, v2 := range v { - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } ee.WriteMapEnd() } @@ -1623,24 +3241,17 @@ func (e *Encoder) fastpathEncSliceFloat64R(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - ee.EncodeFloat64(v2) - } - } else { - for _, v2 := range v { - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceFloat64V(v []float64, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -1648,19 +3259,15 @@ func (_ fastpathT) EncAsMapSliceFloat64V(v []float64, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - ee.EncodeFloat64(v2) - } - } else { - for _, v2 := range v { - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } ee.WriteMapEnd() } @@ -1673,24 +3280,17 @@ func (e *Encoder) fastpathEncSliceUintR(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - ee.EncodeUint(uint64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceUintV(v []uint, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -1698,69 +3298,15 @@ func (_ fastpathT) EncAsMapSliceUintV(v []uint, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - ee.EncodeUint(uint64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteMapEnd() -} - -func (e *Encoder) fastpathEncSliceUint8R(f *codecFnInfo, rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceUint8V(rv2i(rv).([]uint8), e) - } else { - fastpathTV.EncSliceUint8V(rv2i(rv).([]uint8), e) - } -} -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)) - if esep { - for _, v2 := range v { - ee.WriteArrayElem() - ee.EncodeUint(uint64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeUint(uint64(v2)) - } - } - ee.WriteArrayEnd() -} -func (_ fastpathT) EncAsMapSliceUint8V(v []uint8, e *Encoder) { - ee, esep := e.e, e.hh.hasElemSeparators() - if len(v)%2 == 1 { - e.errorf("mapBySlice requires even slice length, but got %v", len(v)) - return - } - ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { - if j%2 == 0 { - ee.WriteMapElemKey() - } else { - ee.WriteMapElemValue() - } - ee.EncodeUint(uint64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } ee.WriteMapEnd() } @@ -1773,24 +3319,17 @@ func (e *Encoder) fastpathEncSliceUint16R(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - ee.EncodeUint(uint64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceUint16V(v []uint16, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -1798,19 +3337,15 @@ func (_ fastpathT) EncAsMapSliceUint16V(v []uint16, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - ee.EncodeUint(uint64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } ee.WriteMapEnd() } @@ -1823,24 +3358,17 @@ func (e *Encoder) fastpathEncSliceUint32R(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - ee.EncodeUint(uint64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceUint32V(v []uint32, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -1848,19 +3376,15 @@ func (_ fastpathT) EncAsMapSliceUint32V(v []uint32, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - ee.EncodeUint(uint64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } ee.WriteMapEnd() } @@ -1873,24 +3397,17 @@ func (e *Encoder) fastpathEncSliceUint64R(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - ee.EncodeUint(uint64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceUint64V(v []uint64, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -1898,19 +3415,15 @@ func (_ fastpathT) EncAsMapSliceUint64V(v []uint64, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - ee.EncodeUint(uint64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } ee.WriteMapEnd() } @@ -1923,24 +3436,17 @@ func (e *Encoder) fastpathEncSliceUintptrR(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - e.encode(v2) - } - } else { - for _, v2 := range v { - e.encode(v2) } + e.encode(v2) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceUintptrV(v []uintptr, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -1948,19 +3454,15 @@ func (_ fastpathT) EncAsMapSliceUintptrV(v []uintptr, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - e.encode(v2) - } - } else { - for _, v2 := range v { - e.encode(v2) } + e.encode(v2) } ee.WriteMapEnd() } @@ -1973,24 +3475,17 @@ func (e *Encoder) fastpathEncSliceIntR(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - ee.EncodeInt(int64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceIntV(v []int, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -1998,19 +3493,15 @@ func (_ fastpathT) EncAsMapSliceIntV(v []int, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - ee.EncodeInt(int64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } ee.WriteMapEnd() } @@ -2023,24 +3514,17 @@ func (e *Encoder) fastpathEncSliceInt8R(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - ee.EncodeInt(int64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceInt8V(v []int8, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -2048,19 +3532,15 @@ func (_ fastpathT) EncAsMapSliceInt8V(v []int8, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - ee.EncodeInt(int64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } ee.WriteMapEnd() } @@ -2073,24 +3553,17 @@ func (e *Encoder) fastpathEncSliceInt16R(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - ee.EncodeInt(int64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceInt16V(v []int16, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -2098,19 +3571,15 @@ func (_ fastpathT) EncAsMapSliceInt16V(v []int16, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - ee.EncodeInt(int64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } ee.WriteMapEnd() } @@ -2123,24 +3592,17 @@ func (e *Encoder) fastpathEncSliceInt32R(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - ee.EncodeInt(int64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceInt32V(v []int32, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -2148,19 +3610,15 @@ func (_ fastpathT) EncAsMapSliceInt32V(v []int32, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - ee.EncodeInt(int64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } ee.WriteMapEnd() } @@ -2173,24 +3631,17 @@ func (e *Encoder) fastpathEncSliceInt64R(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - ee.EncodeInt(int64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceInt64V(v []int64, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -2198,19 +3649,15 @@ func (_ fastpathT) EncAsMapSliceInt64V(v []int64, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - ee.EncodeInt(int64(v2)) - } - } else { - for _, v2 := range v { - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } ee.WriteMapEnd() } @@ -2223,24 +3670,17 @@ func (e *Encoder) fastpathEncSliceBoolR(f *codecFnInfo, rv reflect.Value) { } } 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)) - if esep { - for _, v2 := range v { + for _, v2 := range v { + if esep { ee.WriteArrayElem() - ee.EncodeBool(v2) - } - } else { - for _, v2 := range v { - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } ee.WriteArrayEnd() } + func (_ fastpathT) EncAsMapSliceBoolV(v []bool, e *Encoder) { ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { @@ -2248,19 +3688,15 @@ func (_ fastpathT) EncAsMapSliceBoolV(v []bool, e *Encoder) { return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { + for j, v2 := range v { + if esep { if j%2 == 0 { ee.WriteMapElemKey() } else { ee.WriteMapElemValue() } - ee.EncodeBool(v2) - } - } else { - for _, v2 := range v { - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } ee.WriteMapEnd() } @@ -2269,10 +3705,6 @@ 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 { @@ -2290,32 +3722,26 @@ func (_ fastpathT) EncMapIntfIntfV(v map[interface{}]interface{}, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - e.encode(k2) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -2325,10 +3751,6 @@ 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 { @@ -2346,32 +3768,26 @@ func (_ fastpathT) EncMapIntfStringV(v map[interface{}]string, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -2381,10 +3797,6 @@ 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 { @@ -2402,32 +3814,26 @@ func (_ fastpathT) EncMapIntfUintV(v map[interface{}]uint, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -2437,10 +3843,6 @@ 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 { @@ -2458,32 +3860,26 @@ func (_ fastpathT) EncMapIntfUint8V(v map[interface{}]uint8, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -2493,10 +3889,6 @@ 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 { @@ -2514,32 +3906,26 @@ func (_ fastpathT) EncMapIntfUint16V(v map[interface{}]uint16, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -2549,10 +3935,6 @@ 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 { @@ -2570,32 +3952,26 @@ func (_ fastpathT) EncMapIntfUint32V(v map[interface{}]uint32, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -2605,10 +3981,6 @@ 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 { @@ -2626,32 +3998,26 @@ func (_ fastpathT) EncMapIntfUint64V(v map[interface{}]uint64, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -2661,10 +4027,6 @@ 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 { @@ -2682,32 +4044,26 @@ func (_ fastpathT) EncMapIntfUintptrV(v map[interface{}]uintptr, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - e.encode(k2) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -2717,10 +4073,6 @@ 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 { @@ -2738,32 +4090,26 @@ func (_ fastpathT) EncMapIntfIntV(v map[interface{}]int, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -2773,10 +4119,6 @@ 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 { @@ -2794,32 +4136,26 @@ func (_ fastpathT) EncMapIntfInt8V(v map[interface{}]int8, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -2829,10 +4165,6 @@ 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 { @@ -2850,32 +4182,26 @@ func (_ fastpathT) EncMapIntfInt16V(v map[interface{}]int16, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -2885,10 +4211,6 @@ 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 { @@ -2906,32 +4228,26 @@ func (_ fastpathT) EncMapIntfInt32V(v map[interface{}]int32, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -2941,10 +4257,6 @@ 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 { @@ -2962,32 +4274,26 @@ func (_ fastpathT) EncMapIntfInt64V(v map[interface{}]int64, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -2997,10 +4303,6 @@ 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 { @@ -3018,32 +4320,26 @@ func (_ fastpathT) EncMapIntfFloat32V(v map[interface{}]float32, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -3053,10 +4349,6 @@ 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 { @@ -3074,32 +4366,26 @@ func (_ fastpathT) EncMapIntfFloat64V(v map[interface{}]float64, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -3109,10 +4395,6 @@ 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 { @@ -3130,32 +4412,26 @@ func (_ fastpathT) EncMapIntfBoolV(v map[interface{}]bool, e *Encoder) { i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { + for j := range v2 { + if esep { ee.WriteMapElemKey() - e.asis(v2[j].v) + } + e.asis(v2[j].v) + if esep { ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) } + e.encode(v[v2[j].i]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -3165,12 +4441,9 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3179,32 +4452,34 @@ func (_ fastpathT) EncMapStringIntfV(v map[string]interface{}, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - e.encode(v[string(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - e.encode(v[string(k2)]) } + e.encode(v[string(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -3214,12 +4489,9 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3228,32 +4500,34 @@ func (_ fastpathT) EncMapStringStringV(v map[string]string, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[string(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeString(cUTF8, v[string(k2)]) } + ee.EncodeString(c_UTF8, v[string(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -3263,12 +4537,9 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3277,32 +4548,34 @@ func (_ fastpathT) EncMapStringUintV(v map[string]uint, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[string(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeUint(uint64(v[string(k2)])) } + ee.EncodeUint(uint64(v[string(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -3312,12 +4585,9 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3326,32 +4596,34 @@ func (_ fastpathT) EncMapStringUint8V(v map[string]uint8, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[string(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeUint(uint64(v[string(k2)])) } + ee.EncodeUint(uint64(v[string(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -3361,12 +4633,9 @@ 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)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3375,32 +4644,34 @@ func (_ fastpathT) EncMapStringUint16V(v map[string]uint16, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[string(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeUint(uint64(v[string(k2)])) } + ee.EncodeUint(uint64(v[string(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -3410,12 +4681,9 @@ 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)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3424,32 +4692,34 @@ func (_ fastpathT) EncMapStringUint32V(v map[string]uint32, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[string(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeUint(uint64(v[string(k2)])) } + ee.EncodeUint(uint64(v[string(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -3459,12 +4729,9 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3473,32 +4740,34 @@ func (_ fastpathT) EncMapStringUint64V(v map[string]uint64, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[string(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeUint(uint64(v[string(k2)])) } + ee.EncodeUint(uint64(v[string(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -3508,12 +4777,9 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3522,32 +4788,34 @@ func (_ fastpathT) EncMapStringUintptrV(v map[string]uintptr, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - e.encode(v[string(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - e.encode(v[string(k2)]) } + e.encode(v[string(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -3557,12 +4825,9 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3571,32 +4836,34 @@ func (_ fastpathT) EncMapStringIntV(v map[string]int, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[string(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeInt(int64(v[string(k2)])) } + ee.EncodeInt(int64(v[string(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -3606,12 +4873,9 @@ 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)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3620,32 +4884,34 @@ func (_ fastpathT) EncMapStringInt8V(v map[string]int8, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[string(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeInt(int64(v[string(k2)])) } + ee.EncodeInt(int64(v[string(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -3655,12 +4921,9 @@ 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)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3669,32 +4932,34 @@ func (_ fastpathT) EncMapStringInt16V(v map[string]int16, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[string(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeInt(int64(v[string(k2)])) } + ee.EncodeInt(int64(v[string(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -3704,12 +4969,9 @@ 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)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3718,32 +4980,34 @@ func (_ fastpathT) EncMapStringInt32V(v map[string]int32, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[string(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeInt(int64(v[string(k2)])) } + ee.EncodeInt(int64(v[string(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -3753,12 +5017,9 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3767,32 +5028,34 @@ func (_ fastpathT) EncMapStringInt64V(v map[string]int64, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[string(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeInt(int64(v[string(k2)])) } + ee.EncodeInt(int64(v[string(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -3802,12 +5065,9 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3816,32 +5076,34 @@ func (_ fastpathT) EncMapStringFloat32V(v map[string]float32, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[string(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeFloat32(v[string(k2)]) } + ee.EncodeFloat32(v[string(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -3851,12 +5113,9 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3865,32 +5124,34 @@ func (_ fastpathT) EncMapStringFloat64V(v map[string]float64, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[string(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeFloat64(v[string(k2)]) } + ee.EncodeFloat64(v[string(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -3900,12 +5161,9 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) + asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -3914,32 +5172,34 @@ func (_ fastpathT) EncMapStringBoolV(v map[string]bool, e *Encoder) { i++ } sort.Sort(stringSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[string(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeString(cUTF8, k2) - ee.EncodeBool(v[string(k2)]) } + ee.EncodeBool(v[string(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeString(cUTF8, k2) + } + if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + } + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeString(cUTF8, k2) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -3949,10 +5209,6 @@ 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 { @@ -3963,32 +5219,26 @@ func (_ fastpathT) EncMapFloat32IntfV(v map[float32]interface{}, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v[float32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - e.encode(v[float32(k2)]) } + e.encode(v[float32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -3998,10 +5248,6 @@ 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 { @@ -4012,32 +5258,26 @@ func (_ fastpathT) EncMapFloat32StringV(v map[float32]string, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[float32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeString(cUTF8, v[float32(k2)]) } + ee.EncodeString(c_UTF8, v[float32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -4047,10 +5287,6 @@ 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 { @@ -4061,32 +5297,26 @@ func (_ fastpathT) EncMapFloat32UintV(v map[float32]uint, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[float32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeUint(uint64(v[float32(k2)])) } + ee.EncodeUint(uint64(v[float32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -4096,10 +5326,6 @@ 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 { @@ -4110,32 +5336,26 @@ func (_ fastpathT) EncMapFloat32Uint8V(v map[float32]uint8, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[float32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeUint(uint64(v[float32(k2)])) } + ee.EncodeUint(uint64(v[float32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -4145,10 +5365,6 @@ 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 { @@ -4159,32 +5375,26 @@ func (_ fastpathT) EncMapFloat32Uint16V(v map[float32]uint16, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[float32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeUint(uint64(v[float32(k2)])) } + ee.EncodeUint(uint64(v[float32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -4194,10 +5404,6 @@ 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 { @@ -4208,32 +5414,26 @@ func (_ fastpathT) EncMapFloat32Uint32V(v map[float32]uint32, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[float32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeUint(uint64(v[float32(k2)])) } + ee.EncodeUint(uint64(v[float32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -4243,10 +5443,6 @@ 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 { @@ -4257,32 +5453,26 @@ func (_ fastpathT) EncMapFloat32Uint64V(v map[float32]uint64, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[float32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeUint(uint64(v[float32(k2)])) } + ee.EncodeUint(uint64(v[float32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -4292,10 +5482,6 @@ 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 { @@ -4306,32 +5492,26 @@ func (_ fastpathT) EncMapFloat32UintptrV(v map[float32]uintptr, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v[float32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - e.encode(v[float32(k2)]) } + e.encode(v[float32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -4341,10 +5521,6 @@ 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 { @@ -4355,32 +5531,26 @@ func (_ fastpathT) EncMapFloat32IntV(v map[float32]int, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[float32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeInt(int64(v[float32(k2)])) } + ee.EncodeInt(int64(v[float32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -4390,10 +5560,6 @@ 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 { @@ -4404,32 +5570,26 @@ func (_ fastpathT) EncMapFloat32Int8V(v map[float32]int8, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[float32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeInt(int64(v[float32(k2)])) } + ee.EncodeInt(int64(v[float32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -4439,10 +5599,6 @@ 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 { @@ -4453,32 +5609,26 @@ func (_ fastpathT) EncMapFloat32Int16V(v map[float32]int16, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[float32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeInt(int64(v[float32(k2)])) } + ee.EncodeInt(int64(v[float32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -4488,10 +5638,6 @@ 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 { @@ -4502,32 +5648,26 @@ func (_ fastpathT) EncMapFloat32Int32V(v map[float32]int32, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[float32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeInt(int64(v[float32(k2)])) } + ee.EncodeInt(int64(v[float32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -4537,10 +5677,6 @@ 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 { @@ -4551,32 +5687,26 @@ func (_ fastpathT) EncMapFloat32Int64V(v map[float32]int64, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[float32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeInt(int64(v[float32(k2)])) } + ee.EncodeInt(int64(v[float32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -4586,10 +5716,6 @@ 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 { @@ -4600,32 +5726,26 @@ func (_ fastpathT) EncMapFloat32Float32V(v map[float32]float32, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[float32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeFloat32(v[float32(k2)]) } + ee.EncodeFloat32(v[float32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -4635,10 +5755,6 @@ 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 { @@ -4649,32 +5765,26 @@ func (_ fastpathT) EncMapFloat32Float64V(v map[float32]float64, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[float32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeFloat64(v[float32(k2)]) } + ee.EncodeFloat64(v[float32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -4684,10 +5794,6 @@ 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 { @@ -4698,32 +5804,26 @@ func (_ fastpathT) EncMapFloat32BoolV(v map[float32]bool, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(float32(k2)) + } + ee.EncodeFloat32(float32(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[float32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat32(float32(k2)) - ee.EncodeBool(v[float32(k2)]) } + ee.EncodeBool(v[float32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat32(k2) + } + ee.EncodeFloat32(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat32(k2) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -4733,10 +5833,6 @@ 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 { @@ -4747,32 +5843,26 @@ func (_ fastpathT) EncMapFloat64IntfV(v map[float64]interface{}, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v[float64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - e.encode(v[float64(k2)]) } + e.encode(v[float64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -4782,10 +5872,6 @@ 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 { @@ -4796,32 +5882,26 @@ func (_ fastpathT) EncMapFloat64StringV(v map[float64]string, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[float64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeString(cUTF8, v[float64(k2)]) } + ee.EncodeString(c_UTF8, v[float64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -4831,10 +5911,6 @@ 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 { @@ -4845,32 +5921,26 @@ func (_ fastpathT) EncMapFloat64UintV(v map[float64]uint, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[float64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeUint(uint64(v[float64(k2)])) } + ee.EncodeUint(uint64(v[float64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -4880,10 +5950,6 @@ 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 { @@ -4894,32 +5960,26 @@ func (_ fastpathT) EncMapFloat64Uint8V(v map[float64]uint8, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[float64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeUint(uint64(v[float64(k2)])) } + ee.EncodeUint(uint64(v[float64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -4929,10 +5989,6 @@ 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 { @@ -4943,32 +5999,26 @@ func (_ fastpathT) EncMapFloat64Uint16V(v map[float64]uint16, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[float64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeUint(uint64(v[float64(k2)])) } + ee.EncodeUint(uint64(v[float64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -4978,10 +6028,6 @@ 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 { @@ -4992,32 +6038,26 @@ func (_ fastpathT) EncMapFloat64Uint32V(v map[float64]uint32, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[float64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeUint(uint64(v[float64(k2)])) } + ee.EncodeUint(uint64(v[float64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -5027,10 +6067,6 @@ 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 { @@ -5041,32 +6077,26 @@ func (_ fastpathT) EncMapFloat64Uint64V(v map[float64]uint64, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[float64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeUint(uint64(v[float64(k2)])) } + ee.EncodeUint(uint64(v[float64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -5076,10 +6106,6 @@ 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 { @@ -5090,32 +6116,26 @@ func (_ fastpathT) EncMapFloat64UintptrV(v map[float64]uintptr, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v[float64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - e.encode(v[float64(k2)]) } + e.encode(v[float64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -5125,10 +6145,6 @@ 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 { @@ -5139,32 +6155,26 @@ func (_ fastpathT) EncMapFloat64IntV(v map[float64]int, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[float64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeInt(int64(v[float64(k2)])) } + ee.EncodeInt(int64(v[float64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -5174,10 +6184,6 @@ 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 { @@ -5188,32 +6194,26 @@ func (_ fastpathT) EncMapFloat64Int8V(v map[float64]int8, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[float64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeInt(int64(v[float64(k2)])) } + ee.EncodeInt(int64(v[float64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -5223,10 +6223,6 @@ 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 { @@ -5237,32 +6233,26 @@ func (_ fastpathT) EncMapFloat64Int16V(v map[float64]int16, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[float64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeInt(int64(v[float64(k2)])) } + ee.EncodeInt(int64(v[float64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -5272,10 +6262,6 @@ 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 { @@ -5286,32 +6272,26 @@ func (_ fastpathT) EncMapFloat64Int32V(v map[float64]int32, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[float64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeInt(int64(v[float64(k2)])) } + ee.EncodeInt(int64(v[float64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -5321,10 +6301,6 @@ 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 { @@ -5335,32 +6311,26 @@ func (_ fastpathT) EncMapFloat64Int64V(v map[float64]int64, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[float64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeInt(int64(v[float64(k2)])) } + ee.EncodeInt(int64(v[float64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -5370,10 +6340,6 @@ 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 { @@ -5384,32 +6350,26 @@ func (_ fastpathT) EncMapFloat64Float32V(v map[float64]float32, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[float64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeFloat32(v[float64(k2)]) } + ee.EncodeFloat32(v[float64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -5419,10 +6379,6 @@ 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 { @@ -5433,32 +6389,26 @@ func (_ fastpathT) EncMapFloat64Float64V(v map[float64]float64, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[float64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeFloat64(v[float64(k2)]) } + ee.EncodeFloat64(v[float64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -5468,10 +6418,6 @@ 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 { @@ -5482,32 +6428,26 @@ func (_ fastpathT) EncMapFloat64BoolV(v map[float64]bool, e *Encoder) { i++ } sort.Sort(floatSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(float64(k2)) + } + ee.EncodeFloat64(float64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[float64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeFloat64(float64(k2)) - ee.EncodeBool(v[float64(k2)]) } + ee.EncodeBool(v[float64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeFloat64(k2) + } + ee.EncodeFloat64(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeFloat64(k2) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -5517,10 +6457,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -5531,32 +6467,26 @@ func (_ fastpathT) EncMapUintIntfV(v map[uint]interface{}, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[uint(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - e.encode(v[uint(k2)]) } + e.encode(v[uint(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -5566,10 +6496,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -5580,32 +6506,26 @@ func (_ fastpathT) EncMapUintStringV(v map[uint]string, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[uint(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeString(cUTF8, v[uint(k2)]) } + ee.EncodeString(c_UTF8, v[uint(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -5615,10 +6535,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -5629,32 +6545,26 @@ func (_ fastpathT) EncMapUintUintV(v map[uint]uint, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeUint(uint64(v[uint(k2)])) } + ee.EncodeUint(uint64(v[uint(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -5664,10 +6574,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -5678,32 +6584,26 @@ func (_ fastpathT) EncMapUintUint8V(v map[uint]uint8, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeUint(uint64(v[uint(k2)])) } + ee.EncodeUint(uint64(v[uint(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -5713,10 +6613,6 @@ 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 { @@ -5727,32 +6623,26 @@ func (_ fastpathT) EncMapUintUint16V(v map[uint]uint16, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeUint(uint64(v[uint(k2)])) } + ee.EncodeUint(uint64(v[uint(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -5762,10 +6652,6 @@ 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 { @@ -5776,32 +6662,26 @@ func (_ fastpathT) EncMapUintUint32V(v map[uint]uint32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeUint(uint64(v[uint(k2)])) } + ee.EncodeUint(uint64(v[uint(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -5811,10 +6691,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -5825,32 +6701,26 @@ func (_ fastpathT) EncMapUintUint64V(v map[uint]uint64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeUint(uint64(v[uint(k2)])) } + ee.EncodeUint(uint64(v[uint(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -5860,10 +6730,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -5874,32 +6740,26 @@ func (_ fastpathT) EncMapUintUintptrV(v map[uint]uintptr, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[uint(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - e.encode(v[uint(k2)]) } + e.encode(v[uint(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -5909,10 +6769,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -5923,32 +6779,26 @@ func (_ fastpathT) EncMapUintIntV(v map[uint]int, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeInt(int64(v[uint(k2)])) } + ee.EncodeInt(int64(v[uint(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -5958,10 +6808,6 @@ 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 { @@ -5972,32 +6818,26 @@ func (_ fastpathT) EncMapUintInt8V(v map[uint]int8, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeInt(int64(v[uint(k2)])) } + ee.EncodeInt(int64(v[uint(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -6007,10 +6847,6 @@ 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 { @@ -6021,32 +6857,26 @@ func (_ fastpathT) EncMapUintInt16V(v map[uint]int16, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeInt(int64(v[uint(k2)])) } + ee.EncodeInt(int64(v[uint(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -6056,10 +6886,6 @@ 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 { @@ -6070,32 +6896,26 @@ func (_ fastpathT) EncMapUintInt32V(v map[uint]int32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeInt(int64(v[uint(k2)])) } + ee.EncodeInt(int64(v[uint(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -6105,10 +6925,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -6119,32 +6935,26 @@ func (_ fastpathT) EncMapUintInt64V(v map[uint]int64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeInt(int64(v[uint(k2)])) } + ee.EncodeInt(int64(v[uint(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -6154,10 +6964,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -6168,32 +6974,26 @@ func (_ fastpathT) EncMapUintFloat32V(v map[uint]float32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[uint(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeFloat32(v[uint(k2)]) } + ee.EncodeFloat32(v[uint(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -6203,10 +7003,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -6217,32 +7013,26 @@ func (_ fastpathT) EncMapUintFloat64V(v map[uint]float64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[uint(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeFloat64(v[uint(k2)]) } + ee.EncodeFloat64(v[uint(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -6252,10 +7042,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -6266,32 +7052,26 @@ func (_ fastpathT) EncMapUintBoolV(v map[uint]bool, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint(k2))) + } + ee.EncodeUint(uint64(uint(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[uint(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint(k2))) - ee.EncodeBool(v[uint(k2)]) } + ee.EncodeBool(v[uint(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -6301,10 +7081,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -6315,32 +7091,26 @@ func (_ fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[uint8(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - e.encode(v[uint8(k2)]) } + e.encode(v[uint8(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -6350,10 +7120,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -6364,32 +7130,26 @@ func (_ fastpathT) EncMapUint8StringV(v map[uint8]string, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[uint8(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeString(cUTF8, v[uint8(k2)]) } + ee.EncodeString(c_UTF8, v[uint8(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -6399,10 +7159,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -6413,32 +7169,26 @@ func (_ fastpathT) EncMapUint8UintV(v map[uint8]uint, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeUint(uint64(v[uint8(k2)])) } + ee.EncodeUint(uint64(v[uint8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -6448,10 +7198,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -6462,32 +7208,26 @@ func (_ fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeUint(uint64(v[uint8(k2)])) } + ee.EncodeUint(uint64(v[uint8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -6497,10 +7237,6 @@ 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 { @@ -6511,32 +7247,26 @@ func (_ fastpathT) EncMapUint8Uint16V(v map[uint8]uint16, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeUint(uint64(v[uint8(k2)])) } + ee.EncodeUint(uint64(v[uint8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -6546,10 +7276,6 @@ 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 { @@ -6560,32 +7286,26 @@ func (_ fastpathT) EncMapUint8Uint32V(v map[uint8]uint32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeUint(uint64(v[uint8(k2)])) } + ee.EncodeUint(uint64(v[uint8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -6595,10 +7315,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -6609,32 +7325,26 @@ func (_ fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeUint(uint64(v[uint8(k2)])) } + ee.EncodeUint(uint64(v[uint8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -6644,10 +7354,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -6658,32 +7364,26 @@ func (_ fastpathT) EncMapUint8UintptrV(v map[uint8]uintptr, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[uint8(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - e.encode(v[uint8(k2)]) } + e.encode(v[uint8(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -6693,10 +7393,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -6707,32 +7403,26 @@ func (_ fastpathT) EncMapUint8IntV(v map[uint8]int, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeInt(int64(v[uint8(k2)])) } + ee.EncodeInt(int64(v[uint8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -6742,10 +7432,6 @@ 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 { @@ -6756,32 +7442,26 @@ func (_ fastpathT) EncMapUint8Int8V(v map[uint8]int8, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeInt(int64(v[uint8(k2)])) } + ee.EncodeInt(int64(v[uint8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -6791,10 +7471,6 @@ 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 { @@ -6805,32 +7481,26 @@ func (_ fastpathT) EncMapUint8Int16V(v map[uint8]int16, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeInt(int64(v[uint8(k2)])) } + ee.EncodeInt(int64(v[uint8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -6840,10 +7510,6 @@ 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 { @@ -6854,32 +7520,26 @@ func (_ fastpathT) EncMapUint8Int32V(v map[uint8]int32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeInt(int64(v[uint8(k2)])) } + ee.EncodeInt(int64(v[uint8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -6889,10 +7549,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -6903,32 +7559,26 @@ func (_ fastpathT) EncMapUint8Int64V(v map[uint8]int64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeInt(int64(v[uint8(k2)])) } + ee.EncodeInt(int64(v[uint8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -6938,10 +7588,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -6952,32 +7598,26 @@ func (_ fastpathT) EncMapUint8Float32V(v map[uint8]float32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[uint8(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeFloat32(v[uint8(k2)]) } + ee.EncodeFloat32(v[uint8(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -6987,10 +7627,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -7001,32 +7637,26 @@ func (_ fastpathT) EncMapUint8Float64V(v map[uint8]float64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[uint8(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeFloat64(v[uint8(k2)]) } + ee.EncodeFloat64(v[uint8(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -7036,10 +7666,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -7050,32 +7676,26 @@ func (_ fastpathT) EncMapUint8BoolV(v map[uint8]bool, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint8(k2))) + } + ee.EncodeUint(uint64(uint8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[uint8(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint8(k2))) - ee.EncodeBool(v[uint8(k2)]) } + ee.EncodeBool(v[uint8(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -7085,10 +7705,6 @@ 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 { @@ -7099,32 +7715,26 @@ func (_ fastpathT) EncMapUint16IntfV(v map[uint16]interface{}, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[uint16(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - e.encode(v[uint16(k2)]) } + e.encode(v[uint16(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -7134,10 +7744,6 @@ 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 { @@ -7148,32 +7754,26 @@ func (_ fastpathT) EncMapUint16StringV(v map[uint16]string, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[uint16(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeString(cUTF8, v[uint16(k2)]) } + ee.EncodeString(c_UTF8, v[uint16(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -7183,10 +7783,6 @@ 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 { @@ -7197,32 +7793,26 @@ func (_ fastpathT) EncMapUint16UintV(v map[uint16]uint, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeUint(uint64(v[uint16(k2)])) } + ee.EncodeUint(uint64(v[uint16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -7232,10 +7822,6 @@ 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 { @@ -7246,32 +7832,26 @@ func (_ fastpathT) EncMapUint16Uint8V(v map[uint16]uint8, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeUint(uint64(v[uint16(k2)])) } + ee.EncodeUint(uint64(v[uint16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -7281,10 +7861,6 @@ 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 { @@ -7295,32 +7871,26 @@ func (_ fastpathT) EncMapUint16Uint16V(v map[uint16]uint16, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeUint(uint64(v[uint16(k2)])) } + ee.EncodeUint(uint64(v[uint16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -7330,10 +7900,6 @@ 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 { @@ -7344,32 +7910,26 @@ func (_ fastpathT) EncMapUint16Uint32V(v map[uint16]uint32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeUint(uint64(v[uint16(k2)])) } + ee.EncodeUint(uint64(v[uint16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -7379,10 +7939,6 @@ 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 { @@ -7393,32 +7949,26 @@ func (_ fastpathT) EncMapUint16Uint64V(v map[uint16]uint64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeUint(uint64(v[uint16(k2)])) } + ee.EncodeUint(uint64(v[uint16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -7428,10 +7978,6 @@ 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 { @@ -7442,32 +7988,26 @@ func (_ fastpathT) EncMapUint16UintptrV(v map[uint16]uintptr, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[uint16(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - e.encode(v[uint16(k2)]) } + e.encode(v[uint16(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -7477,10 +8017,6 @@ 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 { @@ -7491,32 +8027,26 @@ func (_ fastpathT) EncMapUint16IntV(v map[uint16]int, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeInt(int64(v[uint16(k2)])) } + ee.EncodeInt(int64(v[uint16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -7526,10 +8056,6 @@ 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 { @@ -7540,32 +8066,26 @@ func (_ fastpathT) EncMapUint16Int8V(v map[uint16]int8, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeInt(int64(v[uint16(k2)])) } + ee.EncodeInt(int64(v[uint16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -7575,10 +8095,6 @@ 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 { @@ -7589,32 +8105,26 @@ func (_ fastpathT) EncMapUint16Int16V(v map[uint16]int16, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeInt(int64(v[uint16(k2)])) } + ee.EncodeInt(int64(v[uint16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -7624,10 +8134,6 @@ 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 { @@ -7638,32 +8144,26 @@ func (_ fastpathT) EncMapUint16Int32V(v map[uint16]int32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeInt(int64(v[uint16(k2)])) } + ee.EncodeInt(int64(v[uint16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -7673,10 +8173,6 @@ 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 { @@ -7687,32 +8183,26 @@ func (_ fastpathT) EncMapUint16Int64V(v map[uint16]int64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeInt(int64(v[uint16(k2)])) } + ee.EncodeInt(int64(v[uint16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -7722,10 +8212,6 @@ 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 { @@ -7736,32 +8222,26 @@ func (_ fastpathT) EncMapUint16Float32V(v map[uint16]float32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[uint16(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeFloat32(v[uint16(k2)]) } + ee.EncodeFloat32(v[uint16(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -7771,10 +8251,6 @@ 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 { @@ -7785,32 +8261,26 @@ func (_ fastpathT) EncMapUint16Float64V(v map[uint16]float64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[uint16(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeFloat64(v[uint16(k2)]) } + ee.EncodeFloat64(v[uint16(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -7820,10 +8290,6 @@ 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 { @@ -7834,32 +8300,26 @@ func (_ fastpathT) EncMapUint16BoolV(v map[uint16]bool, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint16(k2))) + } + ee.EncodeUint(uint64(uint16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[uint16(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint16(k2))) - ee.EncodeBool(v[uint16(k2)]) } + ee.EncodeBool(v[uint16(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -7869,10 +8329,6 @@ 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 { @@ -7883,32 +8339,26 @@ func (_ fastpathT) EncMapUint32IntfV(v map[uint32]interface{}, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[uint32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - e.encode(v[uint32(k2)]) } + e.encode(v[uint32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -7918,10 +8368,6 @@ 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 { @@ -7932,32 +8378,26 @@ func (_ fastpathT) EncMapUint32StringV(v map[uint32]string, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[uint32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeString(cUTF8, v[uint32(k2)]) } + ee.EncodeString(c_UTF8, v[uint32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -7967,10 +8407,6 @@ 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 { @@ -7981,32 +8417,26 @@ func (_ fastpathT) EncMapUint32UintV(v map[uint32]uint, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeUint(uint64(v[uint32(k2)])) } + ee.EncodeUint(uint64(v[uint32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -8016,10 +8446,6 @@ 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 { @@ -8030,32 +8456,26 @@ func (_ fastpathT) EncMapUint32Uint8V(v map[uint32]uint8, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeUint(uint64(v[uint32(k2)])) } + ee.EncodeUint(uint64(v[uint32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -8065,10 +8485,6 @@ 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 { @@ -8079,32 +8495,26 @@ func (_ fastpathT) EncMapUint32Uint16V(v map[uint32]uint16, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeUint(uint64(v[uint32(k2)])) } + ee.EncodeUint(uint64(v[uint32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -8114,10 +8524,6 @@ 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 { @@ -8128,32 +8534,26 @@ func (_ fastpathT) EncMapUint32Uint32V(v map[uint32]uint32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeUint(uint64(v[uint32(k2)])) } + ee.EncodeUint(uint64(v[uint32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -8163,10 +8563,6 @@ 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 { @@ -8177,32 +8573,26 @@ func (_ fastpathT) EncMapUint32Uint64V(v map[uint32]uint64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeUint(uint64(v[uint32(k2)])) } + ee.EncodeUint(uint64(v[uint32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -8212,10 +8602,6 @@ 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 { @@ -8226,32 +8612,26 @@ func (_ fastpathT) EncMapUint32UintptrV(v map[uint32]uintptr, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[uint32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - e.encode(v[uint32(k2)]) } + e.encode(v[uint32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -8261,10 +8641,6 @@ 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 { @@ -8275,32 +8651,26 @@ func (_ fastpathT) EncMapUint32IntV(v map[uint32]int, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeInt(int64(v[uint32(k2)])) } + ee.EncodeInt(int64(v[uint32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -8310,10 +8680,6 @@ 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 { @@ -8324,32 +8690,26 @@ func (_ fastpathT) EncMapUint32Int8V(v map[uint32]int8, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeInt(int64(v[uint32(k2)])) } + ee.EncodeInt(int64(v[uint32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -8359,10 +8719,6 @@ 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 { @@ -8373,32 +8729,26 @@ func (_ fastpathT) EncMapUint32Int16V(v map[uint32]int16, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeInt(int64(v[uint32(k2)])) } + ee.EncodeInt(int64(v[uint32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -8408,10 +8758,6 @@ 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 { @@ -8422,32 +8768,26 @@ func (_ fastpathT) EncMapUint32Int32V(v map[uint32]int32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeInt(int64(v[uint32(k2)])) } + ee.EncodeInt(int64(v[uint32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -8457,10 +8797,6 @@ 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 { @@ -8471,32 +8807,26 @@ func (_ fastpathT) EncMapUint32Int64V(v map[uint32]int64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeInt(int64(v[uint32(k2)])) } + ee.EncodeInt(int64(v[uint32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -8506,10 +8836,6 @@ 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 { @@ -8520,32 +8846,26 @@ func (_ fastpathT) EncMapUint32Float32V(v map[uint32]float32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[uint32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeFloat32(v[uint32(k2)]) } + ee.EncodeFloat32(v[uint32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -8555,10 +8875,6 @@ 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 { @@ -8569,32 +8885,26 @@ func (_ fastpathT) EncMapUint32Float64V(v map[uint32]float64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[uint32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeFloat64(v[uint32(k2)]) } + ee.EncodeFloat64(v[uint32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -8604,10 +8914,6 @@ 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 { @@ -8618,32 +8924,26 @@ func (_ fastpathT) EncMapUint32BoolV(v map[uint32]bool, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint32(k2))) + } + ee.EncodeUint(uint64(uint32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[uint32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint32(k2))) - ee.EncodeBool(v[uint32(k2)]) } + ee.EncodeBool(v[uint32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -8653,10 +8953,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -8667,32 +8963,26 @@ func (_ fastpathT) EncMapUint64IntfV(v map[uint64]interface{}, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[uint64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - e.encode(v[uint64(k2)]) } + e.encode(v[uint64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -8702,10 +8992,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -8716,32 +9002,26 @@ func (_ fastpathT) EncMapUint64StringV(v map[uint64]string, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[uint64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeString(cUTF8, v[uint64(k2)]) } + ee.EncodeString(c_UTF8, v[uint64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -8751,10 +9031,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -8765,32 +9041,26 @@ func (_ fastpathT) EncMapUint64UintV(v map[uint64]uint, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeUint(uint64(v[uint64(k2)])) } + ee.EncodeUint(uint64(v[uint64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -8800,10 +9070,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -8814,32 +9080,26 @@ func (_ fastpathT) EncMapUint64Uint8V(v map[uint64]uint8, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeUint(uint64(v[uint64(k2)])) } + ee.EncodeUint(uint64(v[uint64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -8849,10 +9109,6 @@ 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 { @@ -8863,32 +9119,26 @@ func (_ fastpathT) EncMapUint64Uint16V(v map[uint64]uint16, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeUint(uint64(v[uint64(k2)])) } + ee.EncodeUint(uint64(v[uint64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -8898,10 +9148,6 @@ 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 { @@ -8912,32 +9158,26 @@ func (_ fastpathT) EncMapUint64Uint32V(v map[uint64]uint32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeUint(uint64(v[uint64(k2)])) } + ee.EncodeUint(uint64(v[uint64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -8947,10 +9187,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -8961,32 +9197,26 @@ func (_ fastpathT) EncMapUint64Uint64V(v map[uint64]uint64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uint64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeUint(uint64(v[uint64(k2)])) } + ee.EncodeUint(uint64(v[uint64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -8996,10 +9226,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -9010,32 +9236,26 @@ func (_ fastpathT) EncMapUint64UintptrV(v map[uint64]uintptr, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[uint64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - e.encode(v[uint64(k2)]) } + e.encode(v[uint64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -9045,10 +9265,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -9059,32 +9275,26 @@ func (_ fastpathT) EncMapUint64IntV(v map[uint64]int, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeInt(int64(v[uint64(k2)])) } + ee.EncodeInt(int64(v[uint64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -9094,10 +9304,6 @@ 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 { @@ -9108,32 +9314,26 @@ func (_ fastpathT) EncMapUint64Int8V(v map[uint64]int8, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeInt(int64(v[uint64(k2)])) } + ee.EncodeInt(int64(v[uint64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -9143,10 +9343,6 @@ 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 { @@ -9157,32 +9353,26 @@ func (_ fastpathT) EncMapUint64Int16V(v map[uint64]int16, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeInt(int64(v[uint64(k2)])) } + ee.EncodeInt(int64(v[uint64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -9192,10 +9382,6 @@ 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 { @@ -9206,32 +9392,26 @@ func (_ fastpathT) EncMapUint64Int32V(v map[uint64]int32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeInt(int64(v[uint64(k2)])) } + ee.EncodeInt(int64(v[uint64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -9241,10 +9421,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -9255,32 +9431,26 @@ func (_ fastpathT) EncMapUint64Int64V(v map[uint64]int64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uint64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeInt(int64(v[uint64(k2)])) } + ee.EncodeInt(int64(v[uint64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -9290,10 +9460,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -9304,32 +9470,26 @@ func (_ fastpathT) EncMapUint64Float32V(v map[uint64]float32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[uint64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeFloat32(v[uint64(k2)]) } + ee.EncodeFloat32(v[uint64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -9339,10 +9499,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -9353,32 +9509,26 @@ func (_ fastpathT) EncMapUint64Float64V(v map[uint64]float64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[uint64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeFloat64(v[uint64(k2)]) } + ee.EncodeFloat64(v[uint64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -9388,10 +9538,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -9402,32 +9548,26 @@ func (_ fastpathT) EncMapUint64BoolV(v map[uint64]bool, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(uint64(k2))) + } + ee.EncodeUint(uint64(uint64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[uint64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeUint(uint64(uint64(k2))) - ee.EncodeBool(v[uint64(k2)]) } + ee.EncodeBool(v[uint64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeUint(uint64(k2)) + } + ee.EncodeUint(uint64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeUint(uint64(k2)) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -9437,10 +9577,6 @@ 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 { @@ -9451,32 +9587,26 @@ func (_ fastpathT) EncMapUintptrIntfV(v map[uintptr]interface{}, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v[uintptr(k2)]) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - e.encode(v[uintptr(k2)]) } + e.encode(v[uintptr(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - e.encode(k2) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -9486,10 +9616,6 @@ 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 { @@ -9500,32 +9626,26 @@ func (_ fastpathT) EncMapUintptrStringV(v map[uintptr]string, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[uintptr(k2)]) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeString(cUTF8, v[uintptr(k2)]) } + ee.EncodeString(c_UTF8, v[uintptr(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -9535,10 +9655,6 @@ 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 { @@ -9549,32 +9665,26 @@ func (_ fastpathT) EncMapUintptrUintV(v map[uintptr]uint, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uintptr(k2)])) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeUint(uint64(v[uintptr(k2)])) } + ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -9584,10 +9694,6 @@ 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 { @@ -9598,32 +9704,26 @@ func (_ fastpathT) EncMapUintptrUint8V(v map[uintptr]uint8, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uintptr(k2)])) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeUint(uint64(v[uintptr(k2)])) } + ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -9633,10 +9733,6 @@ 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 { @@ -9647,32 +9743,26 @@ func (_ fastpathT) EncMapUintptrUint16V(v map[uintptr]uint16, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uintptr(k2)])) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeUint(uint64(v[uintptr(k2)])) } + ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -9682,10 +9772,6 @@ 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 { @@ -9696,32 +9782,26 @@ func (_ fastpathT) EncMapUintptrUint32V(v map[uintptr]uint32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uintptr(k2)])) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeUint(uint64(v[uintptr(k2)])) } + ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -9731,10 +9811,6 @@ 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 { @@ -9745,32 +9821,26 @@ func (_ fastpathT) EncMapUintptrUint64V(v map[uintptr]uint64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[uintptr(k2)])) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeUint(uint64(v[uintptr(k2)])) } + ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -9780,10 +9850,6 @@ 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 { @@ -9794,32 +9860,26 @@ func (_ fastpathT) EncMapUintptrUintptrV(v map[uintptr]uintptr, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v[uintptr(k2)]) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - e.encode(v[uintptr(k2)]) } + e.encode(v[uintptr(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - e.encode(k2) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -9829,10 +9889,6 @@ 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 { @@ -9843,32 +9899,26 @@ func (_ fastpathT) EncMapUintptrIntV(v map[uintptr]int, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uintptr(k2)])) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeInt(int64(v[uintptr(k2)])) } + ee.EncodeInt(int64(v[uintptr(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -9878,10 +9928,6 @@ 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 { @@ -9892,32 +9938,26 @@ func (_ fastpathT) EncMapUintptrInt8V(v map[uintptr]int8, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uintptr(k2)])) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeInt(int64(v[uintptr(k2)])) } + ee.EncodeInt(int64(v[uintptr(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -9927,10 +9967,6 @@ 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 { @@ -9941,32 +9977,26 @@ func (_ fastpathT) EncMapUintptrInt16V(v map[uintptr]int16, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uintptr(k2)])) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeInt(int64(v[uintptr(k2)])) } + ee.EncodeInt(int64(v[uintptr(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -9976,10 +10006,6 @@ 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 { @@ -9990,32 +10016,26 @@ func (_ fastpathT) EncMapUintptrInt32V(v map[uintptr]int32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uintptr(k2)])) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeInt(int64(v[uintptr(k2)])) } + ee.EncodeInt(int64(v[uintptr(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -10025,10 +10045,6 @@ 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 { @@ -10039,32 +10055,26 @@ func (_ fastpathT) EncMapUintptrInt64V(v map[uintptr]int64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[uintptr(k2)])) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeInt(int64(v[uintptr(k2)])) } + ee.EncodeInt(int64(v[uintptr(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -10074,10 +10084,6 @@ 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 { @@ -10088,32 +10094,26 @@ func (_ fastpathT) EncMapUintptrFloat32V(v map[uintptr]float32, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[uintptr(k2)]) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeFloat32(v[uintptr(k2)]) } + ee.EncodeFloat32(v[uintptr(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -10123,10 +10123,6 @@ 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 { @@ -10137,32 +10133,26 @@ func (_ fastpathT) EncMapUintptrFloat64V(v map[uintptr]float64, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[uintptr(k2)]) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeFloat64(v[uintptr(k2)]) } + ee.EncodeFloat64(v[uintptr(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -10172,10 +10162,6 @@ 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 { @@ -10186,32 +10172,26 @@ func (_ fastpathT) EncMapUintptrBoolV(v map[uintptr]bool, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - e.encode(uintptr(k2)) + } + e.encode(uintptr(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[uintptr(k2)]) - } - } else { - for _, k2 := range v2 { - e.encode(uintptr(k2)) - ee.EncodeBool(v[uintptr(k2)]) } + ee.EncodeBool(v[uintptr(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - e.encode(k2) + } + e.encode(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - e.encode(k2) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -10221,10 +10201,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -10235,32 +10211,26 @@ func (_ fastpathT) EncMapIntIntfV(v map[int]interface{}, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[int(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - e.encode(v[int(k2)]) } + e.encode(v[int(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -10270,10 +10240,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -10284,32 +10250,26 @@ func (_ fastpathT) EncMapIntStringV(v map[int]string, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[int(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeString(cUTF8, v[int(k2)]) } + ee.EncodeString(c_UTF8, v[int(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -10319,10 +10279,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -10333,32 +10289,26 @@ func (_ fastpathT) EncMapIntUintV(v map[int]uint, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeUint(uint64(v[int(k2)])) } + ee.EncodeUint(uint64(v[int(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -10368,10 +10318,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -10382,32 +10328,26 @@ func (_ fastpathT) EncMapIntUint8V(v map[int]uint8, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeUint(uint64(v[int(k2)])) } + ee.EncodeUint(uint64(v[int(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -10417,10 +10357,6 @@ 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 { @@ -10431,32 +10367,26 @@ func (_ fastpathT) EncMapIntUint16V(v map[int]uint16, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeUint(uint64(v[int(k2)])) } + ee.EncodeUint(uint64(v[int(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -10466,10 +10396,6 @@ 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 { @@ -10480,32 +10406,26 @@ func (_ fastpathT) EncMapIntUint32V(v map[int]uint32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeUint(uint64(v[int(k2)])) } + ee.EncodeUint(uint64(v[int(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -10515,10 +10435,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -10529,32 +10445,26 @@ func (_ fastpathT) EncMapIntUint64V(v map[int]uint64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeUint(uint64(v[int(k2)])) } + ee.EncodeUint(uint64(v[int(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -10564,10 +10474,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -10578,32 +10484,26 @@ func (_ fastpathT) EncMapIntUintptrV(v map[int]uintptr, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[int(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - e.encode(v[int(k2)]) } + e.encode(v[int(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -10613,10 +10513,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -10627,32 +10523,26 @@ func (_ fastpathT) EncMapIntIntV(v map[int]int, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeInt(int64(v[int(k2)])) } + ee.EncodeInt(int64(v[int(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -10662,10 +10552,6 @@ 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 { @@ -10676,32 +10562,26 @@ func (_ fastpathT) EncMapIntInt8V(v map[int]int8, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeInt(int64(v[int(k2)])) } + ee.EncodeInt(int64(v[int(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -10711,10 +10591,6 @@ 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 { @@ -10725,32 +10601,26 @@ func (_ fastpathT) EncMapIntInt16V(v map[int]int16, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeInt(int64(v[int(k2)])) } + ee.EncodeInt(int64(v[int(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -10760,10 +10630,6 @@ 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 { @@ -10774,32 +10640,26 @@ func (_ fastpathT) EncMapIntInt32V(v map[int]int32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeInt(int64(v[int(k2)])) } + ee.EncodeInt(int64(v[int(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -10809,10 +10669,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -10823,32 +10679,26 @@ func (_ fastpathT) EncMapIntInt64V(v map[int]int64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeInt(int64(v[int(k2)])) } + ee.EncodeInt(int64(v[int(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -10858,10 +10708,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -10872,32 +10718,26 @@ func (_ fastpathT) EncMapIntFloat32V(v map[int]float32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[int(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeFloat32(v[int(k2)]) } + ee.EncodeFloat32(v[int(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -10907,10 +10747,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -10921,32 +10757,26 @@ func (_ fastpathT) EncMapIntFloat64V(v map[int]float64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[int(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeFloat64(v[int(k2)]) } + ee.EncodeFloat64(v[int(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -10956,10 +10786,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -10970,32 +10796,26 @@ func (_ fastpathT) EncMapIntBoolV(v map[int]bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int(k2))) + } + ee.EncodeInt(int64(int(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[int(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int(k2))) - ee.EncodeBool(v[int(k2)]) } + ee.EncodeBool(v[int(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -11005,10 +10825,6 @@ 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 { @@ -11019,32 +10835,26 @@ func (_ fastpathT) EncMapInt8IntfV(v map[int8]interface{}, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[int8(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - e.encode(v[int8(k2)]) } + e.encode(v[int8(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -11054,10 +10864,6 @@ 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 { @@ -11068,32 +10874,26 @@ func (_ fastpathT) EncMapInt8StringV(v map[int8]string, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[int8(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeString(cUTF8, v[int8(k2)]) } + ee.EncodeString(c_UTF8, v[int8(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -11103,10 +10903,6 @@ 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 { @@ -11117,32 +10913,26 @@ func (_ fastpathT) EncMapInt8UintV(v map[int8]uint, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeUint(uint64(v[int8(k2)])) } + ee.EncodeUint(uint64(v[int8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -11152,10 +10942,6 @@ 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 { @@ -11166,32 +10952,26 @@ func (_ fastpathT) EncMapInt8Uint8V(v map[int8]uint8, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeUint(uint64(v[int8(k2)])) } + ee.EncodeUint(uint64(v[int8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -11201,10 +10981,6 @@ 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 { @@ -11215,32 +10991,26 @@ func (_ fastpathT) EncMapInt8Uint16V(v map[int8]uint16, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeUint(uint64(v[int8(k2)])) } + ee.EncodeUint(uint64(v[int8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -11250,10 +11020,6 @@ 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 { @@ -11264,32 +11030,26 @@ func (_ fastpathT) EncMapInt8Uint32V(v map[int8]uint32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeUint(uint64(v[int8(k2)])) } + ee.EncodeUint(uint64(v[int8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -11299,10 +11059,6 @@ 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 { @@ -11313,32 +11069,26 @@ func (_ fastpathT) EncMapInt8Uint64V(v map[int8]uint64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeUint(uint64(v[int8(k2)])) } + ee.EncodeUint(uint64(v[int8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -11348,10 +11098,6 @@ 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 { @@ -11362,32 +11108,26 @@ func (_ fastpathT) EncMapInt8UintptrV(v map[int8]uintptr, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[int8(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - e.encode(v[int8(k2)]) } + e.encode(v[int8(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -11397,10 +11137,6 @@ 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 { @@ -11411,32 +11147,26 @@ func (_ fastpathT) EncMapInt8IntV(v map[int8]int, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeInt(int64(v[int8(k2)])) } + ee.EncodeInt(int64(v[int8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -11446,10 +11176,6 @@ 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 { @@ -11460,32 +11186,26 @@ func (_ fastpathT) EncMapInt8Int8V(v map[int8]int8, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeInt(int64(v[int8(k2)])) } + ee.EncodeInt(int64(v[int8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -11495,10 +11215,6 @@ 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 { @@ -11509,32 +11225,26 @@ func (_ fastpathT) EncMapInt8Int16V(v map[int8]int16, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeInt(int64(v[int8(k2)])) } + ee.EncodeInt(int64(v[int8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -11544,10 +11254,6 @@ 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 { @@ -11558,32 +11264,26 @@ func (_ fastpathT) EncMapInt8Int32V(v map[int8]int32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeInt(int64(v[int8(k2)])) } + ee.EncodeInt(int64(v[int8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -11593,10 +11293,6 @@ 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 { @@ -11607,32 +11303,26 @@ func (_ fastpathT) EncMapInt8Int64V(v map[int8]int64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int8(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeInt(int64(v[int8(k2)])) } + ee.EncodeInt(int64(v[int8(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -11642,10 +11332,6 @@ 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 { @@ -11656,32 +11342,26 @@ func (_ fastpathT) EncMapInt8Float32V(v map[int8]float32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[int8(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeFloat32(v[int8(k2)]) } + ee.EncodeFloat32(v[int8(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -11691,10 +11371,6 @@ 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 { @@ -11705,32 +11381,26 @@ func (_ fastpathT) EncMapInt8Float64V(v map[int8]float64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[int8(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeFloat64(v[int8(k2)]) } + ee.EncodeFloat64(v[int8(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -11740,10 +11410,6 @@ 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 { @@ -11754,32 +11420,26 @@ func (_ fastpathT) EncMapInt8BoolV(v map[int8]bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int8(k2))) + } + ee.EncodeInt(int64(int8(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[int8(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int8(k2))) - ee.EncodeBool(v[int8(k2)]) } + ee.EncodeBool(v[int8(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -11789,10 +11449,6 @@ 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 { @@ -11803,32 +11459,26 @@ func (_ fastpathT) EncMapInt16IntfV(v map[int16]interface{}, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[int16(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - e.encode(v[int16(k2)]) } + e.encode(v[int16(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -11838,10 +11488,6 @@ 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 { @@ -11852,32 +11498,26 @@ func (_ fastpathT) EncMapInt16StringV(v map[int16]string, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[int16(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeString(cUTF8, v[int16(k2)]) } + ee.EncodeString(c_UTF8, v[int16(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -11887,10 +11527,6 @@ 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 { @@ -11901,32 +11537,26 @@ func (_ fastpathT) EncMapInt16UintV(v map[int16]uint, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeUint(uint64(v[int16(k2)])) } + ee.EncodeUint(uint64(v[int16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -11936,10 +11566,6 @@ 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 { @@ -11950,32 +11576,26 @@ func (_ fastpathT) EncMapInt16Uint8V(v map[int16]uint8, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeUint(uint64(v[int16(k2)])) } + ee.EncodeUint(uint64(v[int16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -11985,10 +11605,6 @@ 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 { @@ -11999,32 +11615,26 @@ func (_ fastpathT) EncMapInt16Uint16V(v map[int16]uint16, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeUint(uint64(v[int16(k2)])) } + ee.EncodeUint(uint64(v[int16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -12034,10 +11644,6 @@ 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 { @@ -12048,32 +11654,26 @@ func (_ fastpathT) EncMapInt16Uint32V(v map[int16]uint32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeUint(uint64(v[int16(k2)])) } + ee.EncodeUint(uint64(v[int16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -12083,10 +11683,6 @@ 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 { @@ -12097,32 +11693,26 @@ func (_ fastpathT) EncMapInt16Uint64V(v map[int16]uint64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeUint(uint64(v[int16(k2)])) } + ee.EncodeUint(uint64(v[int16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -12132,10 +11722,6 @@ 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 { @@ -12146,32 +11732,26 @@ func (_ fastpathT) EncMapInt16UintptrV(v map[int16]uintptr, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[int16(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - e.encode(v[int16(k2)]) } + e.encode(v[int16(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -12181,10 +11761,6 @@ 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 { @@ -12195,32 +11771,26 @@ func (_ fastpathT) EncMapInt16IntV(v map[int16]int, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeInt(int64(v[int16(k2)])) } + ee.EncodeInt(int64(v[int16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -12230,10 +11800,6 @@ 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 { @@ -12244,32 +11810,26 @@ func (_ fastpathT) EncMapInt16Int8V(v map[int16]int8, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeInt(int64(v[int16(k2)])) } + ee.EncodeInt(int64(v[int16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -12279,10 +11839,6 @@ 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 { @@ -12293,32 +11849,26 @@ func (_ fastpathT) EncMapInt16Int16V(v map[int16]int16, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeInt(int64(v[int16(k2)])) } + ee.EncodeInt(int64(v[int16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -12328,10 +11878,6 @@ 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 { @@ -12342,32 +11888,26 @@ func (_ fastpathT) EncMapInt16Int32V(v map[int16]int32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeInt(int64(v[int16(k2)])) } + ee.EncodeInt(int64(v[int16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -12377,10 +11917,6 @@ 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 { @@ -12391,32 +11927,26 @@ func (_ fastpathT) EncMapInt16Int64V(v map[int16]int64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int16(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeInt(int64(v[int16(k2)])) } + ee.EncodeInt(int64(v[int16(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -12426,10 +11956,6 @@ 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 { @@ -12440,32 +11966,26 @@ func (_ fastpathT) EncMapInt16Float32V(v map[int16]float32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[int16(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeFloat32(v[int16(k2)]) } + ee.EncodeFloat32(v[int16(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -12475,10 +11995,6 @@ 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 { @@ -12489,32 +12005,26 @@ func (_ fastpathT) EncMapInt16Float64V(v map[int16]float64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[int16(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeFloat64(v[int16(k2)]) } + ee.EncodeFloat64(v[int16(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -12524,10 +12034,6 @@ 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 { @@ -12538,32 +12044,26 @@ func (_ fastpathT) EncMapInt16BoolV(v map[int16]bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int16(k2))) + } + ee.EncodeInt(int64(int16(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[int16(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int16(k2))) - ee.EncodeBool(v[int16(k2)]) } + ee.EncodeBool(v[int16(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -12573,10 +12073,6 @@ 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 { @@ -12587,32 +12083,26 @@ func (_ fastpathT) EncMapInt32IntfV(v map[int32]interface{}, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[int32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - e.encode(v[int32(k2)]) } + e.encode(v[int32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -12622,10 +12112,6 @@ 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 { @@ -12636,32 +12122,26 @@ func (_ fastpathT) EncMapInt32StringV(v map[int32]string, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[int32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeString(cUTF8, v[int32(k2)]) } + ee.EncodeString(c_UTF8, v[int32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -12671,10 +12151,6 @@ 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 { @@ -12685,32 +12161,26 @@ func (_ fastpathT) EncMapInt32UintV(v map[int32]uint, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeUint(uint64(v[int32(k2)])) } + ee.EncodeUint(uint64(v[int32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -12720,10 +12190,6 @@ 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 { @@ -12734,32 +12200,26 @@ func (_ fastpathT) EncMapInt32Uint8V(v map[int32]uint8, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeUint(uint64(v[int32(k2)])) } + ee.EncodeUint(uint64(v[int32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -12769,10 +12229,6 @@ 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 { @@ -12783,32 +12239,26 @@ func (_ fastpathT) EncMapInt32Uint16V(v map[int32]uint16, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeUint(uint64(v[int32(k2)])) } + ee.EncodeUint(uint64(v[int32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -12818,10 +12268,6 @@ 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 { @@ -12832,32 +12278,26 @@ func (_ fastpathT) EncMapInt32Uint32V(v map[int32]uint32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeUint(uint64(v[int32(k2)])) } + ee.EncodeUint(uint64(v[int32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -12867,10 +12307,6 @@ 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 { @@ -12881,32 +12317,26 @@ func (_ fastpathT) EncMapInt32Uint64V(v map[int32]uint64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeUint(uint64(v[int32(k2)])) } + ee.EncodeUint(uint64(v[int32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -12916,10 +12346,6 @@ 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 { @@ -12930,32 +12356,26 @@ func (_ fastpathT) EncMapInt32UintptrV(v map[int32]uintptr, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[int32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - e.encode(v[int32(k2)]) } + e.encode(v[int32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -12965,10 +12385,6 @@ 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 { @@ -12979,32 +12395,26 @@ func (_ fastpathT) EncMapInt32IntV(v map[int32]int, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeInt(int64(v[int32(k2)])) } + ee.EncodeInt(int64(v[int32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -13014,10 +12424,6 @@ 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 { @@ -13028,32 +12434,26 @@ func (_ fastpathT) EncMapInt32Int8V(v map[int32]int8, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeInt(int64(v[int32(k2)])) } + ee.EncodeInt(int64(v[int32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -13063,10 +12463,6 @@ 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 { @@ -13077,32 +12473,26 @@ func (_ fastpathT) EncMapInt32Int16V(v map[int32]int16, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeInt(int64(v[int32(k2)])) } + ee.EncodeInt(int64(v[int32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -13112,10 +12502,6 @@ 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 { @@ -13126,32 +12512,26 @@ func (_ fastpathT) EncMapInt32Int32V(v map[int32]int32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeInt(int64(v[int32(k2)])) } + ee.EncodeInt(int64(v[int32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -13161,10 +12541,6 @@ 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 { @@ -13175,32 +12551,26 @@ func (_ fastpathT) EncMapInt32Int64V(v map[int32]int64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int32(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeInt(int64(v[int32(k2)])) } + ee.EncodeInt(int64(v[int32(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -13210,10 +12580,6 @@ 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 { @@ -13224,32 +12590,26 @@ func (_ fastpathT) EncMapInt32Float32V(v map[int32]float32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[int32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeFloat32(v[int32(k2)]) } + ee.EncodeFloat32(v[int32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -13259,10 +12619,6 @@ 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 { @@ -13273,32 +12629,26 @@ func (_ fastpathT) EncMapInt32Float64V(v map[int32]float64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[int32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeFloat64(v[int32(k2)]) } + ee.EncodeFloat64(v[int32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -13308,10 +12658,6 @@ 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 { @@ -13322,32 +12668,26 @@ func (_ fastpathT) EncMapInt32BoolV(v map[int32]bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int32(k2))) + } + ee.EncodeInt(int64(int32(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[int32(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int32(k2))) - ee.EncodeBool(v[int32(k2)]) } + ee.EncodeBool(v[int32(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -13357,10 +12697,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -13371,32 +12707,26 @@ func (_ fastpathT) EncMapInt64IntfV(v map[int64]interface{}, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[int64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - e.encode(v[int64(k2)]) } + e.encode(v[int64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -13406,10 +12736,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -13420,32 +12746,26 @@ func (_ fastpathT) EncMapInt64StringV(v map[int64]string, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[int64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeString(cUTF8, v[int64(k2)]) } + ee.EncodeString(c_UTF8, v[int64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -13455,10 +12775,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -13469,32 +12785,26 @@ func (_ fastpathT) EncMapInt64UintV(v map[int64]uint, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeUint(uint64(v[int64(k2)])) } + ee.EncodeUint(uint64(v[int64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -13504,10 +12814,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -13518,32 +12824,26 @@ func (_ fastpathT) EncMapInt64Uint8V(v map[int64]uint8, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeUint(uint64(v[int64(k2)])) } + ee.EncodeUint(uint64(v[int64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -13553,10 +12853,6 @@ 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 { @@ -13567,32 +12863,26 @@ func (_ fastpathT) EncMapInt64Uint16V(v map[int64]uint16, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeUint(uint64(v[int64(k2)])) } + ee.EncodeUint(uint64(v[int64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -13602,10 +12892,6 @@ 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 { @@ -13616,32 +12902,26 @@ func (_ fastpathT) EncMapInt64Uint32V(v map[int64]uint32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeUint(uint64(v[int64(k2)])) } + ee.EncodeUint(uint64(v[int64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -13651,10 +12931,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -13665,32 +12941,26 @@ func (_ fastpathT) EncMapInt64Uint64V(v map[int64]uint64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[int64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeUint(uint64(v[int64(k2)])) } + ee.EncodeUint(uint64(v[int64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -13700,10 +12970,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -13714,32 +12980,26 @@ func (_ fastpathT) EncMapInt64UintptrV(v map[int64]uintptr, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - e.encode(v[int64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - e.encode(v[int64(k2)]) } + e.encode(v[int64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -13749,10 +13009,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -13763,32 +13019,26 @@ func (_ fastpathT) EncMapInt64IntV(v map[int64]int, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeInt(int64(v[int64(k2)])) } + ee.EncodeInt(int64(v[int64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -13798,10 +13048,6 @@ 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 { @@ -13812,32 +13058,26 @@ func (_ fastpathT) EncMapInt64Int8V(v map[int64]int8, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeInt(int64(v[int64(k2)])) } + ee.EncodeInt(int64(v[int64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -13847,10 +13087,6 @@ 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 { @@ -13861,32 +13097,26 @@ func (_ fastpathT) EncMapInt64Int16V(v map[int64]int16, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeInt(int64(v[int64(k2)])) } + ee.EncodeInt(int64(v[int64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -13896,10 +13126,6 @@ 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 { @@ -13910,32 +13136,26 @@ func (_ fastpathT) EncMapInt64Int32V(v map[int64]int32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeInt(int64(v[int64(k2)])) } + ee.EncodeInt(int64(v[int64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -13945,10 +13165,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -13959,32 +13175,26 @@ func (_ fastpathT) EncMapInt64Int64V(v map[int64]int64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[int64(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeInt(int64(v[int64(k2)])) } + ee.EncodeInt(int64(v[int64(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -13994,10 +13204,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -14008,32 +13214,26 @@ func (_ fastpathT) EncMapInt64Float32V(v map[int64]float32, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[int64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeFloat32(v[int64(k2)]) } + ee.EncodeFloat32(v[int64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -14043,10 +13243,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -14057,32 +13253,26 @@ func (_ fastpathT) EncMapInt64Float64V(v map[int64]float64, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[int64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeFloat64(v[int64(k2)]) } + ee.EncodeFloat64(v[int64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -14092,10 +13282,6 @@ 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) { - if v == nil { - e.e.EncodeNil() - return - } ee, esep := e.e, e.hh.hasElemSeparators() ee.WriteMapStart(len(v)) if e.h.Canonical { @@ -14106,32 +13292,26 @@ func (_ fastpathT) EncMapInt64BoolV(v map[int64]bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(int64(k2))) + } + ee.EncodeInt(int64(int64(k2))) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[int64(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeInt(int64(int64(k2))) - ee.EncodeBool(v[int64(k2)]) } + ee.EncodeBool(v[int64(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeInt(int64(k2)) + } + ee.EncodeInt(int64(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeInt(int64(k2)) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -14141,10 +13321,6 @@ 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 { @@ -14155,32 +13331,26 @@ func (_ fastpathT) EncMapBoolIntfV(v map[bool]interface{}, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v[bool(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - e.encode(v[bool(k2)]) } + e.encode(v[bool(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -14190,10 +13360,6 @@ 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 { @@ -14204,32 +13370,26 @@ func (_ fastpathT) EncMapBoolStringV(v map[bool]string, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v[bool(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeString(cUTF8, v[bool(k2)]) } + ee.EncodeString(c_UTF8, v[bool(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeString(cUTF8, v2) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeString(cUTF8, v2) } + ee.EncodeString(c_UTF8, v2) } } ee.WriteMapEnd() @@ -14239,10 +13399,6 @@ 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 { @@ -14253,32 +13409,26 @@ func (_ fastpathT) EncMapBoolUintV(v map[bool]uint, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[bool(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeUint(uint64(v[bool(k2)])) } + ee.EncodeUint(uint64(v[bool(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -14288,10 +13438,6 @@ 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 { @@ -14302,32 +13448,26 @@ func (_ fastpathT) EncMapBoolUint8V(v map[bool]uint8, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[bool(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeUint(uint64(v[bool(k2)])) } + ee.EncodeUint(uint64(v[bool(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -14337,10 +13477,6 @@ 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 { @@ -14351,32 +13487,26 @@ func (_ fastpathT) EncMapBoolUint16V(v map[bool]uint16, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[bool(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeUint(uint64(v[bool(k2)])) } + ee.EncodeUint(uint64(v[bool(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -14386,10 +13516,6 @@ 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 { @@ -14400,32 +13526,26 @@ func (_ fastpathT) EncMapBoolUint32V(v map[bool]uint32, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[bool(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeUint(uint64(v[bool(k2)])) } + ee.EncodeUint(uint64(v[bool(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -14435,10 +13555,6 @@ 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 { @@ -14449,32 +13565,26 @@ func (_ fastpathT) EncMapBoolUint64V(v map[bool]uint64, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v[bool(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeUint(uint64(v[bool(k2)])) } + ee.EncodeUint(uint64(v[bool(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeUint(uint64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeUint(uint64(v2)) } + ee.EncodeUint(uint64(v2)) } } ee.WriteMapEnd() @@ -14484,10 +13594,6 @@ 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 { @@ -14498,32 +13604,26 @@ func (_ fastpathT) EncMapBoolUintptrV(v map[bool]uintptr, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - e.encode(v[bool(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - e.encode(v[bool(k2)]) } + e.encode(v[bool(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - e.encode(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - e.encode(v2) } + e.encode(v2) } } ee.WriteMapEnd() @@ -14533,10 +13633,6 @@ 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 { @@ -14547,32 +13643,26 @@ func (_ fastpathT) EncMapBoolIntV(v map[bool]int, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[bool(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeInt(int64(v[bool(k2)])) } + ee.EncodeInt(int64(v[bool(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -14582,10 +13672,6 @@ 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 { @@ -14596,32 +13682,26 @@ func (_ fastpathT) EncMapBoolInt8V(v map[bool]int8, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[bool(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeInt(int64(v[bool(k2)])) } + ee.EncodeInt(int64(v[bool(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -14631,10 +13711,6 @@ 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 { @@ -14645,32 +13721,26 @@ func (_ fastpathT) EncMapBoolInt16V(v map[bool]int16, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[bool(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeInt(int64(v[bool(k2)])) } + ee.EncodeInt(int64(v[bool(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -14680,10 +13750,6 @@ 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 { @@ -14694,32 +13760,26 @@ func (_ fastpathT) EncMapBoolInt32V(v map[bool]int32, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[bool(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeInt(int64(v[bool(k2)])) } + ee.EncodeInt(int64(v[bool(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -14729,10 +13789,6 @@ 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 { @@ -14743,32 +13799,26 @@ func (_ fastpathT) EncMapBoolInt64V(v map[bool]int64, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v[bool(k2)])) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeInt(int64(v[bool(k2)])) } + ee.EncodeInt(int64(v[bool(k2)])) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeInt(int64(v2)) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeInt(int64(v2)) } + ee.EncodeInt(int64(v2)) } } ee.WriteMapEnd() @@ -14778,10 +13828,6 @@ 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 { @@ -14792,32 +13838,26 @@ func (_ fastpathT) EncMapBoolFloat32V(v map[bool]float32, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v[bool(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeFloat32(v[bool(k2)]) } + ee.EncodeFloat32(v[bool(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat32(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeFloat32(v2) } + ee.EncodeFloat32(v2) } } ee.WriteMapEnd() @@ -14827,10 +13867,6 @@ 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 { @@ -14841,32 +13877,26 @@ func (_ fastpathT) EncMapBoolFloat64V(v map[bool]float64, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v[bool(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeFloat64(v[bool(k2)]) } + ee.EncodeFloat64(v[bool(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeFloat64(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeFloat64(v2) } + ee.EncodeFloat64(v2) } } ee.WriteMapEnd() @@ -14876,10 +13906,6 @@ 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 { @@ -14890,32 +13916,26 @@ func (_ fastpathT) EncMapBoolBoolV(v map[bool]bool, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - if esep { - for _, k2 := range v2 { + for _, k2 := range v2 { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(bool(k2)) + } + ee.EncodeBool(bool(k2)) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v[bool(k2)]) - } - } else { - for _, k2 := range v2 { - ee.EncodeBool(bool(k2)) - ee.EncodeBool(v[bool(k2)]) } + ee.EncodeBool(v[bool(k2)]) } } else { - if esep { - for k2, v2 := range v { + for k2, v2 := range v { + if esep { ee.WriteMapElemKey() - ee.EncodeBool(k2) + } + ee.EncodeBool(k2) + if esep { ee.WriteMapElemValue() - ee.EncodeBool(v2) - } - } else { - for k2, v2 := range v { - ee.EncodeBool(k2) - ee.EncodeBool(v2) } + ee.EncodeBool(v2) } } ee.WriteMapEnd() @@ -14925,2795 +13945,2730 @@ func (_ fastpathT) EncMapBoolBoolV(v map[bool]bool, e *Encoder) { // -- -- fast path type switch func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { - var changed bool switch v := iv.(type) { case []interface{}: - var v2 []interface{} - v2, changed = fastpathTV.DecSliceIntfV(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceIntfV(v, false, d) case *[]interface{}: - var v2 []interface{} - v2, changed = fastpathTV.DecSliceIntfV(*v, true, d) - if changed { - *v = v2 - } - case []string: - var v2 []string - v2, changed = fastpathTV.DecSliceStringV(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]string: - var v2 []string - v2, changed = fastpathTV.DecSliceStringV(*v, true, d) - if changed { - *v = v2 - } - case []float32: - var v2 []float32 - v2, changed = fastpathTV.DecSliceFloat32V(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]float32: - var v2 []float32 - v2, changed = fastpathTV.DecSliceFloat32V(*v, true, d) - if changed { - *v = v2 - } - case []float64: - var v2 []float64 - v2, changed = fastpathTV.DecSliceFloat64V(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]float64: - var v2 []float64 - v2, changed = fastpathTV.DecSliceFloat64V(*v, true, d) - if changed { - *v = v2 - } - case []uint: - var v2 []uint - v2, changed = fastpathTV.DecSliceUintV(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]uint: - var v2 []uint - v2, changed = fastpathTV.DecSliceUintV(*v, true, d) - if changed { - *v = v2 - } - case []uint16: - var v2 []uint16 - v2, changed = fastpathTV.DecSliceUint16V(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]uint16: - var v2 []uint16 - v2, changed = fastpathTV.DecSliceUint16V(*v, true, d) - if changed { - *v = v2 - } - case []uint32: - var v2 []uint32 - v2, changed = fastpathTV.DecSliceUint32V(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]uint32: - var v2 []uint32 - v2, changed = fastpathTV.DecSliceUint32V(*v, true, d) - if changed { - *v = v2 - } - case []uint64: - var v2 []uint64 - v2, changed = fastpathTV.DecSliceUint64V(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]uint64: - var v2 []uint64 - v2, changed = fastpathTV.DecSliceUint64V(*v, true, d) - if changed { - *v = v2 - } - case []uintptr: - var v2 []uintptr - v2, changed = fastpathTV.DecSliceUintptrV(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]uintptr: - var v2 []uintptr - v2, changed = fastpathTV.DecSliceUintptrV(*v, true, d) - if changed { - *v = v2 - } - case []int: - var v2 []int - v2, changed = fastpathTV.DecSliceIntV(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]int: - var v2 []int - v2, changed = fastpathTV.DecSliceIntV(*v, true, d) - if changed { - *v = v2 - } - case []int8: - var v2 []int8 - v2, changed = fastpathTV.DecSliceInt8V(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]int8: - var v2 []int8 - v2, changed = fastpathTV.DecSliceInt8V(*v, true, d) - if changed { - *v = v2 - } - case []int16: - var v2 []int16 - v2, changed = fastpathTV.DecSliceInt16V(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]int16: - var v2 []int16 - v2, changed = fastpathTV.DecSliceInt16V(*v, true, d) - if changed { - *v = v2 - } - case []int32: - var v2 []int32 - v2, changed = fastpathTV.DecSliceInt32V(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]int32: - var v2 []int32 - v2, changed = fastpathTV.DecSliceInt32V(*v, true, d) - if changed { - *v = v2 - } - case []int64: - var v2 []int64 - v2, changed = fastpathTV.DecSliceInt64V(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]int64: - var v2 []int64 - v2, changed = fastpathTV.DecSliceInt64V(*v, true, d) - if changed { - *v = v2 - } - case []bool: - var v2 []bool - v2, changed = fastpathTV.DecSliceBoolV(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } - case *[]bool: - var v2 []bool - v2, changed = fastpathTV.DecSliceBoolV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecSliceIntfV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfIntfV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfStringV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfUintV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfUint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfUint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfUint32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfUint64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfUintptrV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfIntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfInt8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfInt16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfInt32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfInt64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfFloat32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfFloat64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntfBoolV(*v, true, d); changed2 { *v = v2 } + + case []string: + fastpathTV.DecSliceStringV(v, false, d) + case *[]string: + if v2, changed2 := fastpathTV.DecSliceStringV(*v, true, d); changed2 { + *v = v2 + } + case map[string]interface{}: fastpathTV.DecMapStringIntfV(v, false, d) case *map[string]interface{}: - var v2 map[string]interface{} - v2, changed = fastpathTV.DecMapStringIntfV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapStringIntfV(*v, true, d); changed2 { *v = v2 } + case map[string]string: fastpathTV.DecMapStringStringV(v, false, d) case *map[string]string: - var v2 map[string]string - v2, changed = fastpathTV.DecMapStringStringV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapStringStringV(*v, true, d); changed2 { *v = v2 } + case map[string]uint: fastpathTV.DecMapStringUintV(v, false, d) case *map[string]uint: - var v2 map[string]uint - v2, changed = fastpathTV.DecMapStringUintV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapStringUintV(*v, true, d); changed2 { *v = v2 } + case map[string]uint8: fastpathTV.DecMapStringUint8V(v, false, d) case *map[string]uint8: - var v2 map[string]uint8 - v2, changed = fastpathTV.DecMapStringUint8V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapStringUint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapStringUint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapStringUint32V(*v, true, d); changed2 { *v = v2 } + case map[string]uint64: fastpathTV.DecMapStringUint64V(v, false, d) case *map[string]uint64: - var v2 map[string]uint64 - v2, changed = fastpathTV.DecMapStringUint64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapStringUint64V(*v, true, d); changed2 { *v = v2 } + case map[string]uintptr: fastpathTV.DecMapStringUintptrV(v, false, d) case *map[string]uintptr: - var v2 map[string]uintptr - v2, changed = fastpathTV.DecMapStringUintptrV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapStringUintptrV(*v, true, d); changed2 { *v = v2 } + case map[string]int: fastpathTV.DecMapStringIntV(v, false, d) case *map[string]int: - var v2 map[string]int - v2, changed = fastpathTV.DecMapStringIntV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapStringIntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapStringInt8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapStringInt16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapStringInt32V(*v, true, d); changed2 { *v = v2 } + case map[string]int64: fastpathTV.DecMapStringInt64V(v, false, d) case *map[string]int64: - var v2 map[string]int64 - v2, changed = fastpathTV.DecMapStringInt64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapStringInt64V(*v, true, d); changed2 { *v = v2 } + case map[string]float32: fastpathTV.DecMapStringFloat32V(v, false, d) case *map[string]float32: - var v2 map[string]float32 - v2, changed = fastpathTV.DecMapStringFloat32V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapStringFloat32V(*v, true, d); changed2 { *v = v2 } + case map[string]float64: fastpathTV.DecMapStringFloat64V(v, false, d) case *map[string]float64: - var v2 map[string]float64 - v2, changed = fastpathTV.DecMapStringFloat64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapStringFloat64V(*v, true, d); changed2 { *v = v2 } + case map[string]bool: fastpathTV.DecMapStringBoolV(v, false, d) case *map[string]bool: - var v2 map[string]bool - v2, changed = fastpathTV.DecMapStringBoolV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapStringBoolV(*v, true, d); changed2 { *v = v2 } + + case []float32: + fastpathTV.DecSliceFloat32V(v, false, d) + case *[]float32: + if v2, changed2 := fastpathTV.DecSliceFloat32V(*v, true, d); changed2 { + *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 { + if v2, changed2 := fastpathTV.DecMapFloat32IntfV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32StringV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32UintV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32Uint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32Uint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32Uint32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32Uint64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32UintptrV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32IntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32Int8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32Int16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32Int32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32Int64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32Float32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32Float64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat32BoolV(*v, true, d); changed2 { *v = v2 } + + case []float64: + fastpathTV.DecSliceFloat64V(v, false, d) + case *[]float64: + if v2, changed2 := fastpathTV.DecSliceFloat64V(*v, true, d); changed2 { + *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 { + if v2, changed2 := fastpathTV.DecMapFloat64IntfV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64StringV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64UintV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64Uint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64Uint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64Uint32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64Uint64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64UintptrV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64IntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64Int8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64Int16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64Int32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64Int64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64Float32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64Float64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapFloat64BoolV(*v, true, d); changed2 { *v = v2 } + + case []uint: + fastpathTV.DecSliceUintV(v, false, d) + case *[]uint: + if v2, changed2 := fastpathTV.DecSliceUintV(*v, true, d); changed2 { + *v = v2 + } + case map[uint]interface{}: fastpathTV.DecMapUintIntfV(v, false, d) case *map[uint]interface{}: - var v2 map[uint]interface{} - v2, changed = fastpathTV.DecMapUintIntfV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUintIntfV(*v, true, d); changed2 { *v = v2 } + case map[uint]string: fastpathTV.DecMapUintStringV(v, false, d) case *map[uint]string: - var v2 map[uint]string - v2, changed = fastpathTV.DecMapUintStringV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUintStringV(*v, true, d); changed2 { *v = v2 } + case map[uint]uint: fastpathTV.DecMapUintUintV(v, false, d) case *map[uint]uint: - var v2 map[uint]uint - v2, changed = fastpathTV.DecMapUintUintV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUintUintV(*v, true, d); changed2 { *v = v2 } + case map[uint]uint8: fastpathTV.DecMapUintUint8V(v, false, d) case *map[uint]uint8: - var v2 map[uint]uint8 - v2, changed = fastpathTV.DecMapUintUint8V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUintUint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintUint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintUint32V(*v, true, d); changed2 { *v = v2 } + case map[uint]uint64: fastpathTV.DecMapUintUint64V(v, false, d) case *map[uint]uint64: - var v2 map[uint]uint64 - v2, changed = fastpathTV.DecMapUintUint64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUintUint64V(*v, true, d); changed2 { *v = v2 } + case map[uint]uintptr: fastpathTV.DecMapUintUintptrV(v, false, d) case *map[uint]uintptr: - var v2 map[uint]uintptr - v2, changed = fastpathTV.DecMapUintUintptrV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUintUintptrV(*v, true, d); changed2 { *v = v2 } + case map[uint]int: fastpathTV.DecMapUintIntV(v, false, d) case *map[uint]int: - var v2 map[uint]int - v2, changed = fastpathTV.DecMapUintIntV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUintIntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintInt8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintInt16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintInt32V(*v, true, d); changed2 { *v = v2 } + case map[uint]int64: fastpathTV.DecMapUintInt64V(v, false, d) case *map[uint]int64: - var v2 map[uint]int64 - v2, changed = fastpathTV.DecMapUintInt64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUintInt64V(*v, true, d); changed2 { *v = v2 } + case map[uint]float32: fastpathTV.DecMapUintFloat32V(v, false, d) case *map[uint]float32: - var v2 map[uint]float32 - v2, changed = fastpathTV.DecMapUintFloat32V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUintFloat32V(*v, true, d); changed2 { *v = v2 } + case map[uint]float64: fastpathTV.DecMapUintFloat64V(v, false, d) case *map[uint]float64: - var v2 map[uint]float64 - v2, changed = fastpathTV.DecMapUintFloat64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUintFloat64V(*v, true, d); changed2 { *v = v2 } + case map[uint]bool: fastpathTV.DecMapUintBoolV(v, false, d) case *map[uint]bool: - var v2 map[uint]bool - v2, changed = fastpathTV.DecMapUintBoolV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUintBoolV(*v, true, d); changed2 { *v = v2 } + case map[uint8]interface{}: fastpathTV.DecMapUint8IntfV(v, false, d) case *map[uint8]interface{}: - var v2 map[uint8]interface{} - v2, changed = fastpathTV.DecMapUint8IntfV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint8IntfV(*v, true, d); changed2 { *v = v2 } + case map[uint8]string: fastpathTV.DecMapUint8StringV(v, false, d) case *map[uint8]string: - var v2 map[uint8]string - v2, changed = fastpathTV.DecMapUint8StringV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint8StringV(*v, true, d); changed2 { *v = v2 } + case map[uint8]uint: fastpathTV.DecMapUint8UintV(v, false, d) case *map[uint8]uint: - var v2 map[uint8]uint - v2, changed = fastpathTV.DecMapUint8UintV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint8UintV(*v, true, d); changed2 { *v = v2 } + case map[uint8]uint8: fastpathTV.DecMapUint8Uint8V(v, false, d) case *map[uint8]uint8: - var v2 map[uint8]uint8 - v2, changed = fastpathTV.DecMapUint8Uint8V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint8Uint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint8Uint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint8Uint32V(*v, true, d); changed2 { *v = v2 } + case map[uint8]uint64: fastpathTV.DecMapUint8Uint64V(v, false, d) case *map[uint8]uint64: - var v2 map[uint8]uint64 - v2, changed = fastpathTV.DecMapUint8Uint64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint8Uint64V(*v, true, d); changed2 { *v = v2 } + case map[uint8]uintptr: fastpathTV.DecMapUint8UintptrV(v, false, d) case *map[uint8]uintptr: - var v2 map[uint8]uintptr - v2, changed = fastpathTV.DecMapUint8UintptrV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint8UintptrV(*v, true, d); changed2 { *v = v2 } + case map[uint8]int: fastpathTV.DecMapUint8IntV(v, false, d) case *map[uint8]int: - var v2 map[uint8]int - v2, changed = fastpathTV.DecMapUint8IntV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint8IntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint8Int8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint8Int16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint8Int32V(*v, true, d); changed2 { *v = v2 } + case map[uint8]int64: fastpathTV.DecMapUint8Int64V(v, false, d) case *map[uint8]int64: - var v2 map[uint8]int64 - v2, changed = fastpathTV.DecMapUint8Int64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint8Int64V(*v, true, d); changed2 { *v = v2 } + case map[uint8]float32: fastpathTV.DecMapUint8Float32V(v, false, d) case *map[uint8]float32: - var v2 map[uint8]float32 - v2, changed = fastpathTV.DecMapUint8Float32V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint8Float32V(*v, true, d); changed2 { *v = v2 } + case map[uint8]float64: fastpathTV.DecMapUint8Float64V(v, false, d) case *map[uint8]float64: - var v2 map[uint8]float64 - v2, changed = fastpathTV.DecMapUint8Float64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint8Float64V(*v, true, d); changed2 { *v = v2 } + case map[uint8]bool: fastpathTV.DecMapUint8BoolV(v, false, d) case *map[uint8]bool: - var v2 map[uint8]bool - v2, changed = fastpathTV.DecMapUint8BoolV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint8BoolV(*v, true, d); changed2 { *v = v2 } + + case []uint16: + fastpathTV.DecSliceUint16V(v, false, d) + case *[]uint16: + if v2, changed2 := fastpathTV.DecSliceUint16V(*v, true, d); changed2 { + *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 { + if v2, changed2 := fastpathTV.DecMapUint16IntfV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16StringV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16UintV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16Uint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16Uint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16Uint32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16Uint64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16UintptrV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16IntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16Int8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16Int16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16Int32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16Int64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16Float32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16Float64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint16BoolV(*v, true, d); changed2 { *v = v2 } + + case []uint32: + fastpathTV.DecSliceUint32V(v, false, d) + case *[]uint32: + if v2, changed2 := fastpathTV.DecSliceUint32V(*v, true, d); changed2 { + *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 { + if v2, changed2 := fastpathTV.DecMapUint32IntfV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32StringV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32UintV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32Uint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32Uint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32Uint32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32Uint64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32UintptrV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32IntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32Int8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32Int16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32Int32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32Int64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32Float32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32Float64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint32BoolV(*v, true, d); changed2 { *v = v2 } + + case []uint64: + fastpathTV.DecSliceUint64V(v, false, d) + case *[]uint64: + if v2, changed2 := fastpathTV.DecSliceUint64V(*v, true, d); changed2 { + *v = v2 + } + case map[uint64]interface{}: fastpathTV.DecMapUint64IntfV(v, false, d) case *map[uint64]interface{}: - var v2 map[uint64]interface{} - v2, changed = fastpathTV.DecMapUint64IntfV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint64IntfV(*v, true, d); changed2 { *v = v2 } + case map[uint64]string: fastpathTV.DecMapUint64StringV(v, false, d) case *map[uint64]string: - var v2 map[uint64]string - v2, changed = fastpathTV.DecMapUint64StringV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint64StringV(*v, true, d); changed2 { *v = v2 } + case map[uint64]uint: fastpathTV.DecMapUint64UintV(v, false, d) case *map[uint64]uint: - var v2 map[uint64]uint - v2, changed = fastpathTV.DecMapUint64UintV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint64UintV(*v, true, d); changed2 { *v = v2 } + case map[uint64]uint8: fastpathTV.DecMapUint64Uint8V(v, false, d) case *map[uint64]uint8: - var v2 map[uint64]uint8 - v2, changed = fastpathTV.DecMapUint64Uint8V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint64Uint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint64Uint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint64Uint32V(*v, true, d); changed2 { *v = v2 } + case map[uint64]uint64: fastpathTV.DecMapUint64Uint64V(v, false, d) case *map[uint64]uint64: - var v2 map[uint64]uint64 - v2, changed = fastpathTV.DecMapUint64Uint64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint64Uint64V(*v, true, d); changed2 { *v = v2 } + case map[uint64]uintptr: fastpathTV.DecMapUint64UintptrV(v, false, d) case *map[uint64]uintptr: - var v2 map[uint64]uintptr - v2, changed = fastpathTV.DecMapUint64UintptrV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint64UintptrV(*v, true, d); changed2 { *v = v2 } + case map[uint64]int: fastpathTV.DecMapUint64IntV(v, false, d) case *map[uint64]int: - var v2 map[uint64]int - v2, changed = fastpathTV.DecMapUint64IntV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint64IntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint64Int8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint64Int16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUint64Int32V(*v, true, d); changed2 { *v = v2 } + case map[uint64]int64: fastpathTV.DecMapUint64Int64V(v, false, d) case *map[uint64]int64: - var v2 map[uint64]int64 - v2, changed = fastpathTV.DecMapUint64Int64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint64Int64V(*v, true, d); changed2 { *v = v2 } + case map[uint64]float32: fastpathTV.DecMapUint64Float32V(v, false, d) case *map[uint64]float32: - var v2 map[uint64]float32 - v2, changed = fastpathTV.DecMapUint64Float32V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint64Float32V(*v, true, d); changed2 { *v = v2 } + case map[uint64]float64: fastpathTV.DecMapUint64Float64V(v, false, d) case *map[uint64]float64: - var v2 map[uint64]float64 - v2, changed = fastpathTV.DecMapUint64Float64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint64Float64V(*v, true, d); changed2 { *v = v2 } + case map[uint64]bool: fastpathTV.DecMapUint64BoolV(v, false, d) case *map[uint64]bool: - var v2 map[uint64]bool - v2, changed = fastpathTV.DecMapUint64BoolV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapUint64BoolV(*v, true, d); changed2 { *v = v2 } + + case []uintptr: + fastpathTV.DecSliceUintptrV(v, false, d) + case *[]uintptr: + if v2, changed2 := fastpathTV.DecSliceUintptrV(*v, true, d); changed2 { + *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 { + if v2, changed2 := fastpathTV.DecMapUintptrIntfV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrStringV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrUintV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrUint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrUint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrUint32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrUint64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrUintptrV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrIntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrInt8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrInt16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrInt32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrInt64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrFloat32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrFloat64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapUintptrBoolV(*v, true, d); changed2 { *v = v2 } + + case []int: + fastpathTV.DecSliceIntV(v, false, d) + case *[]int: + if v2, changed2 := fastpathTV.DecSliceIntV(*v, true, d); changed2 { + *v = v2 + } + case map[int]interface{}: fastpathTV.DecMapIntIntfV(v, false, d) case *map[int]interface{}: - var v2 map[int]interface{} - v2, changed = fastpathTV.DecMapIntIntfV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapIntIntfV(*v, true, d); changed2 { *v = v2 } + case map[int]string: fastpathTV.DecMapIntStringV(v, false, d) case *map[int]string: - var v2 map[int]string - v2, changed = fastpathTV.DecMapIntStringV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapIntStringV(*v, true, d); changed2 { *v = v2 } + case map[int]uint: fastpathTV.DecMapIntUintV(v, false, d) case *map[int]uint: - var v2 map[int]uint - v2, changed = fastpathTV.DecMapIntUintV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapIntUintV(*v, true, d); changed2 { *v = v2 } + case map[int]uint8: fastpathTV.DecMapIntUint8V(v, false, d) case *map[int]uint8: - var v2 map[int]uint8 - v2, changed = fastpathTV.DecMapIntUint8V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapIntUint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntUint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntUint32V(*v, true, d); changed2 { *v = v2 } + case map[int]uint64: fastpathTV.DecMapIntUint64V(v, false, d) case *map[int]uint64: - var v2 map[int]uint64 - v2, changed = fastpathTV.DecMapIntUint64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapIntUint64V(*v, true, d); changed2 { *v = v2 } + case map[int]uintptr: fastpathTV.DecMapIntUintptrV(v, false, d) case *map[int]uintptr: - var v2 map[int]uintptr - v2, changed = fastpathTV.DecMapIntUintptrV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapIntUintptrV(*v, true, d); changed2 { *v = v2 } + case map[int]int: fastpathTV.DecMapIntIntV(v, false, d) case *map[int]int: - var v2 map[int]int - v2, changed = fastpathTV.DecMapIntIntV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapIntIntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntInt8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntInt16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapIntInt32V(*v, true, d); changed2 { *v = v2 } + case map[int]int64: fastpathTV.DecMapIntInt64V(v, false, d) case *map[int]int64: - var v2 map[int]int64 - v2, changed = fastpathTV.DecMapIntInt64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapIntInt64V(*v, true, d); changed2 { *v = v2 } + case map[int]float32: fastpathTV.DecMapIntFloat32V(v, false, d) case *map[int]float32: - var v2 map[int]float32 - v2, changed = fastpathTV.DecMapIntFloat32V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapIntFloat32V(*v, true, d); changed2 { *v = v2 } + case map[int]float64: fastpathTV.DecMapIntFloat64V(v, false, d) case *map[int]float64: - var v2 map[int]float64 - v2, changed = fastpathTV.DecMapIntFloat64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapIntFloat64V(*v, true, d); changed2 { *v = v2 } + case map[int]bool: fastpathTV.DecMapIntBoolV(v, false, d) case *map[int]bool: - var v2 map[int]bool - v2, changed = fastpathTV.DecMapIntBoolV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapIntBoolV(*v, true, d); changed2 { *v = v2 } + + case []int8: + fastpathTV.DecSliceInt8V(v, false, d) + case *[]int8: + if v2, changed2 := fastpathTV.DecSliceInt8V(*v, true, d); changed2 { + *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 { + if v2, changed2 := fastpathTV.DecMapInt8IntfV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8StringV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8UintV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8Uint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8Uint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8Uint32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8Uint64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8UintptrV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8IntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8Int8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8Int16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8Int32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8Int64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8Float32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8Float64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt8BoolV(*v, true, d); changed2 { *v = v2 } + + case []int16: + fastpathTV.DecSliceInt16V(v, false, d) + case *[]int16: + if v2, changed2 := fastpathTV.DecSliceInt16V(*v, true, d); changed2 { + *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 { + if v2, changed2 := fastpathTV.DecMapInt16IntfV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16StringV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16UintV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16Uint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16Uint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16Uint32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16Uint64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16UintptrV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16IntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16Int8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16Int16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16Int32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16Int64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16Float32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16Float64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt16BoolV(*v, true, d); changed2 { *v = v2 } + + case []int32: + fastpathTV.DecSliceInt32V(v, false, d) + case *[]int32: + if v2, changed2 := fastpathTV.DecSliceInt32V(*v, true, d); changed2 { + *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 { + if v2, changed2 := fastpathTV.DecMapInt32IntfV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32StringV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32UintV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32Uint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32Uint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32Uint32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32Uint64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32UintptrV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32IntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32Int8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32Int16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32Int32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32Int64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32Float32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32Float64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt32BoolV(*v, true, d); changed2 { *v = v2 } + + case []int64: + fastpathTV.DecSliceInt64V(v, false, d) + case *[]int64: + if v2, changed2 := fastpathTV.DecSliceInt64V(*v, true, d); changed2 { + *v = v2 + } + case map[int64]interface{}: fastpathTV.DecMapInt64IntfV(v, false, d) case *map[int64]interface{}: - var v2 map[int64]interface{} - v2, changed = fastpathTV.DecMapInt64IntfV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapInt64IntfV(*v, true, d); changed2 { *v = v2 } + case map[int64]string: fastpathTV.DecMapInt64StringV(v, false, d) case *map[int64]string: - var v2 map[int64]string - v2, changed = fastpathTV.DecMapInt64StringV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapInt64StringV(*v, true, d); changed2 { *v = v2 } + case map[int64]uint: fastpathTV.DecMapInt64UintV(v, false, d) case *map[int64]uint: - var v2 map[int64]uint - v2, changed = fastpathTV.DecMapInt64UintV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapInt64UintV(*v, true, d); changed2 { *v = v2 } + case map[int64]uint8: fastpathTV.DecMapInt64Uint8V(v, false, d) case *map[int64]uint8: - var v2 map[int64]uint8 - v2, changed = fastpathTV.DecMapInt64Uint8V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapInt64Uint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt64Uint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt64Uint32V(*v, true, d); changed2 { *v = v2 } + case map[int64]uint64: fastpathTV.DecMapInt64Uint64V(v, false, d) case *map[int64]uint64: - var v2 map[int64]uint64 - v2, changed = fastpathTV.DecMapInt64Uint64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapInt64Uint64V(*v, true, d); changed2 { *v = v2 } + case map[int64]uintptr: fastpathTV.DecMapInt64UintptrV(v, false, d) case *map[int64]uintptr: - var v2 map[int64]uintptr - v2, changed = fastpathTV.DecMapInt64UintptrV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapInt64UintptrV(*v, true, d); changed2 { *v = v2 } + case map[int64]int: fastpathTV.DecMapInt64IntV(v, false, d) case *map[int64]int: - var v2 map[int64]int - v2, changed = fastpathTV.DecMapInt64IntV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapInt64IntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt64Int8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt64Int16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapInt64Int32V(*v, true, d); changed2 { *v = v2 } + case map[int64]int64: fastpathTV.DecMapInt64Int64V(v, false, d) case *map[int64]int64: - var v2 map[int64]int64 - v2, changed = fastpathTV.DecMapInt64Int64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapInt64Int64V(*v, true, d); changed2 { *v = v2 } + case map[int64]float32: fastpathTV.DecMapInt64Float32V(v, false, d) case *map[int64]float32: - var v2 map[int64]float32 - v2, changed = fastpathTV.DecMapInt64Float32V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapInt64Float32V(*v, true, d); changed2 { *v = v2 } + case map[int64]float64: fastpathTV.DecMapInt64Float64V(v, false, d) case *map[int64]float64: - var v2 map[int64]float64 - v2, changed = fastpathTV.DecMapInt64Float64V(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapInt64Float64V(*v, true, d); changed2 { *v = v2 } + case map[int64]bool: fastpathTV.DecMapInt64BoolV(v, false, d) case *map[int64]bool: - var v2 map[int64]bool - v2, changed = fastpathTV.DecMapInt64BoolV(*v, true, d) - if changed { + if v2, changed2 := fastpathTV.DecMapInt64BoolV(*v, true, d); changed2 { *v = v2 } + + case []bool: + fastpathTV.DecSliceBoolV(v, false, d) + case *[]bool: + if v2, changed2 := fastpathTV.DecSliceBoolV(*v, true, d); changed2 { + *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 { + if v2, changed2 := fastpathTV.DecMapBoolIntfV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolStringV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolUintV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolUint8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolUint16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolUint32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolUint64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolUintptrV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolIntV(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolInt8V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolInt16V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolInt32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolInt64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolFloat32V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolFloat64V(*v, true, d); changed2 { *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 { + if v2, changed2 := fastpathTV.DecMapBoolBoolV(*v, true, d); changed2 { *v = v2 } + default: - _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true } -func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { +func fastpathDecodeSetZeroTypeSwitch(iv interface{}, d *Decoder) bool { switch v := iv.(type) { case *[]interface{}: *v = nil - case *[]string: - *v = nil - case *[]float32: - *v = nil - case *[]float64: - *v = nil - case *[]uint: - *v = nil - case *[]uint8: - *v = nil - case *[]uint16: - *v = nil - case *[]uint32: - *v = nil - case *[]uint64: - *v = nil - case *[]uintptr: - *v = nil - case *[]int: - *v = nil - case *[]int8: - *v = nil - case *[]int16: - *v = nil - case *[]int32: - *v = nil - case *[]int64: - *v = nil - 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 *[]string: + *v = nil + case *map[string]interface{}: *v = nil + case *map[string]string: *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: *v = nil + case *map[string]float64: *v = nil + case *map[string]bool: *v = nil + + case *[]float32: + *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 *[]float64: + *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 *[]uint: + *v = nil + case *map[uint]interface{}: *v = nil + case *map[uint]string: *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: *v = nil + case *map[uint]float64: *v = nil + case *map[uint]bool: *v = nil + case *map[uint8]interface{}: *v = nil + case *map[uint8]string: *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: *v = nil + case *map[uint8]float64: *v = nil + case *map[uint8]bool: *v = nil + + case *[]uint16: + *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 *[]uint32: + *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 *[]uint64: + *v = nil + case *map[uint64]interface{}: *v = nil + case *map[uint64]string: *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: *v = nil + case *map[uint64]float64: *v = nil + case *map[uint64]bool: *v = nil + + case *[]uintptr: + *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 *[]int: + *v = nil + case *map[int]interface{}: *v = nil + case *map[int]string: *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: *v = nil + case *map[int]float64: *v = nil + case *map[int]bool: *v = nil + + case *[]int8: + *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 *[]int16: + *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 *[]int32: + *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 *[]int64: + *v = nil + case *map[int64]interface{}: *v = nil + case *map[int64]string: *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: *v = nil + case *map[int64]float64: *v = nil + case *map[int64]bool: *v = nil + + case *[]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 + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true @@ -17723,27 +16678,23 @@ 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 { + var vp = rv2i(rv).(*[]interface{}) + if v, changed := fastpathTV.DecSliceIntfV(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]interface{}) - v2, changed := fastpathTV.DecSliceIntfV(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceIntfV(rv2i(rv).([]interface{}), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -17757,6 +16708,7 @@ func (_ fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -17775,7 +16727,7 @@ func (_ fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) } else { @@ -17798,8 +16750,6 @@ func (_ fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = nil } else { d.decode(&v[j]) } @@ -17819,27 +16769,23 @@ func (_ fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ 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 { + var vp = rv2i(rv).(*[]string) + if v, changed := fastpathTV.DecSliceStringV(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]string) - v2, changed := fastpathTV.DecSliceStringV(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceStringV(rv2i(rv).([]string), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -17853,6 +16799,7 @@ func (_ fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ [] slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -17871,7 +16818,7 @@ func (_ fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ [] } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) } else { @@ -17894,8 +16841,6 @@ func (_ fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ [] slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = "" } else { v[j] = dd.DecodeString() } @@ -17915,27 +16860,23 @@ func (_ fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ [] 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 { + var vp = rv2i(rv).(*[]float32) + if v, changed := fastpathTV.DecSliceFloat32V(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]float32) - v2, changed := fastpathTV.DecSliceFloat32V(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceFloat32V(rv2i(rv).([]float32), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -17949,6 +16890,7 @@ func (_ fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -17967,7 +16909,7 @@ func (_ fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) } else { @@ -17990,10 +16932,8 @@ func (_ fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = 0 } else { - v[j] = float32(chkOvf.Float32V(dd.DecodeFloat64())) + v[j] = float32(dd.DecodeFloat(true)) } } if canChange { @@ -18011,27 +16951,23 @@ func (_ fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ 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 { + var vp = rv2i(rv).(*[]float64) + if v, changed := fastpathTV.DecSliceFloat64V(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]float64) - v2, changed := fastpathTV.DecSliceFloat64V(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceFloat64V(rv2i(rv).([]float64), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18045,6 +16981,7 @@ func (_ fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -18063,7 +17000,7 @@ func (_ fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) } else { @@ -18086,10 +17023,8 @@ func (_ fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = 0 } else { - v[j] = dd.DecodeFloat64() + v[j] = dd.DecodeFloat(false) } } if canChange { @@ -18107,27 +17042,23 @@ func (_ fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ 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 { + var vp = rv2i(rv).(*[]uint) + if v, changed := fastpathTV.DecSliceUintV(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]uint) - v2, changed := fastpathTV.DecSliceUintV(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceUintV(rv2i(rv).([]uint), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18141,6 +17072,7 @@ func (_ fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -18159,7 +17091,7 @@ func (_ fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) } else { @@ -18182,10 +17114,8 @@ func (_ fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = 0 } else { - v[j] = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + v[j] = uint(dd.DecodeUint(uintBitsize)) } } if canChange { @@ -18201,125 +17131,25 @@ func (_ fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint 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 { - *vp = v - } - } else { - v := rv2i(rv).([]uint8) - v2, changed := fastpathTV.DecSliceUint8V(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) DecSliceUint8X(vp *[]uint8, d *Decoder) { - v, changed := f.DecSliceUint8V(*vp, true, d) - if changed { - *vp = v - } -} -func (_ fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []uint8, changed bool) { - dd := d.d - slh, containerLenS := d.decSliceHelperStart() - if containerLenS == 0 { - if canChange { - if v == nil { - v = []uint8{} - } 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, 1) - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]uint8, xlen) - } - changed = true - } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) - } else { - xlen = 8 - } - v = make([]uint8, xlen) - changed = true - } - // if indefinite, etc, then expand the slice if necessary - var decodeIntoBlank bool - if j >= len(v) { - if canChange { - v = append(v, 0) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - decodeIntoBlank = true - } - } - slh.ElemContainerState(j) - if decodeIntoBlank { - d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = 0 - } else { - v[j] = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) - } - } - if canChange { - if j < len(v) { - v = v[:j] - changed = true - } else if j == 0 && v == nil { - v = make([]uint8, 0) - changed = true - } - } - slh.End() - 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 { + var vp = rv2i(rv).(*[]uint16) + if v, changed := fastpathTV.DecSliceUint16V(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]uint16) - v2, changed := fastpathTV.DecSliceUint16V(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceUint16V(rv2i(rv).([]uint16), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18333,6 +17163,7 @@ func (_ fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ [] slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -18351,7 +17182,7 @@ func (_ fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ [] } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2) } else { @@ -18374,10 +17205,8 @@ func (_ fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ [] slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = 0 } else { - v[j] = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + v[j] = uint16(dd.DecodeUint(16)) } } if canChange { @@ -18395,27 +17224,23 @@ func (_ fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ [] 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 { + var vp = rv2i(rv).(*[]uint32) + if v, changed := fastpathTV.DecSliceUint32V(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]uint32) - v2, changed := fastpathTV.DecSliceUint32V(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceUint32V(rv2i(rv).([]uint32), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18429,6 +17254,7 @@ func (_ fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ [] slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -18447,7 +17273,7 @@ func (_ fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ [] } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) } else { @@ -18470,10 +17296,8 @@ func (_ fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ [] slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = 0 } else { - v[j] = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + v[j] = uint32(dd.DecodeUint(32)) } } if canChange { @@ -18491,27 +17315,23 @@ func (_ fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ [] 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 { + var vp = rv2i(rv).(*[]uint64) + if v, changed := fastpathTV.DecSliceUint64V(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]uint64) - v2, changed := fastpathTV.DecSliceUint64V(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceUint64V(rv2i(rv).([]uint64), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18525,6 +17345,7 @@ func (_ fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ [] slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -18543,7 +17364,7 @@ func (_ fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ [] } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) } else { @@ -18566,10 +17387,8 @@ func (_ fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ [] slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = 0 } else { - v[j] = dd.DecodeUint64() + v[j] = dd.DecodeUint(64) } } if canChange { @@ -18587,27 +17406,23 @@ func (_ fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ [] 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 { + var vp = rv2i(rv).(*[]uintptr) + if v, changed := fastpathTV.DecSliceUintptrV(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]uintptr) - v2, changed := fastpathTV.DecSliceUintptrV(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceUintptrV(rv2i(rv).([]uintptr), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18621,6 +17436,7 @@ func (_ fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -18639,7 +17455,7 @@ func (_ fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) } else { @@ -18662,10 +17478,8 @@ func (_ fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = 0 } else { - v[j] = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + v[j] = uintptr(dd.DecodeUint(uintBitsize)) } } if canChange { @@ -18683,27 +17497,23 @@ func (_ fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ 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 { + var vp = rv2i(rv).(*[]int) + if v, changed := fastpathTV.DecSliceIntV(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]int) - v2, changed := fastpathTV.DecSliceIntV(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceIntV(rv2i(rv).([]int), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18717,6 +17527,7 @@ func (_ fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, c slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -18735,7 +17546,7 @@ func (_ fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, c } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) } else { @@ -18758,10 +17569,8 @@ func (_ fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, c slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = 0 } else { - v[j] = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + v[j] = int(dd.DecodeInt(intBitsize)) } } if canChange { @@ -18779,27 +17588,23 @@ func (_ fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, c 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 { + var vp = rv2i(rv).(*[]int8) + if v, changed := fastpathTV.DecSliceInt8V(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]int8) - v2, changed := fastpathTV.DecSliceInt8V(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceInt8V(rv2i(rv).([]int8), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18813,6 +17618,7 @@ func (_ fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8 slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -18831,7 +17637,7 @@ func (_ fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8 } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) } else { @@ -18854,10 +17660,8 @@ func (_ fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8 slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = 0 } else { - v[j] = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + v[j] = int8(dd.DecodeInt(8)) } } if canChange { @@ -18875,27 +17679,23 @@ func (_ fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8 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 { + var vp = rv2i(rv).(*[]int16) + if v, changed := fastpathTV.DecSliceInt16V(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]int16) - v2, changed := fastpathTV.DecSliceInt16V(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceInt16V(rv2i(rv).([]int16), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18909,6 +17709,7 @@ func (_ fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []in slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -18927,7 +17728,7 @@ func (_ fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []in } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2) } else { @@ -18950,10 +17751,8 @@ func (_ fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []in slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = 0 } else { - v[j] = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + v[j] = int16(dd.DecodeInt(16)) } } if canChange { @@ -18971,27 +17770,23 @@ func (_ fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []in 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 { + var vp = rv2i(rv).(*[]int32) + if v, changed := fastpathTV.DecSliceInt32V(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]int32) - v2, changed := fastpathTV.DecSliceInt32V(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceInt32V(rv2i(rv).([]int32), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -19005,6 +17800,7 @@ func (_ fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []in slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -19023,7 +17819,7 @@ func (_ fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []in } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) } else { @@ -19046,10 +17842,8 @@ func (_ fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []in slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = 0 } else { - v[j] = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + v[j] = int32(dd.DecodeInt(32)) } } if canChange { @@ -19067,27 +17861,23 @@ func (_ fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []in 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 { + var vp = rv2i(rv).(*[]int64) + if v, changed := fastpathTV.DecSliceInt64V(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]int64) - v2, changed := fastpathTV.DecSliceInt64V(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceInt64V(rv2i(rv).([]int64), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -19101,6 +17891,7 @@ func (_ fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []in slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -19119,7 +17910,7 @@ func (_ fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []in } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) } else { @@ -19142,10 +17933,8 @@ func (_ fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []in slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = 0 } else { - v[j] = dd.DecodeInt64() + v[j] = dd.DecodeInt(64) } } if canChange { @@ -19163,27 +17952,23 @@ func (_ fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []in 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 { + var vp = rv2i(rv).(*[]bool) + if v, changed := fastpathTV.DecSliceBoolV(*vp, !array, d); changed { *vp = v } } else { - v := rv2i(rv).([]bool) - v2, changed := fastpathTV.DecSliceBoolV(v, !array, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.DecSliceBoolV(rv2i(rv).([]bool), !array, d) } } + 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 + slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -19197,6 +17982,7 @@ func (_ fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -19215,7 +18001,7 @@ func (_ fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) } else { @@ -19238,8 +18024,6 @@ func (_ fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = false } else { v[j] = dd.DecodeBool() } @@ -19260,23 +18044,22 @@ func (_ fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool 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 { + if v, changed := fastpathTV.DecMapIntfIntfV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfIntfV(rv2i(rv).(map[interface{}]interface{}), false, d) + return } + 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 { + if v, changed := f.DecMapIntfIntfV(*vp, true, d); 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) @@ -19287,7 +18070,7 @@ func (_ fastpathT) DecMapIntfIntfV(v map[interface{}]interface{}, canChange bool dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk interface{} var mv interface{} hasLen := containerLen > 0 @@ -19304,8 +18087,7 @@ func (_ fastpathT) DecMapIntfIntfV(v map[interface{}]interface{}, canChange bool dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -19329,23 +18111,22 @@ func (_ fastpathT) DecMapIntfIntfV(v map[interface{}]interface{}, canChange bool 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 { + if v, changed := fastpathTV.DecMapIntfStringV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfStringV(rv2i(rv).(map[interface{}]string), false, d) + return } + 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 { + if v, changed := f.DecMapIntfStringV(*vp, true, d); 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) @@ -19356,6 +18137,7 @@ func (_ fastpathT) DecMapIntfStringV(v map[interface{}]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv string hasLen := containerLen > 0 @@ -19372,8 +18154,7 @@ func (_ fastpathT) DecMapIntfStringV(v map[interface{}]string, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -19392,23 +18173,22 @@ func (_ fastpathT) DecMapIntfStringV(v map[interface{}]string, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfUintV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfUintV(rv2i(rv).(map[interface{}]uint), false, d) + return } + 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 { + if v, changed := f.DecMapIntfUintV(*vp, true, d); 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) @@ -19419,6 +18199,7 @@ func (_ fastpathT) DecMapIntfUintV(v map[interface{}]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv uint hasLen := containerLen > 0 @@ -19435,15 +18216,14 @@ func (_ fastpathT) DecMapIntfUintV(v map[interface{}]uint, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -19455,23 +18235,22 @@ func (_ fastpathT) DecMapIntfUintV(v map[interface{}]uint, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfUint8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfUint8V(rv2i(rv).(map[interface{}]uint8), false, d) + return } + 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 { + if v, changed := f.DecMapIntfUint8V(*vp, true, d); 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) @@ -19482,6 +18261,7 @@ func (_ fastpathT) DecMapIntfUint8V(v map[interface{}]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv uint8 hasLen := containerLen > 0 @@ -19498,15 +18278,14 @@ func (_ fastpathT) DecMapIntfUint8V(v map[interface{}]uint8, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -19518,23 +18297,22 @@ func (_ fastpathT) DecMapIntfUint8V(v map[interface{}]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfUint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfUint16V(rv2i(rv).(map[interface{}]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapIntfUint16V(*vp, true, d); 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) @@ -19545,6 +18323,7 @@ func (_ fastpathT) DecMapIntfUint16V(v map[interface{}]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv uint16 hasLen := containerLen > 0 @@ -19561,15 +18340,14 @@ func (_ fastpathT) DecMapIntfUint16V(v map[interface{}]uint16, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -19581,23 +18359,22 @@ func (_ fastpathT) DecMapIntfUint16V(v map[interface{}]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfUint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfUint32V(rv2i(rv).(map[interface{}]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapIntfUint32V(*vp, true, d); 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) @@ -19608,6 +18385,7 @@ func (_ fastpathT) DecMapIntfUint32V(v map[interface{}]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv uint32 hasLen := containerLen > 0 @@ -19624,15 +18402,14 @@ func (_ fastpathT) DecMapIntfUint32V(v map[interface{}]uint32, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -19644,23 +18421,22 @@ func (_ fastpathT) DecMapIntfUint32V(v map[interface{}]uint32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfUint64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfUint64V(rv2i(rv).(map[interface{}]uint64), false, d) + return } + 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 { + if v, changed := f.DecMapIntfUint64V(*vp, true, d); 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) @@ -19671,6 +18447,7 @@ func (_ fastpathT) DecMapIntfUint64V(v map[interface{}]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv uint64 hasLen := containerLen > 0 @@ -19687,15 +18464,14 @@ func (_ fastpathT) DecMapIntfUint64V(v map[interface{}]uint64, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -19707,23 +18483,22 @@ func (_ fastpathT) DecMapIntfUint64V(v map[interface{}]uint64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfUintptrV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfUintptrV(rv2i(rv).(map[interface{}]uintptr), false, d) + return } + 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 { + if v, changed := f.DecMapIntfUintptrV(*vp, true, d); 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) @@ -19734,6 +18509,7 @@ func (_ fastpathT) DecMapIntfUintptrV(v map[interface{}]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv uintptr hasLen := containerLen > 0 @@ -19750,15 +18526,14 @@ func (_ fastpathT) DecMapIntfUintptrV(v map[interface{}]uintptr, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -19770,23 +18545,22 @@ func (_ fastpathT) DecMapIntfUintptrV(v map[interface{}]uintptr, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfIntV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfIntV(rv2i(rv).(map[interface{}]int), false, d) + return } + 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 { + if v, changed := f.DecMapIntfIntV(*vp, true, d); 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) @@ -19797,6 +18571,7 @@ func (_ fastpathT) DecMapIntfIntV(v map[interface{}]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv int hasLen := containerLen > 0 @@ -19813,15 +18588,14 @@ func (_ fastpathT) DecMapIntfIntV(v map[interface{}]int, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -19833,23 +18607,22 @@ func (_ fastpathT) DecMapIntfIntV(v map[interface{}]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfInt8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfInt8V(rv2i(rv).(map[interface{}]int8), false, d) + return } + 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 { + if v, changed := f.DecMapIntfInt8V(*vp, true, d); 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) @@ -19860,6 +18633,7 @@ func (_ fastpathT) DecMapIntfInt8V(v map[interface{}]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv int8 hasLen := containerLen > 0 @@ -19876,15 +18650,14 @@ func (_ fastpathT) DecMapIntfInt8V(v map[interface{}]int8, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -19896,23 +18669,22 @@ func (_ fastpathT) DecMapIntfInt8V(v map[interface{}]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfInt16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfInt16V(rv2i(rv).(map[interface{}]int16), false, d) + return } + 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 { + if v, changed := f.DecMapIntfInt16V(*vp, true, d); 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) @@ -19923,6 +18695,7 @@ func (_ fastpathT) DecMapIntfInt16V(v map[interface{}]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv int16 hasLen := containerLen > 0 @@ -19939,15 +18712,14 @@ func (_ fastpathT) DecMapIntfInt16V(v map[interface{}]int16, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -19959,23 +18731,22 @@ func (_ fastpathT) DecMapIntfInt16V(v map[interface{}]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfInt32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfInt32V(rv2i(rv).(map[interface{}]int32), false, d) + return } + 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 { + if v, changed := f.DecMapIntfInt32V(*vp, true, d); 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) @@ -19986,6 +18757,7 @@ func (_ fastpathT) DecMapIntfInt32V(v map[interface{}]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv int32 hasLen := containerLen > 0 @@ -20002,15 +18774,14 @@ func (_ fastpathT) DecMapIntfInt32V(v map[interface{}]int32, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -20022,23 +18793,22 @@ func (_ fastpathT) DecMapIntfInt32V(v map[interface{}]int32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfInt64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfInt64V(rv2i(rv).(map[interface{}]int64), false, d) + return } + 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 { + if v, changed := f.DecMapIntfInt64V(*vp, true, d); 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) @@ -20049,6 +18819,7 @@ func (_ fastpathT) DecMapIntfInt64V(v map[interface{}]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv int64 hasLen := containerLen > 0 @@ -20065,15 +18836,14 @@ func (_ fastpathT) DecMapIntfInt64V(v map[interface{}]int64, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -20085,23 +18855,22 @@ func (_ fastpathT) DecMapIntfInt64V(v map[interface{}]int64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfFloat32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfFloat32V(rv2i(rv).(map[interface{}]float32), false, d) + return } + 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 { + if v, changed := f.DecMapIntfFloat32V(*vp, true, d); 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) @@ -20112,6 +18881,7 @@ func (_ fastpathT) DecMapIntfFloat32V(v map[interface{}]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv float32 hasLen := containerLen > 0 @@ -20128,15 +18898,14 @@ func (_ fastpathT) DecMapIntfFloat32V(v map[interface{}]float32, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -20148,23 +18917,22 @@ func (_ fastpathT) DecMapIntfFloat32V(v map[interface{}]float32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfFloat64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfFloat64V(rv2i(rv).(map[interface{}]float64), false, d) + return } + 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 { + if v, changed := f.DecMapIntfFloat64V(*vp, true, d); 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) @@ -20175,6 +18943,7 @@ func (_ fastpathT) DecMapIntfFloat64V(v map[interface{}]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv float64 hasLen := containerLen > 0 @@ -20191,15 +18960,14 @@ func (_ fastpathT) DecMapIntfFloat64V(v map[interface{}]float64, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -20211,23 +18979,22 @@ func (_ fastpathT) DecMapIntfFloat64V(v map[interface{}]float64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntfBoolV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntfBoolV(rv2i(rv).(map[interface{}]bool), false, d) + return } + 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 { + if v, changed := f.DecMapIntfBoolV(*vp, true, d); 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) @@ -20238,6 +19005,7 @@ func (_ fastpathT) DecMapIntfBoolV(v map[interface{}]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk interface{} var mv bool hasLen := containerLen > 0 @@ -20254,8 +19022,7 @@ func (_ fastpathT) DecMapIntfBoolV(v map[interface{}]bool, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -20274,23 +19041,22 @@ func (_ fastpathT) DecMapIntfBoolV(v map[interface{}]bool, canChange bool, 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 { - fastpathTV.DecMapStringIntfV(rv2i(rv).(map[string]interface{}), false, d) + return } + fastpathTV.DecMapStringIntfV(rv2i(rv).(map[string]interface{}), false, d) } 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, d *Decoder) (_ map[string]interface{}, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 32) @@ -20301,7 +19067,7 @@ func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk string var mv interface{} hasLen := containerLen > 0 @@ -20314,8 +19080,7 @@ func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -20339,23 +19104,22 @@ func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, canChange bool, 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 { - fastpathTV.DecMapStringStringV(rv2i(rv).(map[string]string), false, d) + return } + fastpathTV.DecMapStringStringV(rv2i(rv).(map[string]string), false, d) } 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, d *Decoder) (_ map[string]string, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 32) @@ -20366,6 +19130,7 @@ func (_ fastpathT) DecMapStringStringV(v map[string]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv string hasLen := containerLen > 0 @@ -20378,8 +19143,7 @@ func (_ fastpathT) DecMapStringStringV(v map[string]string, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -20398,23 +19162,22 @@ func (_ fastpathT) DecMapStringStringV(v map[string]string, canChange bool, 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 { - fastpathTV.DecMapStringUintV(rv2i(rv).(map[string]uint), false, d) + return } + fastpathTV.DecMapStringUintV(rv2i(rv).(map[string]uint), false, d) } 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, d *Decoder) (_ map[string]uint, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -20425,6 +19188,7 @@ func (_ fastpathT) DecMapStringUintV(v map[string]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv uint hasLen := containerLen > 0 @@ -20437,15 +19201,14 @@ func (_ fastpathT) DecMapStringUintV(v map[string]uint, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -20457,23 +19220,22 @@ func (_ fastpathT) DecMapStringUintV(v map[string]uint, canChange bool, 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 { - fastpathTV.DecMapStringUint8V(rv2i(rv).(map[string]uint8), false, d) + return } + fastpathTV.DecMapStringUint8V(rv2i(rv).(map[string]uint8), false, d) } 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, d *Decoder) (_ map[string]uint8, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) @@ -20484,6 +19246,7 @@ func (_ fastpathT) DecMapStringUint8V(v map[string]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv uint8 hasLen := containerLen > 0 @@ -20496,15 +19259,14 @@ func (_ fastpathT) DecMapStringUint8V(v map[string]uint8, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -20516,23 +19278,22 @@ func (_ fastpathT) DecMapStringUint8V(v map[string]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapStringUint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapStringUint16V(rv2i(rv).(map[string]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapStringUint16V(*vp, true, d); 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) @@ -20543,6 +19304,7 @@ func (_ fastpathT) DecMapStringUint16V(v map[string]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv uint16 hasLen := containerLen > 0 @@ -20555,15 +19317,14 @@ func (_ fastpathT) DecMapStringUint16V(v map[string]uint16, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -20575,23 +19336,22 @@ func (_ fastpathT) DecMapStringUint16V(v map[string]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapStringUint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapStringUint32V(rv2i(rv).(map[string]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapStringUint32V(*vp, true, d); 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) @@ -20602,6 +19362,7 @@ func (_ fastpathT) DecMapStringUint32V(v map[string]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv uint32 hasLen := containerLen > 0 @@ -20614,15 +19375,14 @@ func (_ fastpathT) DecMapStringUint32V(v map[string]uint32, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -20634,23 +19394,22 @@ func (_ fastpathT) DecMapStringUint32V(v map[string]uint32, canChange bool, 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 { - fastpathTV.DecMapStringUint64V(rv2i(rv).(map[string]uint64), false, d) + return } + fastpathTV.DecMapStringUint64V(rv2i(rv).(map[string]uint64), false, d) } 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, d *Decoder) (_ map[string]uint64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -20661,6 +19420,7 @@ func (_ fastpathT) DecMapStringUint64V(v map[string]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv uint64 hasLen := containerLen > 0 @@ -20673,15 +19433,14 @@ func (_ fastpathT) DecMapStringUint64V(v map[string]uint64, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -20693,23 +19452,22 @@ func (_ fastpathT) DecMapStringUint64V(v map[string]uint64, canChange bool, 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 { - fastpathTV.DecMapStringUintptrV(rv2i(rv).(map[string]uintptr), false, d) + return } + fastpathTV.DecMapStringUintptrV(rv2i(rv).(map[string]uintptr), false, d) } 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, d *Decoder) (_ map[string]uintptr, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -20720,6 +19478,7 @@ func (_ fastpathT) DecMapStringUintptrV(v map[string]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv uintptr hasLen := containerLen > 0 @@ -20732,15 +19491,14 @@ func (_ fastpathT) DecMapStringUintptrV(v map[string]uintptr, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -20752,23 +19510,22 @@ func (_ fastpathT) DecMapStringUintptrV(v map[string]uintptr, canChange bool, 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 { - fastpathTV.DecMapStringIntV(rv2i(rv).(map[string]int), false, d) + return } + fastpathTV.DecMapStringIntV(rv2i(rv).(map[string]int), false, d) } 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, d *Decoder) (_ map[string]int, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -20779,6 +19536,7 @@ func (_ fastpathT) DecMapStringIntV(v map[string]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv int hasLen := containerLen > 0 @@ -20791,15 +19549,14 @@ func (_ fastpathT) DecMapStringIntV(v map[string]int, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -20811,23 +19568,22 @@ func (_ fastpathT) DecMapStringIntV(v map[string]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapStringInt8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapStringInt8V(rv2i(rv).(map[string]int8), false, d) + return } + 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 { + if v, changed := f.DecMapStringInt8V(*vp, true, d); 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) @@ -20838,6 +19594,7 @@ func (_ fastpathT) DecMapStringInt8V(v map[string]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv int8 hasLen := containerLen > 0 @@ -20850,15 +19607,14 @@ func (_ fastpathT) DecMapStringInt8V(v map[string]int8, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -20870,23 +19626,22 @@ func (_ fastpathT) DecMapStringInt8V(v map[string]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapStringInt16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapStringInt16V(rv2i(rv).(map[string]int16), false, d) + return } + 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 { + if v, changed := f.DecMapStringInt16V(*vp, true, d); 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) @@ -20897,6 +19652,7 @@ func (_ fastpathT) DecMapStringInt16V(v map[string]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv int16 hasLen := containerLen > 0 @@ -20909,15 +19665,14 @@ func (_ fastpathT) DecMapStringInt16V(v map[string]int16, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -20929,23 +19684,22 @@ func (_ fastpathT) DecMapStringInt16V(v map[string]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapStringInt32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapStringInt32V(rv2i(rv).(map[string]int32), false, d) + return } + 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 { + if v, changed := f.DecMapStringInt32V(*vp, true, d); 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) @@ -20956,6 +19710,7 @@ func (_ fastpathT) DecMapStringInt32V(v map[string]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv int32 hasLen := containerLen > 0 @@ -20968,15 +19723,14 @@ func (_ fastpathT) DecMapStringInt32V(v map[string]int32, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -20988,23 +19742,22 @@ func (_ fastpathT) DecMapStringInt32V(v map[string]int32, canChange bool, 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 { - fastpathTV.DecMapStringInt64V(rv2i(rv).(map[string]int64), false, d) + return } + fastpathTV.DecMapStringInt64V(rv2i(rv).(map[string]int64), false, d) } 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, d *Decoder) (_ map[string]int64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -21015,6 +19768,7 @@ func (_ fastpathT) DecMapStringInt64V(v map[string]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv int64 hasLen := containerLen > 0 @@ -21027,15 +19781,14 @@ func (_ fastpathT) DecMapStringInt64V(v map[string]int64, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -21047,23 +19800,22 @@ func (_ fastpathT) DecMapStringInt64V(v map[string]int64, canChange bool, 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 { - fastpathTV.DecMapStringFloat32V(rv2i(rv).(map[string]float32), false, d) + return } + fastpathTV.DecMapStringFloat32V(rv2i(rv).(map[string]float32), false, d) } 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, d *Decoder) (_ map[string]float32, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) @@ -21074,6 +19826,7 @@ func (_ fastpathT) DecMapStringFloat32V(v map[string]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv float32 hasLen := containerLen > 0 @@ -21086,15 +19839,14 @@ func (_ fastpathT) DecMapStringFloat32V(v map[string]float32, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -21106,23 +19858,22 @@ func (_ fastpathT) DecMapStringFloat32V(v map[string]float32, canChange bool, 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 { - fastpathTV.DecMapStringFloat64V(rv2i(rv).(map[string]float64), false, d) + return } + fastpathTV.DecMapStringFloat64V(rv2i(rv).(map[string]float64), false, d) } 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, d *Decoder) (_ map[string]float64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -21133,6 +19884,7 @@ func (_ fastpathT) DecMapStringFloat64V(v map[string]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv float64 hasLen := containerLen > 0 @@ -21145,15 +19897,14 @@ func (_ fastpathT) DecMapStringFloat64V(v map[string]float64, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -21165,23 +19916,22 @@ func (_ fastpathT) DecMapStringFloat64V(v map[string]float64, canChange bool, 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 { - fastpathTV.DecMapStringBoolV(rv2i(rv).(map[string]bool), false, d) + return } + fastpathTV.DecMapStringBoolV(rv2i(rv).(map[string]bool), false, d) } 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, d *Decoder) (_ map[string]bool, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) @@ -21192,6 +19942,7 @@ func (_ fastpathT) DecMapStringBoolV(v map[string]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk string var mv bool hasLen := containerLen > 0 @@ -21204,8 +19955,7 @@ func (_ fastpathT) DecMapStringBoolV(v map[string]bool, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -21224,23 +19974,22 @@ func (_ fastpathT) DecMapStringBoolV(v map[string]bool, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32IntfV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32IntfV(rv2i(rv).(map[float32]interface{}), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32IntfV(*vp, true, d); 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) @@ -21251,7 +20000,7 @@ func (_ fastpathT) DecMapFloat32IntfV(v map[float32]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk float32 var mv interface{} hasLen := containerLen > 0 @@ -21259,13 +20008,12 @@ func (_ fastpathT) DecMapFloat32IntfV(v map[float32]interface{}, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -21289,23 +20037,22 @@ func (_ fastpathT) DecMapFloat32IntfV(v map[float32]interface{}, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32StringV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32StringV(rv2i(rv).(map[float32]string), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32StringV(*vp, true, d); 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) @@ -21316,6 +20063,7 @@ func (_ fastpathT) DecMapFloat32StringV(v map[float32]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv string hasLen := containerLen > 0 @@ -21323,13 +20071,12 @@ func (_ fastpathT) DecMapFloat32StringV(v map[float32]string, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -21348,23 +20095,22 @@ func (_ fastpathT) DecMapFloat32StringV(v map[float32]string, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32UintV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32UintV(rv2i(rv).(map[float32]uint), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32UintV(*vp, true, d); 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) @@ -21375,6 +20121,7 @@ func (_ fastpathT) DecMapFloat32UintV(v map[float32]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv uint hasLen := containerLen > 0 @@ -21382,20 +20129,19 @@ func (_ fastpathT) DecMapFloat32UintV(v map[float32]uint, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -21407,23 +20153,22 @@ func (_ fastpathT) DecMapFloat32UintV(v map[float32]uint, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32Uint8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32Uint8V(rv2i(rv).(map[float32]uint8), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32Uint8V(*vp, true, d); 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) @@ -21434,6 +20179,7 @@ func (_ fastpathT) DecMapFloat32Uint8V(v map[float32]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv uint8 hasLen := containerLen > 0 @@ -21441,20 +20187,19 @@ func (_ fastpathT) DecMapFloat32Uint8V(v map[float32]uint8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -21466,23 +20211,22 @@ func (_ fastpathT) DecMapFloat32Uint8V(v map[float32]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32Uint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32Uint16V(rv2i(rv).(map[float32]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32Uint16V(*vp, true, d); 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) @@ -21493,6 +20237,7 @@ func (_ fastpathT) DecMapFloat32Uint16V(v map[float32]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv uint16 hasLen := containerLen > 0 @@ -21500,20 +20245,19 @@ func (_ fastpathT) DecMapFloat32Uint16V(v map[float32]uint16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -21525,23 +20269,22 @@ func (_ fastpathT) DecMapFloat32Uint16V(v map[float32]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32Uint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32Uint32V(rv2i(rv).(map[float32]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32Uint32V(*vp, true, d); 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) @@ -21552,6 +20295,7 @@ func (_ fastpathT) DecMapFloat32Uint32V(v map[float32]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv uint32 hasLen := containerLen > 0 @@ -21559,20 +20303,19 @@ func (_ fastpathT) DecMapFloat32Uint32V(v map[float32]uint32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -21584,23 +20327,22 @@ func (_ fastpathT) DecMapFloat32Uint32V(v map[float32]uint32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32Uint64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32Uint64V(rv2i(rv).(map[float32]uint64), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32Uint64V(*vp, true, d); 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) @@ -21611,6 +20353,7 @@ func (_ fastpathT) DecMapFloat32Uint64V(v map[float32]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv uint64 hasLen := containerLen > 0 @@ -21618,20 +20361,19 @@ func (_ fastpathT) DecMapFloat32Uint64V(v map[float32]uint64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -21643,23 +20385,22 @@ func (_ fastpathT) DecMapFloat32Uint64V(v map[float32]uint64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32UintptrV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32UintptrV(rv2i(rv).(map[float32]uintptr), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32UintptrV(*vp, true, d); 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) @@ -21670,6 +20411,7 @@ func (_ fastpathT) DecMapFloat32UintptrV(v map[float32]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv uintptr hasLen := containerLen > 0 @@ -21677,20 +20419,19 @@ func (_ fastpathT) DecMapFloat32UintptrV(v map[float32]uintptr, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -21702,23 +20443,22 @@ func (_ fastpathT) DecMapFloat32UintptrV(v map[float32]uintptr, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32IntV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32IntV(rv2i(rv).(map[float32]int), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32IntV(*vp, true, d); 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) @@ -21729,6 +20469,7 @@ func (_ fastpathT) DecMapFloat32IntV(v map[float32]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv int hasLen := containerLen > 0 @@ -21736,20 +20477,19 @@ func (_ fastpathT) DecMapFloat32IntV(v map[float32]int, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -21761,23 +20501,22 @@ func (_ fastpathT) DecMapFloat32IntV(v map[float32]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32Int8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32Int8V(rv2i(rv).(map[float32]int8), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32Int8V(*vp, true, d); 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) @@ -21788,6 +20527,7 @@ func (_ fastpathT) DecMapFloat32Int8V(v map[float32]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv int8 hasLen := containerLen > 0 @@ -21795,20 +20535,19 @@ func (_ fastpathT) DecMapFloat32Int8V(v map[float32]int8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -21820,23 +20559,22 @@ func (_ fastpathT) DecMapFloat32Int8V(v map[float32]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32Int16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32Int16V(rv2i(rv).(map[float32]int16), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32Int16V(*vp, true, d); 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) @@ -21847,6 +20585,7 @@ func (_ fastpathT) DecMapFloat32Int16V(v map[float32]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv int16 hasLen := containerLen > 0 @@ -21854,20 +20593,19 @@ func (_ fastpathT) DecMapFloat32Int16V(v map[float32]int16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -21879,23 +20617,22 @@ func (_ fastpathT) DecMapFloat32Int16V(v map[float32]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32Int32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32Int32V(rv2i(rv).(map[float32]int32), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32Int32V(*vp, true, d); 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) @@ -21906,6 +20643,7 @@ func (_ fastpathT) DecMapFloat32Int32V(v map[float32]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv int32 hasLen := containerLen > 0 @@ -21913,20 +20651,19 @@ func (_ fastpathT) DecMapFloat32Int32V(v map[float32]int32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -21938,23 +20675,22 @@ func (_ fastpathT) DecMapFloat32Int32V(v map[float32]int32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32Int64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32Int64V(rv2i(rv).(map[float32]int64), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32Int64V(*vp, true, d); 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) @@ -21965,6 +20701,7 @@ func (_ fastpathT) DecMapFloat32Int64V(v map[float32]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv int64 hasLen := containerLen > 0 @@ -21972,20 +20709,19 @@ func (_ fastpathT) DecMapFloat32Int64V(v map[float32]int64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -21997,23 +20733,22 @@ func (_ fastpathT) DecMapFloat32Int64V(v map[float32]int64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32Float32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32Float32V(rv2i(rv).(map[float32]float32), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32Float32V(*vp, true, d); 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) @@ -22024,6 +20759,7 @@ func (_ fastpathT) DecMapFloat32Float32V(v map[float32]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv float32 hasLen := containerLen > 0 @@ -22031,20 +20767,19 @@ func (_ fastpathT) DecMapFloat32Float32V(v map[float32]float32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -22056,23 +20791,22 @@ func (_ fastpathT) DecMapFloat32Float32V(v map[float32]float32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32Float64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32Float64V(rv2i(rv).(map[float32]float64), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32Float64V(*vp, true, d); 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) @@ -22083,6 +20817,7 @@ func (_ fastpathT) DecMapFloat32Float64V(v map[float32]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv float64 hasLen := containerLen > 0 @@ -22090,20 +20825,19 @@ func (_ fastpathT) DecMapFloat32Float64V(v map[float32]float64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -22115,23 +20849,22 @@ func (_ fastpathT) DecMapFloat32Float64V(v map[float32]float64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat32BoolV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat32BoolV(rv2i(rv).(map[float32]bool), false, d) + return } + 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 { + if v, changed := f.DecMapFloat32BoolV(*vp, true, d); 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) @@ -22142,6 +20875,7 @@ func (_ fastpathT) DecMapFloat32BoolV(v map[float32]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float32 var mv bool hasLen := containerLen > 0 @@ -22149,13 +20883,12 @@ func (_ fastpathT) DecMapFloat32BoolV(v map[float32]bool, canChange bool, if esep { dd.ReadMapElemKey() } - mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mk = float32(dd.DecodeFloat(true)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -22174,23 +20907,22 @@ func (_ fastpathT) DecMapFloat32BoolV(v map[float32]bool, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64IntfV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64IntfV(rv2i(rv).(map[float64]interface{}), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64IntfV(*vp, true, d); 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) @@ -22201,7 +20933,7 @@ func (_ fastpathT) DecMapFloat64IntfV(v map[float64]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk float64 var mv interface{} hasLen := containerLen > 0 @@ -22209,13 +20941,12 @@ func (_ fastpathT) DecMapFloat64IntfV(v map[float64]interface{}, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -22239,23 +20970,22 @@ func (_ fastpathT) DecMapFloat64IntfV(v map[float64]interface{}, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64StringV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64StringV(rv2i(rv).(map[float64]string), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64StringV(*vp, true, d); 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) @@ -22266,6 +20996,7 @@ func (_ fastpathT) DecMapFloat64StringV(v map[float64]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv string hasLen := containerLen > 0 @@ -22273,13 +21004,12 @@ func (_ fastpathT) DecMapFloat64StringV(v map[float64]string, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -22298,23 +21028,22 @@ func (_ fastpathT) DecMapFloat64StringV(v map[float64]string, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64UintV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64UintV(rv2i(rv).(map[float64]uint), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64UintV(*vp, true, d); 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) @@ -22325,6 +21054,7 @@ func (_ fastpathT) DecMapFloat64UintV(v map[float64]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv uint hasLen := containerLen > 0 @@ -22332,20 +21062,19 @@ func (_ fastpathT) DecMapFloat64UintV(v map[float64]uint, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -22357,23 +21086,22 @@ func (_ fastpathT) DecMapFloat64UintV(v map[float64]uint, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64Uint8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64Uint8V(rv2i(rv).(map[float64]uint8), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64Uint8V(*vp, true, d); 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) @@ -22384,6 +21112,7 @@ func (_ fastpathT) DecMapFloat64Uint8V(v map[float64]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv uint8 hasLen := containerLen > 0 @@ -22391,20 +21120,19 @@ func (_ fastpathT) DecMapFloat64Uint8V(v map[float64]uint8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -22416,23 +21144,22 @@ func (_ fastpathT) DecMapFloat64Uint8V(v map[float64]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64Uint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64Uint16V(rv2i(rv).(map[float64]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64Uint16V(*vp, true, d); 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) @@ -22443,6 +21170,7 @@ func (_ fastpathT) DecMapFloat64Uint16V(v map[float64]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv uint16 hasLen := containerLen > 0 @@ -22450,20 +21178,19 @@ func (_ fastpathT) DecMapFloat64Uint16V(v map[float64]uint16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -22475,23 +21202,22 @@ func (_ fastpathT) DecMapFloat64Uint16V(v map[float64]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64Uint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64Uint32V(rv2i(rv).(map[float64]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64Uint32V(*vp, true, d); 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) @@ -22502,6 +21228,7 @@ func (_ fastpathT) DecMapFloat64Uint32V(v map[float64]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv uint32 hasLen := containerLen > 0 @@ -22509,20 +21236,19 @@ func (_ fastpathT) DecMapFloat64Uint32V(v map[float64]uint32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -22534,23 +21260,22 @@ func (_ fastpathT) DecMapFloat64Uint32V(v map[float64]uint32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64Uint64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64Uint64V(rv2i(rv).(map[float64]uint64), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64Uint64V(*vp, true, d); 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) @@ -22561,6 +21286,7 @@ func (_ fastpathT) DecMapFloat64Uint64V(v map[float64]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv uint64 hasLen := containerLen > 0 @@ -22568,20 +21294,19 @@ func (_ fastpathT) DecMapFloat64Uint64V(v map[float64]uint64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -22593,23 +21318,22 @@ func (_ fastpathT) DecMapFloat64Uint64V(v map[float64]uint64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64UintptrV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64UintptrV(rv2i(rv).(map[float64]uintptr), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64UintptrV(*vp, true, d); 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) @@ -22620,6 +21344,7 @@ func (_ fastpathT) DecMapFloat64UintptrV(v map[float64]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv uintptr hasLen := containerLen > 0 @@ -22627,20 +21352,19 @@ func (_ fastpathT) DecMapFloat64UintptrV(v map[float64]uintptr, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -22652,23 +21376,22 @@ func (_ fastpathT) DecMapFloat64UintptrV(v map[float64]uintptr, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64IntV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64IntV(rv2i(rv).(map[float64]int), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64IntV(*vp, true, d); 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) @@ -22679,6 +21402,7 @@ func (_ fastpathT) DecMapFloat64IntV(v map[float64]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv int hasLen := containerLen > 0 @@ -22686,20 +21410,19 @@ func (_ fastpathT) DecMapFloat64IntV(v map[float64]int, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -22711,23 +21434,22 @@ func (_ fastpathT) DecMapFloat64IntV(v map[float64]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64Int8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64Int8V(rv2i(rv).(map[float64]int8), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64Int8V(*vp, true, d); 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) @@ -22738,6 +21460,7 @@ func (_ fastpathT) DecMapFloat64Int8V(v map[float64]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv int8 hasLen := containerLen > 0 @@ -22745,20 +21468,19 @@ func (_ fastpathT) DecMapFloat64Int8V(v map[float64]int8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -22770,23 +21492,22 @@ func (_ fastpathT) DecMapFloat64Int8V(v map[float64]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64Int16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64Int16V(rv2i(rv).(map[float64]int16), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64Int16V(*vp, true, d); 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) @@ -22797,6 +21518,7 @@ func (_ fastpathT) DecMapFloat64Int16V(v map[float64]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv int16 hasLen := containerLen > 0 @@ -22804,20 +21526,19 @@ func (_ fastpathT) DecMapFloat64Int16V(v map[float64]int16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -22829,23 +21550,22 @@ func (_ fastpathT) DecMapFloat64Int16V(v map[float64]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64Int32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64Int32V(rv2i(rv).(map[float64]int32), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64Int32V(*vp, true, d); 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) @@ -22856,6 +21576,7 @@ func (_ fastpathT) DecMapFloat64Int32V(v map[float64]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv int32 hasLen := containerLen > 0 @@ -22863,20 +21584,19 @@ func (_ fastpathT) DecMapFloat64Int32V(v map[float64]int32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -22888,23 +21608,22 @@ func (_ fastpathT) DecMapFloat64Int32V(v map[float64]int32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64Int64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64Int64V(rv2i(rv).(map[float64]int64), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64Int64V(*vp, true, d); 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) @@ -22915,6 +21634,7 @@ func (_ fastpathT) DecMapFloat64Int64V(v map[float64]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv int64 hasLen := containerLen > 0 @@ -22922,20 +21642,19 @@ func (_ fastpathT) DecMapFloat64Int64V(v map[float64]int64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -22947,23 +21666,22 @@ func (_ fastpathT) DecMapFloat64Int64V(v map[float64]int64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64Float32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64Float32V(rv2i(rv).(map[float64]float32), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64Float32V(*vp, true, d); 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) @@ -22974,6 +21692,7 @@ func (_ fastpathT) DecMapFloat64Float32V(v map[float64]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv float32 hasLen := containerLen > 0 @@ -22981,20 +21700,19 @@ func (_ fastpathT) DecMapFloat64Float32V(v map[float64]float32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -23006,23 +21724,22 @@ func (_ fastpathT) DecMapFloat64Float32V(v map[float64]float32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64Float64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64Float64V(rv2i(rv).(map[float64]float64), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64Float64V(*vp, true, d); 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) @@ -23033,6 +21750,7 @@ func (_ fastpathT) DecMapFloat64Float64V(v map[float64]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv float64 hasLen := containerLen > 0 @@ -23040,20 +21758,19 @@ func (_ fastpathT) DecMapFloat64Float64V(v map[float64]float64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -23065,23 +21782,22 @@ func (_ fastpathT) DecMapFloat64Float64V(v map[float64]float64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapFloat64BoolV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapFloat64BoolV(rv2i(rv).(map[float64]bool), false, d) + return } + 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 { + if v, changed := f.DecMapFloat64BoolV(*vp, true, d); 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) @@ -23092,6 +21808,7 @@ func (_ fastpathT) DecMapFloat64BoolV(v map[float64]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk float64 var mv bool hasLen := containerLen > 0 @@ -23099,13 +21816,12 @@ func (_ fastpathT) DecMapFloat64BoolV(v map[float64]bool, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeFloat64() + mk = dd.DecodeFloat(false) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -23124,23 +21840,22 @@ func (_ fastpathT) DecMapFloat64BoolV(v map[float64]bool, canChange bool, 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 { - fastpathTV.DecMapUintIntfV(rv2i(rv).(map[uint]interface{}), false, d) + return } + fastpathTV.DecMapUintIntfV(rv2i(rv).(map[uint]interface{}), false, d) } 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, d *Decoder) (_ map[uint]interface{}, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -23151,7 +21866,7 @@ func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk uint var mv interface{} hasLen := containerLen > 0 @@ -23159,13 +21874,12 @@ func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -23189,23 +21903,22 @@ func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, canChange bool, 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 { - fastpathTV.DecMapUintStringV(rv2i(rv).(map[uint]string), false, d) + return } + fastpathTV.DecMapUintStringV(rv2i(rv).(map[uint]string), false, d) } 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, d *Decoder) (_ map[uint]string, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -23216,6 +21929,7 @@ func (_ fastpathT) DecMapUintStringV(v map[uint]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv string hasLen := containerLen > 0 @@ -23223,13 +21937,12 @@ func (_ fastpathT) DecMapUintStringV(v map[uint]string, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -23248,23 +21961,22 @@ func (_ fastpathT) DecMapUintStringV(v map[uint]string, canChange bool, 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 { - fastpathTV.DecMapUintUintV(rv2i(rv).(map[uint]uint), false, d) + return } + fastpathTV.DecMapUintUintV(rv2i(rv).(map[uint]uint), false, d) } 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, d *Decoder) (_ map[uint]uint, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -23275,6 +21987,7 @@ func (_ fastpathT) DecMapUintUintV(v map[uint]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv uint hasLen := containerLen > 0 @@ -23282,20 +21995,19 @@ func (_ fastpathT) DecMapUintUintV(v map[uint]uint, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -23307,23 +22019,22 @@ func (_ fastpathT) DecMapUintUintV(v map[uint]uint, canChange bool, 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 { - fastpathTV.DecMapUintUint8V(rv2i(rv).(map[uint]uint8), false, d) + return } + fastpathTV.DecMapUintUint8V(rv2i(rv).(map[uint]uint8), false, d) } 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, d *Decoder) (_ map[uint]uint8, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -23334,6 +22045,7 @@ func (_ fastpathT) DecMapUintUint8V(v map[uint]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv uint8 hasLen := containerLen > 0 @@ -23341,20 +22053,19 @@ func (_ fastpathT) DecMapUintUint8V(v map[uint]uint8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -23366,23 +22077,22 @@ func (_ fastpathT) DecMapUintUint8V(v map[uint]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintUint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintUint16V(rv2i(rv).(map[uint]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapUintUint16V(*vp, true, d); 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) @@ -23393,6 +22103,7 @@ func (_ fastpathT) DecMapUintUint16V(v map[uint]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv uint16 hasLen := containerLen > 0 @@ -23400,20 +22111,19 @@ func (_ fastpathT) DecMapUintUint16V(v map[uint]uint16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -23425,23 +22135,22 @@ func (_ fastpathT) DecMapUintUint16V(v map[uint]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintUint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintUint32V(rv2i(rv).(map[uint]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapUintUint32V(*vp, true, d); 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) @@ -23452,6 +22161,7 @@ func (_ fastpathT) DecMapUintUint32V(v map[uint]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv uint32 hasLen := containerLen > 0 @@ -23459,20 +22169,19 @@ func (_ fastpathT) DecMapUintUint32V(v map[uint]uint32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -23484,23 +22193,22 @@ func (_ fastpathT) DecMapUintUint32V(v map[uint]uint32, canChange bool, 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 { - fastpathTV.DecMapUintUint64V(rv2i(rv).(map[uint]uint64), false, d) + return } + fastpathTV.DecMapUintUint64V(rv2i(rv).(map[uint]uint64), false, d) } 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, d *Decoder) (_ map[uint]uint64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -23511,6 +22219,7 @@ func (_ fastpathT) DecMapUintUint64V(v map[uint]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv uint64 hasLen := containerLen > 0 @@ -23518,20 +22227,19 @@ func (_ fastpathT) DecMapUintUint64V(v map[uint]uint64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -23543,23 +22251,22 @@ func (_ fastpathT) DecMapUintUint64V(v map[uint]uint64, canChange bool, 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 { - fastpathTV.DecMapUintUintptrV(rv2i(rv).(map[uint]uintptr), false, d) + return } + fastpathTV.DecMapUintUintptrV(rv2i(rv).(map[uint]uintptr), false, d) } 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, d *Decoder) (_ map[uint]uintptr, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -23570,6 +22277,7 @@ func (_ fastpathT) DecMapUintUintptrV(v map[uint]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv uintptr hasLen := containerLen > 0 @@ -23577,20 +22285,19 @@ func (_ fastpathT) DecMapUintUintptrV(v map[uint]uintptr, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -23602,23 +22309,22 @@ func (_ fastpathT) DecMapUintUintptrV(v map[uint]uintptr, canChange bool, 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 { - fastpathTV.DecMapUintIntV(rv2i(rv).(map[uint]int), false, d) + return } + fastpathTV.DecMapUintIntV(rv2i(rv).(map[uint]int), false, d) } 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, d *Decoder) (_ map[uint]int, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -23629,6 +22335,7 @@ func (_ fastpathT) DecMapUintIntV(v map[uint]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv int hasLen := containerLen > 0 @@ -23636,20 +22343,19 @@ func (_ fastpathT) DecMapUintIntV(v map[uint]int, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -23661,23 +22367,22 @@ func (_ fastpathT) DecMapUintIntV(v map[uint]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintInt8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintInt8V(rv2i(rv).(map[uint]int8), false, d) + return } + 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 { + if v, changed := f.DecMapUintInt8V(*vp, true, d); 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) @@ -23688,6 +22393,7 @@ func (_ fastpathT) DecMapUintInt8V(v map[uint]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv int8 hasLen := containerLen > 0 @@ -23695,20 +22401,19 @@ func (_ fastpathT) DecMapUintInt8V(v map[uint]int8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -23720,23 +22425,22 @@ func (_ fastpathT) DecMapUintInt8V(v map[uint]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintInt16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintInt16V(rv2i(rv).(map[uint]int16), false, d) + return } + 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 { + if v, changed := f.DecMapUintInt16V(*vp, true, d); 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) @@ -23747,6 +22451,7 @@ func (_ fastpathT) DecMapUintInt16V(v map[uint]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv int16 hasLen := containerLen > 0 @@ -23754,20 +22459,19 @@ func (_ fastpathT) DecMapUintInt16V(v map[uint]int16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -23779,23 +22483,22 @@ func (_ fastpathT) DecMapUintInt16V(v map[uint]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintInt32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintInt32V(rv2i(rv).(map[uint]int32), false, d) + return } + 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 { + if v, changed := f.DecMapUintInt32V(*vp, true, d); 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) @@ -23806,6 +22509,7 @@ func (_ fastpathT) DecMapUintInt32V(v map[uint]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv int32 hasLen := containerLen > 0 @@ -23813,20 +22517,19 @@ func (_ fastpathT) DecMapUintInt32V(v map[uint]int32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -23838,23 +22541,22 @@ func (_ fastpathT) DecMapUintInt32V(v map[uint]int32, canChange bool, 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 { - fastpathTV.DecMapUintInt64V(rv2i(rv).(map[uint]int64), false, d) + return } + fastpathTV.DecMapUintInt64V(rv2i(rv).(map[uint]int64), false, d) } 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, d *Decoder) (_ map[uint]int64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -23865,6 +22567,7 @@ func (_ fastpathT) DecMapUintInt64V(v map[uint]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv int64 hasLen := containerLen > 0 @@ -23872,20 +22575,19 @@ func (_ fastpathT) DecMapUintInt64V(v map[uint]int64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -23897,23 +22599,22 @@ func (_ fastpathT) DecMapUintInt64V(v map[uint]int64, canChange bool, 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 { - fastpathTV.DecMapUintFloat32V(rv2i(rv).(map[uint]float32), false, d) + return } + fastpathTV.DecMapUintFloat32V(rv2i(rv).(map[uint]float32), false, d) } 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, d *Decoder) (_ map[uint]float32, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) @@ -23924,6 +22625,7 @@ func (_ fastpathT) DecMapUintFloat32V(v map[uint]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv float32 hasLen := containerLen > 0 @@ -23931,20 +22633,19 @@ func (_ fastpathT) DecMapUintFloat32V(v map[uint]float32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -23956,23 +22657,22 @@ func (_ fastpathT) DecMapUintFloat32V(v map[uint]float32, canChange bool, 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 { - fastpathTV.DecMapUintFloat64V(rv2i(rv).(map[uint]float64), false, d) + return } + fastpathTV.DecMapUintFloat64V(rv2i(rv).(map[uint]float64), false, d) } 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, d *Decoder) (_ map[uint]float64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -23983,6 +22683,7 @@ func (_ fastpathT) DecMapUintFloat64V(v map[uint]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv float64 hasLen := containerLen > 0 @@ -23990,20 +22691,19 @@ func (_ fastpathT) DecMapUintFloat64V(v map[uint]float64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -24015,23 +22715,22 @@ func (_ fastpathT) DecMapUintFloat64V(v map[uint]float64, canChange bool, 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 { - fastpathTV.DecMapUintBoolV(rv2i(rv).(map[uint]bool), false, d) + return } + fastpathTV.DecMapUintBoolV(rv2i(rv).(map[uint]bool), false, d) } 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, d *Decoder) (_ map[uint]bool, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -24042,6 +22741,7 @@ func (_ fastpathT) DecMapUintBoolV(v map[uint]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint var mv bool hasLen := containerLen > 0 @@ -24049,13 +22749,12 @@ func (_ fastpathT) DecMapUintBoolV(v map[uint]bool, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uint(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -24074,23 +22773,22 @@ func (_ fastpathT) DecMapUintBoolV(v map[uint]bool, canChange bool, 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 { - fastpathTV.DecMapUint8IntfV(rv2i(rv).(map[uint8]interface{}), false, d) + return } + fastpathTV.DecMapUint8IntfV(rv2i(rv).(map[uint8]interface{}), false, d) } 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, d *Decoder) (_ map[uint8]interface{}, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) @@ -24101,7 +22799,7 @@ func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk uint8 var mv interface{} hasLen := containerLen > 0 @@ -24109,13 +22807,12 @@ func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -24139,23 +22836,22 @@ func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, canChange bool, 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 { - fastpathTV.DecMapUint8StringV(rv2i(rv).(map[uint8]string), false, d) + return } + fastpathTV.DecMapUint8StringV(rv2i(rv).(map[uint8]string), false, d) } 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, d *Decoder) (_ map[uint8]string, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) @@ -24166,6 +22862,7 @@ func (_ fastpathT) DecMapUint8StringV(v map[uint8]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv string hasLen := containerLen > 0 @@ -24173,13 +22870,12 @@ func (_ fastpathT) DecMapUint8StringV(v map[uint8]string, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -24198,23 +22894,22 @@ func (_ fastpathT) DecMapUint8StringV(v map[uint8]string, canChange bool, 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 { - fastpathTV.DecMapUint8UintV(rv2i(rv).(map[uint8]uint), false, d) + return } + fastpathTV.DecMapUint8UintV(rv2i(rv).(map[uint8]uint), false, d) } 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, d *Decoder) (_ map[uint8]uint, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -24225,6 +22920,7 @@ func (_ fastpathT) DecMapUint8UintV(v map[uint8]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv uint hasLen := containerLen > 0 @@ -24232,20 +22928,19 @@ func (_ fastpathT) DecMapUint8UintV(v map[uint8]uint, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -24257,23 +22952,22 @@ func (_ fastpathT) DecMapUint8UintV(v map[uint8]uint, canChange bool, 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 { - fastpathTV.DecMapUint8Uint8V(rv2i(rv).(map[uint8]uint8), false, d) + return } + fastpathTV.DecMapUint8Uint8V(rv2i(rv).(map[uint8]uint8), false, d) } 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, d *Decoder) (_ map[uint8]uint8, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) @@ -24284,6 +22978,7 @@ func (_ fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv uint8 hasLen := containerLen > 0 @@ -24291,20 +22986,19 @@ func (_ fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -24316,23 +23010,22 @@ func (_ fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint8Uint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint8Uint16V(rv2i(rv).(map[uint8]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapUint8Uint16V(*vp, true, d); 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) @@ -24343,6 +23036,7 @@ func (_ fastpathT) DecMapUint8Uint16V(v map[uint8]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv uint16 hasLen := containerLen > 0 @@ -24350,20 +23044,19 @@ func (_ fastpathT) DecMapUint8Uint16V(v map[uint8]uint16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -24375,23 +23068,22 @@ func (_ fastpathT) DecMapUint8Uint16V(v map[uint8]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint8Uint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint8Uint32V(rv2i(rv).(map[uint8]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapUint8Uint32V(*vp, true, d); 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) @@ -24402,6 +23094,7 @@ func (_ fastpathT) DecMapUint8Uint32V(v map[uint8]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv uint32 hasLen := containerLen > 0 @@ -24409,20 +23102,19 @@ func (_ fastpathT) DecMapUint8Uint32V(v map[uint8]uint32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -24434,23 +23126,22 @@ func (_ fastpathT) DecMapUint8Uint32V(v map[uint8]uint32, canChange bool, 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 { - fastpathTV.DecMapUint8Uint64V(rv2i(rv).(map[uint8]uint64), false, d) + return } + fastpathTV.DecMapUint8Uint64V(rv2i(rv).(map[uint8]uint64), false, d) } 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, d *Decoder) (_ map[uint8]uint64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -24461,6 +23152,7 @@ func (_ fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv uint64 hasLen := containerLen > 0 @@ -24468,20 +23160,19 @@ func (_ fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -24493,23 +23184,22 @@ func (_ fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, canChange bool, 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 { - fastpathTV.DecMapUint8UintptrV(rv2i(rv).(map[uint8]uintptr), false, d) + return } + fastpathTV.DecMapUint8UintptrV(rv2i(rv).(map[uint8]uintptr), false, d) } 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, d *Decoder) (_ map[uint8]uintptr, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -24520,6 +23210,7 @@ func (_ fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv uintptr hasLen := containerLen > 0 @@ -24527,20 +23218,19 @@ func (_ fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -24552,23 +23242,22 @@ func (_ fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, canChange bool, 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 { - fastpathTV.DecMapUint8IntV(rv2i(rv).(map[uint8]int), false, d) + return } + fastpathTV.DecMapUint8IntV(rv2i(rv).(map[uint8]int), false, d) } 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, d *Decoder) (_ map[uint8]int, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -24579,6 +23268,7 @@ func (_ fastpathT) DecMapUint8IntV(v map[uint8]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv int hasLen := containerLen > 0 @@ -24586,20 +23276,19 @@ func (_ fastpathT) DecMapUint8IntV(v map[uint8]int, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -24611,23 +23300,22 @@ func (_ fastpathT) DecMapUint8IntV(v map[uint8]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint8Int8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint8Int8V(rv2i(rv).(map[uint8]int8), false, d) + return } + 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 { + if v, changed := f.DecMapUint8Int8V(*vp, true, d); 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) @@ -24638,6 +23326,7 @@ func (_ fastpathT) DecMapUint8Int8V(v map[uint8]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv int8 hasLen := containerLen > 0 @@ -24645,20 +23334,19 @@ func (_ fastpathT) DecMapUint8Int8V(v map[uint8]int8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -24670,23 +23358,22 @@ func (_ fastpathT) DecMapUint8Int8V(v map[uint8]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint8Int16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint8Int16V(rv2i(rv).(map[uint8]int16), false, d) + return } + 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 { + if v, changed := f.DecMapUint8Int16V(*vp, true, d); 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) @@ -24697,6 +23384,7 @@ func (_ fastpathT) DecMapUint8Int16V(v map[uint8]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv int16 hasLen := containerLen > 0 @@ -24704,20 +23392,19 @@ func (_ fastpathT) DecMapUint8Int16V(v map[uint8]int16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -24729,23 +23416,22 @@ func (_ fastpathT) DecMapUint8Int16V(v map[uint8]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint8Int32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint8Int32V(rv2i(rv).(map[uint8]int32), false, d) + return } + 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 { + if v, changed := f.DecMapUint8Int32V(*vp, true, d); 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) @@ -24756,6 +23442,7 @@ func (_ fastpathT) DecMapUint8Int32V(v map[uint8]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv int32 hasLen := containerLen > 0 @@ -24763,20 +23450,19 @@ func (_ fastpathT) DecMapUint8Int32V(v map[uint8]int32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -24788,23 +23474,22 @@ func (_ fastpathT) DecMapUint8Int32V(v map[uint8]int32, canChange bool, 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 { - fastpathTV.DecMapUint8Int64V(rv2i(rv).(map[uint8]int64), false, d) + return } + fastpathTV.DecMapUint8Int64V(rv2i(rv).(map[uint8]int64), false, d) } 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, d *Decoder) (_ map[uint8]int64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -24815,6 +23500,7 @@ func (_ fastpathT) DecMapUint8Int64V(v map[uint8]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv int64 hasLen := containerLen > 0 @@ -24822,20 +23508,19 @@ func (_ fastpathT) DecMapUint8Int64V(v map[uint8]int64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -24847,23 +23532,22 @@ func (_ fastpathT) DecMapUint8Int64V(v map[uint8]int64, canChange bool, 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 { - fastpathTV.DecMapUint8Float32V(rv2i(rv).(map[uint8]float32), false, d) + return } + fastpathTV.DecMapUint8Float32V(rv2i(rv).(map[uint8]float32), false, d) } 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, d *Decoder) (_ map[uint8]float32, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) @@ -24874,6 +23558,7 @@ func (_ fastpathT) DecMapUint8Float32V(v map[uint8]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv float32 hasLen := containerLen > 0 @@ -24881,20 +23566,19 @@ func (_ fastpathT) DecMapUint8Float32V(v map[uint8]float32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -24906,23 +23590,22 @@ func (_ fastpathT) DecMapUint8Float32V(v map[uint8]float32, canChange bool, 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 { - fastpathTV.DecMapUint8Float64V(rv2i(rv).(map[uint8]float64), false, d) + return } + fastpathTV.DecMapUint8Float64V(rv2i(rv).(map[uint8]float64), false, d) } 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, d *Decoder) (_ map[uint8]float64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -24933,6 +23616,7 @@ func (_ fastpathT) DecMapUint8Float64V(v map[uint8]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv float64 hasLen := containerLen > 0 @@ -24940,20 +23624,19 @@ func (_ fastpathT) DecMapUint8Float64V(v map[uint8]float64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -24965,23 +23648,22 @@ func (_ fastpathT) DecMapUint8Float64V(v map[uint8]float64, canChange bool, 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 { - fastpathTV.DecMapUint8BoolV(rv2i(rv).(map[uint8]bool), false, d) + return } + fastpathTV.DecMapUint8BoolV(rv2i(rv).(map[uint8]bool), false, d) } 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, d *Decoder) (_ map[uint8]bool, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) @@ -24992,6 +23674,7 @@ func (_ fastpathT) DecMapUint8BoolV(v map[uint8]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint8 var mv bool hasLen := containerLen > 0 @@ -24999,13 +23682,12 @@ func (_ fastpathT) DecMapUint8BoolV(v map[uint8]bool, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mk = uint8(dd.DecodeUint(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -25024,23 +23706,22 @@ func (_ fastpathT) DecMapUint8BoolV(v map[uint8]bool, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16IntfV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16IntfV(rv2i(rv).(map[uint16]interface{}), false, d) + return } + 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 { + if v, changed := f.DecMapUint16IntfV(*vp, true, d); 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) @@ -25051,7 +23732,7 @@ func (_ fastpathT) DecMapUint16IntfV(v map[uint16]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk uint16 var mv interface{} hasLen := containerLen > 0 @@ -25059,13 +23740,12 @@ func (_ fastpathT) DecMapUint16IntfV(v map[uint16]interface{}, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -25089,23 +23769,22 @@ func (_ fastpathT) DecMapUint16IntfV(v map[uint16]interface{}, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16StringV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16StringV(rv2i(rv).(map[uint16]string), false, d) + return } + 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 { + if v, changed := f.DecMapUint16StringV(*vp, true, d); 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) @@ -25116,6 +23795,7 @@ func (_ fastpathT) DecMapUint16StringV(v map[uint16]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv string hasLen := containerLen > 0 @@ -25123,13 +23803,12 @@ func (_ fastpathT) DecMapUint16StringV(v map[uint16]string, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -25148,23 +23827,22 @@ func (_ fastpathT) DecMapUint16StringV(v map[uint16]string, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16UintV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16UintV(rv2i(rv).(map[uint16]uint), false, d) + return } + 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 { + if v, changed := f.DecMapUint16UintV(*vp, true, d); 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) @@ -25175,6 +23853,7 @@ func (_ fastpathT) DecMapUint16UintV(v map[uint16]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv uint hasLen := containerLen > 0 @@ -25182,20 +23861,19 @@ func (_ fastpathT) DecMapUint16UintV(v map[uint16]uint, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -25207,23 +23885,22 @@ func (_ fastpathT) DecMapUint16UintV(v map[uint16]uint, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16Uint8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16Uint8V(rv2i(rv).(map[uint16]uint8), false, d) + return } + 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 { + if v, changed := f.DecMapUint16Uint8V(*vp, true, d); 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) @@ -25234,6 +23911,7 @@ func (_ fastpathT) DecMapUint16Uint8V(v map[uint16]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv uint8 hasLen := containerLen > 0 @@ -25241,20 +23919,19 @@ func (_ fastpathT) DecMapUint16Uint8V(v map[uint16]uint8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -25266,23 +23943,22 @@ func (_ fastpathT) DecMapUint16Uint8V(v map[uint16]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16Uint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16Uint16V(rv2i(rv).(map[uint16]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapUint16Uint16V(*vp, true, d); 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) @@ -25293,6 +23969,7 @@ func (_ fastpathT) DecMapUint16Uint16V(v map[uint16]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv uint16 hasLen := containerLen > 0 @@ -25300,20 +23977,19 @@ func (_ fastpathT) DecMapUint16Uint16V(v map[uint16]uint16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -25325,23 +24001,22 @@ func (_ fastpathT) DecMapUint16Uint16V(v map[uint16]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16Uint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16Uint32V(rv2i(rv).(map[uint16]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapUint16Uint32V(*vp, true, d); 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) @@ -25352,6 +24027,7 @@ func (_ fastpathT) DecMapUint16Uint32V(v map[uint16]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv uint32 hasLen := containerLen > 0 @@ -25359,20 +24035,19 @@ func (_ fastpathT) DecMapUint16Uint32V(v map[uint16]uint32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -25384,23 +24059,22 @@ func (_ fastpathT) DecMapUint16Uint32V(v map[uint16]uint32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16Uint64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16Uint64V(rv2i(rv).(map[uint16]uint64), false, d) + return } + 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 { + if v, changed := f.DecMapUint16Uint64V(*vp, true, d); 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) @@ -25411,6 +24085,7 @@ func (_ fastpathT) DecMapUint16Uint64V(v map[uint16]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv uint64 hasLen := containerLen > 0 @@ -25418,20 +24093,19 @@ func (_ fastpathT) DecMapUint16Uint64V(v map[uint16]uint64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -25443,23 +24117,22 @@ func (_ fastpathT) DecMapUint16Uint64V(v map[uint16]uint64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16UintptrV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16UintptrV(rv2i(rv).(map[uint16]uintptr), false, d) + return } + 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 { + if v, changed := f.DecMapUint16UintptrV(*vp, true, d); 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) @@ -25470,6 +24143,7 @@ func (_ fastpathT) DecMapUint16UintptrV(v map[uint16]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv uintptr hasLen := containerLen > 0 @@ -25477,20 +24151,19 @@ func (_ fastpathT) DecMapUint16UintptrV(v map[uint16]uintptr, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -25502,23 +24175,22 @@ func (_ fastpathT) DecMapUint16UintptrV(v map[uint16]uintptr, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16IntV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16IntV(rv2i(rv).(map[uint16]int), false, d) + return } + 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 { + if v, changed := f.DecMapUint16IntV(*vp, true, d); 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) @@ -25529,6 +24201,7 @@ func (_ fastpathT) DecMapUint16IntV(v map[uint16]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv int hasLen := containerLen > 0 @@ -25536,20 +24209,19 @@ func (_ fastpathT) DecMapUint16IntV(v map[uint16]int, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -25561,23 +24233,22 @@ func (_ fastpathT) DecMapUint16IntV(v map[uint16]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16Int8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16Int8V(rv2i(rv).(map[uint16]int8), false, d) + return } + 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 { + if v, changed := f.DecMapUint16Int8V(*vp, true, d); 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) @@ -25588,6 +24259,7 @@ func (_ fastpathT) DecMapUint16Int8V(v map[uint16]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv int8 hasLen := containerLen > 0 @@ -25595,20 +24267,19 @@ func (_ fastpathT) DecMapUint16Int8V(v map[uint16]int8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -25620,23 +24291,22 @@ func (_ fastpathT) DecMapUint16Int8V(v map[uint16]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16Int16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16Int16V(rv2i(rv).(map[uint16]int16), false, d) + return } + 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 { + if v, changed := f.DecMapUint16Int16V(*vp, true, d); 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) @@ -25647,6 +24317,7 @@ func (_ fastpathT) DecMapUint16Int16V(v map[uint16]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv int16 hasLen := containerLen > 0 @@ -25654,20 +24325,19 @@ func (_ fastpathT) DecMapUint16Int16V(v map[uint16]int16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -25679,23 +24349,22 @@ func (_ fastpathT) DecMapUint16Int16V(v map[uint16]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16Int32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16Int32V(rv2i(rv).(map[uint16]int32), false, d) + return } + 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 { + if v, changed := f.DecMapUint16Int32V(*vp, true, d); 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) @@ -25706,6 +24375,7 @@ func (_ fastpathT) DecMapUint16Int32V(v map[uint16]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv int32 hasLen := containerLen > 0 @@ -25713,20 +24383,19 @@ func (_ fastpathT) DecMapUint16Int32V(v map[uint16]int32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -25738,23 +24407,22 @@ func (_ fastpathT) DecMapUint16Int32V(v map[uint16]int32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16Int64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16Int64V(rv2i(rv).(map[uint16]int64), false, d) + return } + 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 { + if v, changed := f.DecMapUint16Int64V(*vp, true, d); 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) @@ -25765,6 +24433,7 @@ func (_ fastpathT) DecMapUint16Int64V(v map[uint16]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv int64 hasLen := containerLen > 0 @@ -25772,20 +24441,19 @@ func (_ fastpathT) DecMapUint16Int64V(v map[uint16]int64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -25797,23 +24465,22 @@ func (_ fastpathT) DecMapUint16Int64V(v map[uint16]int64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16Float32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16Float32V(rv2i(rv).(map[uint16]float32), false, d) + return } + 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 { + if v, changed := f.DecMapUint16Float32V(*vp, true, d); 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) @@ -25824,6 +24491,7 @@ func (_ fastpathT) DecMapUint16Float32V(v map[uint16]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv float32 hasLen := containerLen > 0 @@ -25831,20 +24499,19 @@ func (_ fastpathT) DecMapUint16Float32V(v map[uint16]float32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -25856,23 +24523,22 @@ func (_ fastpathT) DecMapUint16Float32V(v map[uint16]float32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16Float64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16Float64V(rv2i(rv).(map[uint16]float64), false, d) + return } + 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 { + if v, changed := f.DecMapUint16Float64V(*vp, true, d); 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) @@ -25883,6 +24549,7 @@ func (_ fastpathT) DecMapUint16Float64V(v map[uint16]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv float64 hasLen := containerLen > 0 @@ -25890,20 +24557,19 @@ func (_ fastpathT) DecMapUint16Float64V(v map[uint16]float64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -25915,23 +24581,22 @@ func (_ fastpathT) DecMapUint16Float64V(v map[uint16]float64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint16BoolV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint16BoolV(rv2i(rv).(map[uint16]bool), false, d) + return } + 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 { + if v, changed := f.DecMapUint16BoolV(*vp, true, d); 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) @@ -25942,6 +24607,7 @@ func (_ fastpathT) DecMapUint16BoolV(v map[uint16]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint16 var mv bool hasLen := containerLen > 0 @@ -25949,13 +24615,12 @@ func (_ fastpathT) DecMapUint16BoolV(v map[uint16]bool, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mk = uint16(dd.DecodeUint(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -25974,23 +24639,22 @@ func (_ fastpathT) DecMapUint16BoolV(v map[uint16]bool, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32IntfV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32IntfV(rv2i(rv).(map[uint32]interface{}), false, d) + return } + 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 { + if v, changed := f.DecMapUint32IntfV(*vp, true, d); 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) @@ -26001,7 +24665,7 @@ func (_ fastpathT) DecMapUint32IntfV(v map[uint32]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk uint32 var mv interface{} hasLen := containerLen > 0 @@ -26009,13 +24673,12 @@ func (_ fastpathT) DecMapUint32IntfV(v map[uint32]interface{}, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -26039,23 +24702,22 @@ func (_ fastpathT) DecMapUint32IntfV(v map[uint32]interface{}, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32StringV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32StringV(rv2i(rv).(map[uint32]string), false, d) + return } + 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 { + if v, changed := f.DecMapUint32StringV(*vp, true, d); 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) @@ -26066,6 +24728,7 @@ func (_ fastpathT) DecMapUint32StringV(v map[uint32]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv string hasLen := containerLen > 0 @@ -26073,13 +24736,12 @@ func (_ fastpathT) DecMapUint32StringV(v map[uint32]string, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -26098,23 +24760,22 @@ func (_ fastpathT) DecMapUint32StringV(v map[uint32]string, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32UintV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32UintV(rv2i(rv).(map[uint32]uint), false, d) + return } + 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 { + if v, changed := f.DecMapUint32UintV(*vp, true, d); 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) @@ -26125,6 +24786,7 @@ func (_ fastpathT) DecMapUint32UintV(v map[uint32]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv uint hasLen := containerLen > 0 @@ -26132,20 +24794,19 @@ func (_ fastpathT) DecMapUint32UintV(v map[uint32]uint, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -26157,23 +24818,22 @@ func (_ fastpathT) DecMapUint32UintV(v map[uint32]uint, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32Uint8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32Uint8V(rv2i(rv).(map[uint32]uint8), false, d) + return } + 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 { + if v, changed := f.DecMapUint32Uint8V(*vp, true, d); 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) @@ -26184,6 +24844,7 @@ func (_ fastpathT) DecMapUint32Uint8V(v map[uint32]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv uint8 hasLen := containerLen > 0 @@ -26191,20 +24852,19 @@ func (_ fastpathT) DecMapUint32Uint8V(v map[uint32]uint8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -26216,23 +24876,22 @@ func (_ fastpathT) DecMapUint32Uint8V(v map[uint32]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32Uint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32Uint16V(rv2i(rv).(map[uint32]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapUint32Uint16V(*vp, true, d); 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) @@ -26243,6 +24902,7 @@ func (_ fastpathT) DecMapUint32Uint16V(v map[uint32]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv uint16 hasLen := containerLen > 0 @@ -26250,20 +24910,19 @@ func (_ fastpathT) DecMapUint32Uint16V(v map[uint32]uint16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -26275,23 +24934,22 @@ func (_ fastpathT) DecMapUint32Uint16V(v map[uint32]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32Uint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32Uint32V(rv2i(rv).(map[uint32]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapUint32Uint32V(*vp, true, d); 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) @@ -26302,6 +24960,7 @@ func (_ fastpathT) DecMapUint32Uint32V(v map[uint32]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv uint32 hasLen := containerLen > 0 @@ -26309,20 +24968,19 @@ func (_ fastpathT) DecMapUint32Uint32V(v map[uint32]uint32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -26334,23 +24992,22 @@ func (_ fastpathT) DecMapUint32Uint32V(v map[uint32]uint32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32Uint64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32Uint64V(rv2i(rv).(map[uint32]uint64), false, d) + return } + 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 { + if v, changed := f.DecMapUint32Uint64V(*vp, true, d); 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) @@ -26361,6 +25018,7 @@ func (_ fastpathT) DecMapUint32Uint64V(v map[uint32]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv uint64 hasLen := containerLen > 0 @@ -26368,20 +25026,19 @@ func (_ fastpathT) DecMapUint32Uint64V(v map[uint32]uint64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -26393,23 +25050,22 @@ func (_ fastpathT) DecMapUint32Uint64V(v map[uint32]uint64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32UintptrV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32UintptrV(rv2i(rv).(map[uint32]uintptr), false, d) + return } + 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 { + if v, changed := f.DecMapUint32UintptrV(*vp, true, d); 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) @@ -26420,6 +25076,7 @@ func (_ fastpathT) DecMapUint32UintptrV(v map[uint32]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv uintptr hasLen := containerLen > 0 @@ -26427,20 +25084,19 @@ func (_ fastpathT) DecMapUint32UintptrV(v map[uint32]uintptr, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -26452,23 +25108,22 @@ func (_ fastpathT) DecMapUint32UintptrV(v map[uint32]uintptr, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32IntV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32IntV(rv2i(rv).(map[uint32]int), false, d) + return } + 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 { + if v, changed := f.DecMapUint32IntV(*vp, true, d); 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) @@ -26479,6 +25134,7 @@ func (_ fastpathT) DecMapUint32IntV(v map[uint32]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv int hasLen := containerLen > 0 @@ -26486,20 +25142,19 @@ func (_ fastpathT) DecMapUint32IntV(v map[uint32]int, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -26511,23 +25166,22 @@ func (_ fastpathT) DecMapUint32IntV(v map[uint32]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32Int8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32Int8V(rv2i(rv).(map[uint32]int8), false, d) + return } + 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 { + if v, changed := f.DecMapUint32Int8V(*vp, true, d); 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) @@ -26538,6 +25192,7 @@ func (_ fastpathT) DecMapUint32Int8V(v map[uint32]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv int8 hasLen := containerLen > 0 @@ -26545,20 +25200,19 @@ func (_ fastpathT) DecMapUint32Int8V(v map[uint32]int8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -26570,23 +25224,22 @@ func (_ fastpathT) DecMapUint32Int8V(v map[uint32]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32Int16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32Int16V(rv2i(rv).(map[uint32]int16), false, d) + return } + 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 { + if v, changed := f.DecMapUint32Int16V(*vp, true, d); 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) @@ -26597,6 +25250,7 @@ func (_ fastpathT) DecMapUint32Int16V(v map[uint32]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv int16 hasLen := containerLen > 0 @@ -26604,20 +25258,19 @@ func (_ fastpathT) DecMapUint32Int16V(v map[uint32]int16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -26629,23 +25282,22 @@ func (_ fastpathT) DecMapUint32Int16V(v map[uint32]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32Int32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32Int32V(rv2i(rv).(map[uint32]int32), false, d) + return } + 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 { + if v, changed := f.DecMapUint32Int32V(*vp, true, d); 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) @@ -26656,6 +25308,7 @@ func (_ fastpathT) DecMapUint32Int32V(v map[uint32]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv int32 hasLen := containerLen > 0 @@ -26663,20 +25316,19 @@ func (_ fastpathT) DecMapUint32Int32V(v map[uint32]int32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -26688,23 +25340,22 @@ func (_ fastpathT) DecMapUint32Int32V(v map[uint32]int32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32Int64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32Int64V(rv2i(rv).(map[uint32]int64), false, d) + return } + 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 { + if v, changed := f.DecMapUint32Int64V(*vp, true, d); 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) @@ -26715,6 +25366,7 @@ func (_ fastpathT) DecMapUint32Int64V(v map[uint32]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv int64 hasLen := containerLen > 0 @@ -26722,20 +25374,19 @@ func (_ fastpathT) DecMapUint32Int64V(v map[uint32]int64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -26747,23 +25398,22 @@ func (_ fastpathT) DecMapUint32Int64V(v map[uint32]int64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32Float32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32Float32V(rv2i(rv).(map[uint32]float32), false, d) + return } + 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 { + if v, changed := f.DecMapUint32Float32V(*vp, true, d); 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) @@ -26774,6 +25424,7 @@ func (_ fastpathT) DecMapUint32Float32V(v map[uint32]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv float32 hasLen := containerLen > 0 @@ -26781,20 +25432,19 @@ func (_ fastpathT) DecMapUint32Float32V(v map[uint32]float32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -26806,23 +25456,22 @@ func (_ fastpathT) DecMapUint32Float32V(v map[uint32]float32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32Float64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32Float64V(rv2i(rv).(map[uint32]float64), false, d) + return } + 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 { + if v, changed := f.DecMapUint32Float64V(*vp, true, d); 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) @@ -26833,6 +25482,7 @@ func (_ fastpathT) DecMapUint32Float64V(v map[uint32]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv float64 hasLen := containerLen > 0 @@ -26840,20 +25490,19 @@ func (_ fastpathT) DecMapUint32Float64V(v map[uint32]float64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -26865,23 +25514,22 @@ func (_ fastpathT) DecMapUint32Float64V(v map[uint32]float64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint32BoolV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint32BoolV(rv2i(rv).(map[uint32]bool), false, d) + return } + 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 { + if v, changed := f.DecMapUint32BoolV(*vp, true, d); 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) @@ -26892,6 +25540,7 @@ func (_ fastpathT) DecMapUint32BoolV(v map[uint32]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint32 var mv bool hasLen := containerLen > 0 @@ -26899,13 +25548,12 @@ func (_ fastpathT) DecMapUint32BoolV(v map[uint32]bool, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mk = uint32(dd.DecodeUint(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -26924,23 +25572,22 @@ func (_ fastpathT) DecMapUint32BoolV(v map[uint32]bool, canChange bool, 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 { - fastpathTV.DecMapUint64IntfV(rv2i(rv).(map[uint64]interface{}), false, d) + return } + fastpathTV.DecMapUint64IntfV(rv2i(rv).(map[uint64]interface{}), false, d) } 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, d *Decoder) (_ map[uint64]interface{}, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -26951,7 +25598,7 @@ func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk uint64 var mv interface{} hasLen := containerLen > 0 @@ -26959,13 +25606,12 @@ func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -26989,23 +25635,22 @@ func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, canChange bool, 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 { - fastpathTV.DecMapUint64StringV(rv2i(rv).(map[uint64]string), false, d) + return } + fastpathTV.DecMapUint64StringV(rv2i(rv).(map[uint64]string), false, d) } 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, d *Decoder) (_ map[uint64]string, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -27016,6 +25661,7 @@ func (_ fastpathT) DecMapUint64StringV(v map[uint64]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv string hasLen := containerLen > 0 @@ -27023,13 +25669,12 @@ func (_ fastpathT) DecMapUint64StringV(v map[uint64]string, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -27048,23 +25693,22 @@ func (_ fastpathT) DecMapUint64StringV(v map[uint64]string, canChange bool, 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 { - fastpathTV.DecMapUint64UintV(rv2i(rv).(map[uint64]uint), false, d) + return } + fastpathTV.DecMapUint64UintV(rv2i(rv).(map[uint64]uint), false, d) } 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, d *Decoder) (_ map[uint64]uint, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -27075,6 +25719,7 @@ func (_ fastpathT) DecMapUint64UintV(v map[uint64]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv uint hasLen := containerLen > 0 @@ -27082,20 +25727,19 @@ func (_ fastpathT) DecMapUint64UintV(v map[uint64]uint, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -27107,23 +25751,22 @@ func (_ fastpathT) DecMapUint64UintV(v map[uint64]uint, canChange bool, 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 { - fastpathTV.DecMapUint64Uint8V(rv2i(rv).(map[uint64]uint8), false, d) + return } + fastpathTV.DecMapUint64Uint8V(rv2i(rv).(map[uint64]uint8), false, d) } 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, d *Decoder) (_ map[uint64]uint8, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -27134,6 +25777,7 @@ func (_ fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv uint8 hasLen := containerLen > 0 @@ -27141,20 +25785,19 @@ func (_ fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -27166,23 +25809,22 @@ func (_ fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint64Uint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint64Uint16V(rv2i(rv).(map[uint64]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapUint64Uint16V(*vp, true, d); 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) @@ -27193,6 +25835,7 @@ func (_ fastpathT) DecMapUint64Uint16V(v map[uint64]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv uint16 hasLen := containerLen > 0 @@ -27200,20 +25843,19 @@ func (_ fastpathT) DecMapUint64Uint16V(v map[uint64]uint16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -27225,23 +25867,22 @@ func (_ fastpathT) DecMapUint64Uint16V(v map[uint64]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint64Uint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint64Uint32V(rv2i(rv).(map[uint64]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapUint64Uint32V(*vp, true, d); 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) @@ -27252,6 +25893,7 @@ func (_ fastpathT) DecMapUint64Uint32V(v map[uint64]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv uint32 hasLen := containerLen > 0 @@ -27259,20 +25901,19 @@ func (_ fastpathT) DecMapUint64Uint32V(v map[uint64]uint32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -27284,23 +25925,22 @@ func (_ fastpathT) DecMapUint64Uint32V(v map[uint64]uint32, canChange bool, 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 { - fastpathTV.DecMapUint64Uint64V(rv2i(rv).(map[uint64]uint64), false, d) + return } + fastpathTV.DecMapUint64Uint64V(rv2i(rv).(map[uint64]uint64), false, d) } 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, d *Decoder) (_ map[uint64]uint64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -27311,6 +25951,7 @@ func (_ fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv uint64 hasLen := containerLen > 0 @@ -27318,20 +25959,19 @@ func (_ fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -27343,23 +25983,22 @@ func (_ fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, canChange bool, 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 { - fastpathTV.DecMapUint64UintptrV(rv2i(rv).(map[uint64]uintptr), false, d) + return } + fastpathTV.DecMapUint64UintptrV(rv2i(rv).(map[uint64]uintptr), false, d) } 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, d *Decoder) (_ map[uint64]uintptr, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -27370,6 +26009,7 @@ func (_ fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv uintptr hasLen := containerLen > 0 @@ -27377,20 +26017,19 @@ func (_ fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -27402,23 +26041,22 @@ func (_ fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, canChange bool, 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 { - fastpathTV.DecMapUint64IntV(rv2i(rv).(map[uint64]int), false, d) + return } + fastpathTV.DecMapUint64IntV(rv2i(rv).(map[uint64]int), false, d) } 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, d *Decoder) (_ map[uint64]int, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -27429,6 +26067,7 @@ func (_ fastpathT) DecMapUint64IntV(v map[uint64]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv int hasLen := containerLen > 0 @@ -27436,20 +26075,19 @@ func (_ fastpathT) DecMapUint64IntV(v map[uint64]int, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -27461,23 +26099,22 @@ func (_ fastpathT) DecMapUint64IntV(v map[uint64]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint64Int8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint64Int8V(rv2i(rv).(map[uint64]int8), false, d) + return } + 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 { + if v, changed := f.DecMapUint64Int8V(*vp, true, d); 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) @@ -27488,6 +26125,7 @@ func (_ fastpathT) DecMapUint64Int8V(v map[uint64]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv int8 hasLen := containerLen > 0 @@ -27495,20 +26133,19 @@ func (_ fastpathT) DecMapUint64Int8V(v map[uint64]int8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -27520,23 +26157,22 @@ func (_ fastpathT) DecMapUint64Int8V(v map[uint64]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint64Int16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint64Int16V(rv2i(rv).(map[uint64]int16), false, d) + return } + 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 { + if v, changed := f.DecMapUint64Int16V(*vp, true, d); 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) @@ -27547,6 +26183,7 @@ func (_ fastpathT) DecMapUint64Int16V(v map[uint64]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv int16 hasLen := containerLen > 0 @@ -27554,20 +26191,19 @@ func (_ fastpathT) DecMapUint64Int16V(v map[uint64]int16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -27579,23 +26215,22 @@ func (_ fastpathT) DecMapUint64Int16V(v map[uint64]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUint64Int32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUint64Int32V(rv2i(rv).(map[uint64]int32), false, d) + return } + 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 { + if v, changed := f.DecMapUint64Int32V(*vp, true, d); 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) @@ -27606,6 +26241,7 @@ func (_ fastpathT) DecMapUint64Int32V(v map[uint64]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv int32 hasLen := containerLen > 0 @@ -27613,20 +26249,19 @@ func (_ fastpathT) DecMapUint64Int32V(v map[uint64]int32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -27638,23 +26273,22 @@ func (_ fastpathT) DecMapUint64Int32V(v map[uint64]int32, canChange bool, 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 { - fastpathTV.DecMapUint64Int64V(rv2i(rv).(map[uint64]int64), false, d) + return } + fastpathTV.DecMapUint64Int64V(rv2i(rv).(map[uint64]int64), false, d) } 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, d *Decoder) (_ map[uint64]int64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -27665,6 +26299,7 @@ func (_ fastpathT) DecMapUint64Int64V(v map[uint64]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv int64 hasLen := containerLen > 0 @@ -27672,20 +26307,19 @@ func (_ fastpathT) DecMapUint64Int64V(v map[uint64]int64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -27697,23 +26331,22 @@ func (_ fastpathT) DecMapUint64Int64V(v map[uint64]int64, canChange bool, 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 { - fastpathTV.DecMapUint64Float32V(rv2i(rv).(map[uint64]float32), false, d) + return } + fastpathTV.DecMapUint64Float32V(rv2i(rv).(map[uint64]float32), false, d) } 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, d *Decoder) (_ map[uint64]float32, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) @@ -27724,6 +26357,7 @@ func (_ fastpathT) DecMapUint64Float32V(v map[uint64]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv float32 hasLen := containerLen > 0 @@ -27731,20 +26365,19 @@ func (_ fastpathT) DecMapUint64Float32V(v map[uint64]float32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -27756,23 +26389,22 @@ func (_ fastpathT) DecMapUint64Float32V(v map[uint64]float32, canChange bool, 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 { - fastpathTV.DecMapUint64Float64V(rv2i(rv).(map[uint64]float64), false, d) + return } + fastpathTV.DecMapUint64Float64V(rv2i(rv).(map[uint64]float64), false, d) } 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, d *Decoder) (_ map[uint64]float64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -27783,6 +26415,7 @@ func (_ fastpathT) DecMapUint64Float64V(v map[uint64]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv float64 hasLen := containerLen > 0 @@ -27790,20 +26423,19 @@ func (_ fastpathT) DecMapUint64Float64V(v map[uint64]float64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -27815,23 +26447,22 @@ func (_ fastpathT) DecMapUint64Float64V(v map[uint64]float64, canChange bool, 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 { - fastpathTV.DecMapUint64BoolV(rv2i(rv).(map[uint64]bool), false, d) + return } + fastpathTV.DecMapUint64BoolV(rv2i(rv).(map[uint64]bool), false, d) } 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, d *Decoder) (_ map[uint64]bool, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -27842,6 +26473,7 @@ func (_ fastpathT) DecMapUint64BoolV(v map[uint64]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uint64 var mv bool hasLen := containerLen > 0 @@ -27849,13 +26481,12 @@ func (_ fastpathT) DecMapUint64BoolV(v map[uint64]bool, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeUint64() + mk = dd.DecodeUint(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -27874,23 +26505,22 @@ func (_ fastpathT) DecMapUint64BoolV(v map[uint64]bool, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrIntfV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrIntfV(rv2i(rv).(map[uintptr]interface{}), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrIntfV(*vp, true, d); 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) @@ -27901,7 +26531,7 @@ func (_ fastpathT) DecMapUintptrIntfV(v map[uintptr]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk uintptr var mv interface{} hasLen := containerLen > 0 @@ -27909,13 +26539,12 @@ func (_ fastpathT) DecMapUintptrIntfV(v map[uintptr]interface{}, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -27939,23 +26568,22 @@ func (_ fastpathT) DecMapUintptrIntfV(v map[uintptr]interface{}, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrStringV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrStringV(rv2i(rv).(map[uintptr]string), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrStringV(*vp, true, d); 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) @@ -27966,6 +26594,7 @@ func (_ fastpathT) DecMapUintptrStringV(v map[uintptr]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv string hasLen := containerLen > 0 @@ -27973,13 +26602,12 @@ func (_ fastpathT) DecMapUintptrStringV(v map[uintptr]string, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -27998,23 +26626,22 @@ func (_ fastpathT) DecMapUintptrStringV(v map[uintptr]string, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrUintV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrUintV(rv2i(rv).(map[uintptr]uint), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrUintV(*vp, true, d); 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) @@ -28025,6 +26652,7 @@ func (_ fastpathT) DecMapUintptrUintV(v map[uintptr]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv uint hasLen := containerLen > 0 @@ -28032,20 +26660,19 @@ func (_ fastpathT) DecMapUintptrUintV(v map[uintptr]uint, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -28057,23 +26684,22 @@ func (_ fastpathT) DecMapUintptrUintV(v map[uintptr]uint, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrUint8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrUint8V(rv2i(rv).(map[uintptr]uint8), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrUint8V(*vp, true, d); 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) @@ -28084,6 +26710,7 @@ func (_ fastpathT) DecMapUintptrUint8V(v map[uintptr]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv uint8 hasLen := containerLen > 0 @@ -28091,20 +26718,19 @@ func (_ fastpathT) DecMapUintptrUint8V(v map[uintptr]uint8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -28116,23 +26742,22 @@ func (_ fastpathT) DecMapUintptrUint8V(v map[uintptr]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrUint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrUint16V(rv2i(rv).(map[uintptr]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrUint16V(*vp, true, d); 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) @@ -28143,6 +26768,7 @@ func (_ fastpathT) DecMapUintptrUint16V(v map[uintptr]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv uint16 hasLen := containerLen > 0 @@ -28150,20 +26776,19 @@ func (_ fastpathT) DecMapUintptrUint16V(v map[uintptr]uint16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -28175,23 +26800,22 @@ func (_ fastpathT) DecMapUintptrUint16V(v map[uintptr]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrUint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrUint32V(rv2i(rv).(map[uintptr]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrUint32V(*vp, true, d); 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) @@ -28202,6 +26826,7 @@ func (_ fastpathT) DecMapUintptrUint32V(v map[uintptr]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv uint32 hasLen := containerLen > 0 @@ -28209,20 +26834,19 @@ func (_ fastpathT) DecMapUintptrUint32V(v map[uintptr]uint32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -28234,23 +26858,22 @@ func (_ fastpathT) DecMapUintptrUint32V(v map[uintptr]uint32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrUint64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrUint64V(rv2i(rv).(map[uintptr]uint64), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrUint64V(*vp, true, d); 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) @@ -28261,6 +26884,7 @@ func (_ fastpathT) DecMapUintptrUint64V(v map[uintptr]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv uint64 hasLen := containerLen > 0 @@ -28268,20 +26892,19 @@ func (_ fastpathT) DecMapUintptrUint64V(v map[uintptr]uint64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -28293,23 +26916,22 @@ func (_ fastpathT) DecMapUintptrUint64V(v map[uintptr]uint64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrUintptrV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrUintptrV(rv2i(rv).(map[uintptr]uintptr), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrUintptrV(*vp, true, d); 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) @@ -28320,6 +26942,7 @@ func (_ fastpathT) DecMapUintptrUintptrV(v map[uintptr]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv uintptr hasLen := containerLen > 0 @@ -28327,20 +26950,19 @@ func (_ fastpathT) DecMapUintptrUintptrV(v map[uintptr]uintptr, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -28352,23 +26974,22 @@ func (_ fastpathT) DecMapUintptrUintptrV(v map[uintptr]uintptr, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrIntV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrIntV(rv2i(rv).(map[uintptr]int), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrIntV(*vp, true, d); 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) @@ -28379,6 +27000,7 @@ func (_ fastpathT) DecMapUintptrIntV(v map[uintptr]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv int hasLen := containerLen > 0 @@ -28386,20 +27008,19 @@ func (_ fastpathT) DecMapUintptrIntV(v map[uintptr]int, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -28411,23 +27032,22 @@ func (_ fastpathT) DecMapUintptrIntV(v map[uintptr]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrInt8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrInt8V(rv2i(rv).(map[uintptr]int8), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrInt8V(*vp, true, d); 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) @@ -28438,6 +27058,7 @@ func (_ fastpathT) DecMapUintptrInt8V(v map[uintptr]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv int8 hasLen := containerLen > 0 @@ -28445,20 +27066,19 @@ func (_ fastpathT) DecMapUintptrInt8V(v map[uintptr]int8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -28470,23 +27090,22 @@ func (_ fastpathT) DecMapUintptrInt8V(v map[uintptr]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrInt16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrInt16V(rv2i(rv).(map[uintptr]int16), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrInt16V(*vp, true, d); 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) @@ -28497,6 +27116,7 @@ func (_ fastpathT) DecMapUintptrInt16V(v map[uintptr]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv int16 hasLen := containerLen > 0 @@ -28504,20 +27124,19 @@ func (_ fastpathT) DecMapUintptrInt16V(v map[uintptr]int16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -28529,23 +27148,22 @@ func (_ fastpathT) DecMapUintptrInt16V(v map[uintptr]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrInt32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrInt32V(rv2i(rv).(map[uintptr]int32), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrInt32V(*vp, true, d); 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) @@ -28556,6 +27174,7 @@ func (_ fastpathT) DecMapUintptrInt32V(v map[uintptr]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv int32 hasLen := containerLen > 0 @@ -28563,20 +27182,19 @@ func (_ fastpathT) DecMapUintptrInt32V(v map[uintptr]int32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -28588,23 +27206,22 @@ func (_ fastpathT) DecMapUintptrInt32V(v map[uintptr]int32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrInt64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrInt64V(rv2i(rv).(map[uintptr]int64), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrInt64V(*vp, true, d); 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) @@ -28615,6 +27232,7 @@ func (_ fastpathT) DecMapUintptrInt64V(v map[uintptr]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv int64 hasLen := containerLen > 0 @@ -28622,20 +27240,19 @@ func (_ fastpathT) DecMapUintptrInt64V(v map[uintptr]int64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -28647,23 +27264,22 @@ func (_ fastpathT) DecMapUintptrInt64V(v map[uintptr]int64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrFloat32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrFloat32V(rv2i(rv).(map[uintptr]float32), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrFloat32V(*vp, true, d); 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) @@ -28674,6 +27290,7 @@ func (_ fastpathT) DecMapUintptrFloat32V(v map[uintptr]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv float32 hasLen := containerLen > 0 @@ -28681,20 +27298,19 @@ func (_ fastpathT) DecMapUintptrFloat32V(v map[uintptr]float32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -28706,23 +27322,22 @@ func (_ fastpathT) DecMapUintptrFloat32V(v map[uintptr]float32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrFloat64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrFloat64V(rv2i(rv).(map[uintptr]float64), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrFloat64V(*vp, true, d); 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) @@ -28733,6 +27348,7 @@ func (_ fastpathT) DecMapUintptrFloat64V(v map[uintptr]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv float64 hasLen := containerLen > 0 @@ -28740,20 +27356,19 @@ func (_ fastpathT) DecMapUintptrFloat64V(v map[uintptr]float64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -28765,23 +27380,22 @@ func (_ fastpathT) DecMapUintptrFloat64V(v map[uintptr]float64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapUintptrBoolV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapUintptrBoolV(rv2i(rv).(map[uintptr]bool), false, d) + return } + 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 { + if v, changed := f.DecMapUintptrBoolV(*vp, true, d); 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) @@ -28792,6 +27406,7 @@ func (_ fastpathT) DecMapUintptrBoolV(v map[uintptr]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk uintptr var mv bool hasLen := containerLen > 0 @@ -28799,13 +27414,12 @@ func (_ fastpathT) DecMapUintptrBoolV(v map[uintptr]bool, canChange bool, if esep { dd.ReadMapElemKey() } - mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mk = uintptr(dd.DecodeUint(uintBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -28824,23 +27438,22 @@ func (_ fastpathT) DecMapUintptrBoolV(v map[uintptr]bool, canChange bool, 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 { - fastpathTV.DecMapIntIntfV(rv2i(rv).(map[int]interface{}), false, d) + return } + fastpathTV.DecMapIntIntfV(rv2i(rv).(map[int]interface{}), false, d) } 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, d *Decoder) (_ map[int]interface{}, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -28851,7 +27464,7 @@ func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk int var mv interface{} hasLen := containerLen > 0 @@ -28859,13 +27472,12 @@ func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -28889,23 +27501,22 @@ func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, canChange bool, 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 { - fastpathTV.DecMapIntStringV(rv2i(rv).(map[int]string), false, d) + return } + fastpathTV.DecMapIntStringV(rv2i(rv).(map[int]string), false, d) } 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, d *Decoder) (_ map[int]string, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -28916,6 +27527,7 @@ func (_ fastpathT) DecMapIntStringV(v map[int]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv string hasLen := containerLen > 0 @@ -28923,13 +27535,12 @@ func (_ fastpathT) DecMapIntStringV(v map[int]string, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -28948,23 +27559,22 @@ func (_ fastpathT) DecMapIntStringV(v map[int]string, canChange bool, 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 { - fastpathTV.DecMapIntUintV(rv2i(rv).(map[int]uint), false, d) + return } + fastpathTV.DecMapIntUintV(rv2i(rv).(map[int]uint), false, d) } 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, d *Decoder) (_ map[int]uint, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -28975,6 +27585,7 @@ func (_ fastpathT) DecMapIntUintV(v map[int]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv uint hasLen := containerLen > 0 @@ -28982,20 +27593,19 @@ func (_ fastpathT) DecMapIntUintV(v map[int]uint, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -29007,23 +27617,22 @@ func (_ fastpathT) DecMapIntUintV(v map[int]uint, canChange bool, 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 { - fastpathTV.DecMapIntUint8V(rv2i(rv).(map[int]uint8), false, d) + return } + fastpathTV.DecMapIntUint8V(rv2i(rv).(map[int]uint8), false, d) } 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, d *Decoder) (_ map[int]uint8, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -29034,6 +27643,7 @@ func (_ fastpathT) DecMapIntUint8V(v map[int]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv uint8 hasLen := containerLen > 0 @@ -29041,20 +27651,19 @@ func (_ fastpathT) DecMapIntUint8V(v map[int]uint8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -29066,23 +27675,22 @@ func (_ fastpathT) DecMapIntUint8V(v map[int]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntUint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntUint16V(rv2i(rv).(map[int]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapIntUint16V(*vp, true, d); 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) @@ -29093,6 +27701,7 @@ func (_ fastpathT) DecMapIntUint16V(v map[int]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv uint16 hasLen := containerLen > 0 @@ -29100,20 +27709,19 @@ func (_ fastpathT) DecMapIntUint16V(v map[int]uint16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -29125,23 +27733,22 @@ func (_ fastpathT) DecMapIntUint16V(v map[int]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntUint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntUint32V(rv2i(rv).(map[int]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapIntUint32V(*vp, true, d); 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) @@ -29152,6 +27759,7 @@ func (_ fastpathT) DecMapIntUint32V(v map[int]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv uint32 hasLen := containerLen > 0 @@ -29159,20 +27767,19 @@ func (_ fastpathT) DecMapIntUint32V(v map[int]uint32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -29184,23 +27791,22 @@ func (_ fastpathT) DecMapIntUint32V(v map[int]uint32, canChange bool, 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 { - fastpathTV.DecMapIntUint64V(rv2i(rv).(map[int]uint64), false, d) + return } + fastpathTV.DecMapIntUint64V(rv2i(rv).(map[int]uint64), false, d) } 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, d *Decoder) (_ map[int]uint64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -29211,6 +27817,7 @@ func (_ fastpathT) DecMapIntUint64V(v map[int]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv uint64 hasLen := containerLen > 0 @@ -29218,20 +27825,19 @@ func (_ fastpathT) DecMapIntUint64V(v map[int]uint64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -29243,23 +27849,22 @@ func (_ fastpathT) DecMapIntUint64V(v map[int]uint64, canChange bool, 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 { - fastpathTV.DecMapIntUintptrV(rv2i(rv).(map[int]uintptr), false, d) + return } + fastpathTV.DecMapIntUintptrV(rv2i(rv).(map[int]uintptr), false, d) } 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, d *Decoder) (_ map[int]uintptr, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -29270,6 +27875,7 @@ func (_ fastpathT) DecMapIntUintptrV(v map[int]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv uintptr hasLen := containerLen > 0 @@ -29277,20 +27883,19 @@ func (_ fastpathT) DecMapIntUintptrV(v map[int]uintptr, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -29302,23 +27907,22 @@ func (_ fastpathT) DecMapIntUintptrV(v map[int]uintptr, canChange bool, 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 { - fastpathTV.DecMapIntIntV(rv2i(rv).(map[int]int), false, d) + return } + fastpathTV.DecMapIntIntV(rv2i(rv).(map[int]int), false, d) } 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, d *Decoder) (_ map[int]int, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -29329,6 +27933,7 @@ func (_ fastpathT) DecMapIntIntV(v map[int]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv int hasLen := containerLen > 0 @@ -29336,20 +27941,19 @@ func (_ fastpathT) DecMapIntIntV(v map[int]int, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -29361,23 +27965,22 @@ func (_ fastpathT) DecMapIntIntV(v map[int]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntInt8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntInt8V(rv2i(rv).(map[int]int8), false, d) + return } + 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 { + if v, changed := f.DecMapIntInt8V(*vp, true, d); 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) @@ -29388,6 +27991,7 @@ func (_ fastpathT) DecMapIntInt8V(v map[int]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv int8 hasLen := containerLen > 0 @@ -29395,20 +27999,19 @@ func (_ fastpathT) DecMapIntInt8V(v map[int]int8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -29420,23 +28023,22 @@ func (_ fastpathT) DecMapIntInt8V(v map[int]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntInt16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntInt16V(rv2i(rv).(map[int]int16), false, d) + return } + 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 { + if v, changed := f.DecMapIntInt16V(*vp, true, d); 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) @@ -29447,6 +28049,7 @@ func (_ fastpathT) DecMapIntInt16V(v map[int]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv int16 hasLen := containerLen > 0 @@ -29454,20 +28057,19 @@ func (_ fastpathT) DecMapIntInt16V(v map[int]int16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -29479,23 +28081,22 @@ func (_ fastpathT) DecMapIntInt16V(v map[int]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapIntInt32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapIntInt32V(rv2i(rv).(map[int]int32), false, d) + return } + 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 { + if v, changed := f.DecMapIntInt32V(*vp, true, d); 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) @@ -29506,6 +28107,7 @@ func (_ fastpathT) DecMapIntInt32V(v map[int]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv int32 hasLen := containerLen > 0 @@ -29513,20 +28115,19 @@ func (_ fastpathT) DecMapIntInt32V(v map[int]int32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -29538,23 +28139,22 @@ func (_ fastpathT) DecMapIntInt32V(v map[int]int32, canChange bool, 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 { - fastpathTV.DecMapIntInt64V(rv2i(rv).(map[int]int64), false, d) + return } + fastpathTV.DecMapIntInt64V(rv2i(rv).(map[int]int64), false, d) } 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, d *Decoder) (_ map[int]int64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -29565,6 +28165,7 @@ func (_ fastpathT) DecMapIntInt64V(v map[int]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv int64 hasLen := containerLen > 0 @@ -29572,20 +28173,19 @@ func (_ fastpathT) DecMapIntInt64V(v map[int]int64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -29597,23 +28197,22 @@ func (_ fastpathT) DecMapIntInt64V(v map[int]int64, canChange bool, 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 { - fastpathTV.DecMapIntFloat32V(rv2i(rv).(map[int]float32), false, d) + return } + fastpathTV.DecMapIntFloat32V(rv2i(rv).(map[int]float32), false, d) } 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, d *Decoder) (_ map[int]float32, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) @@ -29624,6 +28223,7 @@ func (_ fastpathT) DecMapIntFloat32V(v map[int]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv float32 hasLen := containerLen > 0 @@ -29631,20 +28231,19 @@ func (_ fastpathT) DecMapIntFloat32V(v map[int]float32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -29656,23 +28255,22 @@ func (_ fastpathT) DecMapIntFloat32V(v map[int]float32, canChange bool, 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 { - fastpathTV.DecMapIntFloat64V(rv2i(rv).(map[int]float64), false, d) + return } + fastpathTV.DecMapIntFloat64V(rv2i(rv).(map[int]float64), false, d) } 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, d *Decoder) (_ map[int]float64, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -29683,6 +28281,7 @@ func (_ fastpathT) DecMapIntFloat64V(v map[int]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv float64 hasLen := containerLen > 0 @@ -29690,20 +28289,19 @@ func (_ fastpathT) DecMapIntFloat64V(v map[int]float64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -29715,23 +28313,22 @@ func (_ fastpathT) DecMapIntFloat64V(v map[int]float64, canChange bool, 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 { - fastpathTV.DecMapIntBoolV(rv2i(rv).(map[int]bool), false, d) + return } + fastpathTV.DecMapIntBoolV(rv2i(rv).(map[int]bool), false, d) } 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, d *Decoder) (_ map[int]bool, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -29742,6 +28339,7 @@ func (_ fastpathT) DecMapIntBoolV(v map[int]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int var mv bool hasLen := containerLen > 0 @@ -29749,13 +28347,12 @@ func (_ fastpathT) DecMapIntBoolV(v map[int]bool, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mk = int(dd.DecodeInt(intBitsize)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -29774,23 +28371,22 @@ func (_ fastpathT) DecMapIntBoolV(v map[int]bool, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8IntfV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8IntfV(rv2i(rv).(map[int8]interface{}), false, d) + return } + 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 { + if v, changed := f.DecMapInt8IntfV(*vp, true, d); 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) @@ -29801,7 +28397,7 @@ func (_ fastpathT) DecMapInt8IntfV(v map[int8]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk int8 var mv interface{} hasLen := containerLen > 0 @@ -29809,13 +28405,12 @@ func (_ fastpathT) DecMapInt8IntfV(v map[int8]interface{}, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -29839,23 +28434,22 @@ func (_ fastpathT) DecMapInt8IntfV(v map[int8]interface{}, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8StringV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8StringV(rv2i(rv).(map[int8]string), false, d) + return } + 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 { + if v, changed := f.DecMapInt8StringV(*vp, true, d); 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) @@ -29866,6 +28460,7 @@ func (_ fastpathT) DecMapInt8StringV(v map[int8]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv string hasLen := containerLen > 0 @@ -29873,13 +28468,12 @@ func (_ fastpathT) DecMapInt8StringV(v map[int8]string, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -29898,23 +28492,22 @@ func (_ fastpathT) DecMapInt8StringV(v map[int8]string, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8UintV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8UintV(rv2i(rv).(map[int8]uint), false, d) + return } + 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 { + if v, changed := f.DecMapInt8UintV(*vp, true, d); 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) @@ -29925,6 +28518,7 @@ func (_ fastpathT) DecMapInt8UintV(v map[int8]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv uint hasLen := containerLen > 0 @@ -29932,20 +28526,19 @@ func (_ fastpathT) DecMapInt8UintV(v map[int8]uint, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -29957,23 +28550,22 @@ func (_ fastpathT) DecMapInt8UintV(v map[int8]uint, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8Uint8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8Uint8V(rv2i(rv).(map[int8]uint8), false, d) + return } + 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 { + if v, changed := f.DecMapInt8Uint8V(*vp, true, d); 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) @@ -29984,6 +28576,7 @@ func (_ fastpathT) DecMapInt8Uint8V(v map[int8]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv uint8 hasLen := containerLen > 0 @@ -29991,20 +28584,19 @@ func (_ fastpathT) DecMapInt8Uint8V(v map[int8]uint8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -30016,23 +28608,22 @@ func (_ fastpathT) DecMapInt8Uint8V(v map[int8]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8Uint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8Uint16V(rv2i(rv).(map[int8]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapInt8Uint16V(*vp, true, d); 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) @@ -30043,6 +28634,7 @@ func (_ fastpathT) DecMapInt8Uint16V(v map[int8]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv uint16 hasLen := containerLen > 0 @@ -30050,20 +28642,19 @@ func (_ fastpathT) DecMapInt8Uint16V(v map[int8]uint16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -30075,23 +28666,22 @@ func (_ fastpathT) DecMapInt8Uint16V(v map[int8]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8Uint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8Uint32V(rv2i(rv).(map[int8]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapInt8Uint32V(*vp, true, d); 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) @@ -30102,6 +28692,7 @@ func (_ fastpathT) DecMapInt8Uint32V(v map[int8]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv uint32 hasLen := containerLen > 0 @@ -30109,20 +28700,19 @@ func (_ fastpathT) DecMapInt8Uint32V(v map[int8]uint32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -30134,23 +28724,22 @@ func (_ fastpathT) DecMapInt8Uint32V(v map[int8]uint32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8Uint64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8Uint64V(rv2i(rv).(map[int8]uint64), false, d) + return } + 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 { + if v, changed := f.DecMapInt8Uint64V(*vp, true, d); 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) @@ -30161,6 +28750,7 @@ func (_ fastpathT) DecMapInt8Uint64V(v map[int8]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv uint64 hasLen := containerLen > 0 @@ -30168,20 +28758,19 @@ func (_ fastpathT) DecMapInt8Uint64V(v map[int8]uint64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -30193,23 +28782,22 @@ func (_ fastpathT) DecMapInt8Uint64V(v map[int8]uint64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8UintptrV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8UintptrV(rv2i(rv).(map[int8]uintptr), false, d) + return } + 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 { + if v, changed := f.DecMapInt8UintptrV(*vp, true, d); 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) @@ -30220,6 +28808,7 @@ func (_ fastpathT) DecMapInt8UintptrV(v map[int8]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv uintptr hasLen := containerLen > 0 @@ -30227,20 +28816,19 @@ func (_ fastpathT) DecMapInt8UintptrV(v map[int8]uintptr, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -30252,23 +28840,22 @@ func (_ fastpathT) DecMapInt8UintptrV(v map[int8]uintptr, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8IntV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8IntV(rv2i(rv).(map[int8]int), false, d) + return } + 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 { + if v, changed := f.DecMapInt8IntV(*vp, true, d); 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) @@ -30279,6 +28866,7 @@ func (_ fastpathT) DecMapInt8IntV(v map[int8]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv int hasLen := containerLen > 0 @@ -30286,20 +28874,19 @@ func (_ fastpathT) DecMapInt8IntV(v map[int8]int, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -30311,23 +28898,22 @@ func (_ fastpathT) DecMapInt8IntV(v map[int8]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8Int8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8Int8V(rv2i(rv).(map[int8]int8), false, d) + return } + 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 { + if v, changed := f.DecMapInt8Int8V(*vp, true, d); 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) @@ -30338,6 +28924,7 @@ func (_ fastpathT) DecMapInt8Int8V(v map[int8]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv int8 hasLen := containerLen > 0 @@ -30345,20 +28932,19 @@ func (_ fastpathT) DecMapInt8Int8V(v map[int8]int8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -30370,23 +28956,22 @@ func (_ fastpathT) DecMapInt8Int8V(v map[int8]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8Int16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8Int16V(rv2i(rv).(map[int8]int16), false, d) + return } + 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 { + if v, changed := f.DecMapInt8Int16V(*vp, true, d); 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) @@ -30397,6 +28982,7 @@ func (_ fastpathT) DecMapInt8Int16V(v map[int8]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv int16 hasLen := containerLen > 0 @@ -30404,20 +28990,19 @@ func (_ fastpathT) DecMapInt8Int16V(v map[int8]int16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -30429,23 +29014,22 @@ func (_ fastpathT) DecMapInt8Int16V(v map[int8]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8Int32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8Int32V(rv2i(rv).(map[int8]int32), false, d) + return } + 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 { + if v, changed := f.DecMapInt8Int32V(*vp, true, d); 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) @@ -30456,6 +29040,7 @@ func (_ fastpathT) DecMapInt8Int32V(v map[int8]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv int32 hasLen := containerLen > 0 @@ -30463,20 +29048,19 @@ func (_ fastpathT) DecMapInt8Int32V(v map[int8]int32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -30488,23 +29072,22 @@ func (_ fastpathT) DecMapInt8Int32V(v map[int8]int32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8Int64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8Int64V(rv2i(rv).(map[int8]int64), false, d) + return } + 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 { + if v, changed := f.DecMapInt8Int64V(*vp, true, d); 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) @@ -30515,6 +29098,7 @@ func (_ fastpathT) DecMapInt8Int64V(v map[int8]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv int64 hasLen := containerLen > 0 @@ -30522,20 +29106,19 @@ func (_ fastpathT) DecMapInt8Int64V(v map[int8]int64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -30547,23 +29130,22 @@ func (_ fastpathT) DecMapInt8Int64V(v map[int8]int64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8Float32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8Float32V(rv2i(rv).(map[int8]float32), false, d) + return } + 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 { + if v, changed := f.DecMapInt8Float32V(*vp, true, d); 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) @@ -30574,6 +29156,7 @@ func (_ fastpathT) DecMapInt8Float32V(v map[int8]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv float32 hasLen := containerLen > 0 @@ -30581,20 +29164,19 @@ func (_ fastpathT) DecMapInt8Float32V(v map[int8]float32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -30606,23 +29188,22 @@ func (_ fastpathT) DecMapInt8Float32V(v map[int8]float32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8Float64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8Float64V(rv2i(rv).(map[int8]float64), false, d) + return } + 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 { + if v, changed := f.DecMapInt8Float64V(*vp, true, d); 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) @@ -30633,6 +29214,7 @@ func (_ fastpathT) DecMapInt8Float64V(v map[int8]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv float64 hasLen := containerLen > 0 @@ -30640,20 +29222,19 @@ func (_ fastpathT) DecMapInt8Float64V(v map[int8]float64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -30665,23 +29246,22 @@ func (_ fastpathT) DecMapInt8Float64V(v map[int8]float64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt8BoolV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt8BoolV(rv2i(rv).(map[int8]bool), false, d) + return } + 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 { + if v, changed := f.DecMapInt8BoolV(*vp, true, d); 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) @@ -30692,6 +29272,7 @@ func (_ fastpathT) DecMapInt8BoolV(v map[int8]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int8 var mv bool hasLen := containerLen > 0 @@ -30699,13 +29280,12 @@ func (_ fastpathT) DecMapInt8BoolV(v map[int8]bool, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mk = int8(dd.DecodeInt(8)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -30724,23 +29304,22 @@ func (_ fastpathT) DecMapInt8BoolV(v map[int8]bool, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16IntfV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16IntfV(rv2i(rv).(map[int16]interface{}), false, d) + return } + 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 { + if v, changed := f.DecMapInt16IntfV(*vp, true, d); 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) @@ -30751,7 +29330,7 @@ func (_ fastpathT) DecMapInt16IntfV(v map[int16]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk int16 var mv interface{} hasLen := containerLen > 0 @@ -30759,13 +29338,12 @@ func (_ fastpathT) DecMapInt16IntfV(v map[int16]interface{}, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -30789,23 +29367,22 @@ func (_ fastpathT) DecMapInt16IntfV(v map[int16]interface{}, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16StringV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16StringV(rv2i(rv).(map[int16]string), false, d) + return } + 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 { + if v, changed := f.DecMapInt16StringV(*vp, true, d); 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) @@ -30816,6 +29393,7 @@ func (_ fastpathT) DecMapInt16StringV(v map[int16]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv string hasLen := containerLen > 0 @@ -30823,13 +29401,12 @@ func (_ fastpathT) DecMapInt16StringV(v map[int16]string, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -30848,23 +29425,22 @@ func (_ fastpathT) DecMapInt16StringV(v map[int16]string, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16UintV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16UintV(rv2i(rv).(map[int16]uint), false, d) + return } + 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 { + if v, changed := f.DecMapInt16UintV(*vp, true, d); 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) @@ -30875,6 +29451,7 @@ func (_ fastpathT) DecMapInt16UintV(v map[int16]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv uint hasLen := containerLen > 0 @@ -30882,20 +29459,19 @@ func (_ fastpathT) DecMapInt16UintV(v map[int16]uint, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -30907,23 +29483,22 @@ func (_ fastpathT) DecMapInt16UintV(v map[int16]uint, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16Uint8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16Uint8V(rv2i(rv).(map[int16]uint8), false, d) + return } + 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 { + if v, changed := f.DecMapInt16Uint8V(*vp, true, d); 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) @@ -30934,6 +29509,7 @@ func (_ fastpathT) DecMapInt16Uint8V(v map[int16]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv uint8 hasLen := containerLen > 0 @@ -30941,20 +29517,19 @@ func (_ fastpathT) DecMapInt16Uint8V(v map[int16]uint8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -30966,23 +29541,22 @@ func (_ fastpathT) DecMapInt16Uint8V(v map[int16]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16Uint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16Uint16V(rv2i(rv).(map[int16]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapInt16Uint16V(*vp, true, d); 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) @@ -30993,6 +29567,7 @@ func (_ fastpathT) DecMapInt16Uint16V(v map[int16]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv uint16 hasLen := containerLen > 0 @@ -31000,20 +29575,19 @@ func (_ fastpathT) DecMapInt16Uint16V(v map[int16]uint16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -31025,23 +29599,22 @@ func (_ fastpathT) DecMapInt16Uint16V(v map[int16]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16Uint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16Uint32V(rv2i(rv).(map[int16]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapInt16Uint32V(*vp, true, d); 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) @@ -31052,6 +29625,7 @@ func (_ fastpathT) DecMapInt16Uint32V(v map[int16]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv uint32 hasLen := containerLen > 0 @@ -31059,20 +29633,19 @@ func (_ fastpathT) DecMapInt16Uint32V(v map[int16]uint32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -31084,23 +29657,22 @@ func (_ fastpathT) DecMapInt16Uint32V(v map[int16]uint32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16Uint64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16Uint64V(rv2i(rv).(map[int16]uint64), false, d) + return } + 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 { + if v, changed := f.DecMapInt16Uint64V(*vp, true, d); 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) @@ -31111,6 +29683,7 @@ func (_ fastpathT) DecMapInt16Uint64V(v map[int16]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv uint64 hasLen := containerLen > 0 @@ -31118,20 +29691,19 @@ func (_ fastpathT) DecMapInt16Uint64V(v map[int16]uint64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -31143,23 +29715,22 @@ func (_ fastpathT) DecMapInt16Uint64V(v map[int16]uint64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16UintptrV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16UintptrV(rv2i(rv).(map[int16]uintptr), false, d) + return } + 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 { + if v, changed := f.DecMapInt16UintptrV(*vp, true, d); 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) @@ -31170,6 +29741,7 @@ func (_ fastpathT) DecMapInt16UintptrV(v map[int16]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv uintptr hasLen := containerLen > 0 @@ -31177,20 +29749,19 @@ func (_ fastpathT) DecMapInt16UintptrV(v map[int16]uintptr, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -31202,23 +29773,22 @@ func (_ fastpathT) DecMapInt16UintptrV(v map[int16]uintptr, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16IntV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16IntV(rv2i(rv).(map[int16]int), false, d) + return } + 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 { + if v, changed := f.DecMapInt16IntV(*vp, true, d); 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) @@ -31229,6 +29799,7 @@ func (_ fastpathT) DecMapInt16IntV(v map[int16]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv int hasLen := containerLen > 0 @@ -31236,20 +29807,19 @@ func (_ fastpathT) DecMapInt16IntV(v map[int16]int, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -31261,23 +29831,22 @@ func (_ fastpathT) DecMapInt16IntV(v map[int16]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16Int8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16Int8V(rv2i(rv).(map[int16]int8), false, d) + return } + 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 { + if v, changed := f.DecMapInt16Int8V(*vp, true, d); 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) @@ -31288,6 +29857,7 @@ func (_ fastpathT) DecMapInt16Int8V(v map[int16]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv int8 hasLen := containerLen > 0 @@ -31295,20 +29865,19 @@ func (_ fastpathT) DecMapInt16Int8V(v map[int16]int8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -31320,23 +29889,22 @@ func (_ fastpathT) DecMapInt16Int8V(v map[int16]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16Int16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16Int16V(rv2i(rv).(map[int16]int16), false, d) + return } + 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 { + if v, changed := f.DecMapInt16Int16V(*vp, true, d); 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) @@ -31347,6 +29915,7 @@ func (_ fastpathT) DecMapInt16Int16V(v map[int16]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv int16 hasLen := containerLen > 0 @@ -31354,20 +29923,19 @@ func (_ fastpathT) DecMapInt16Int16V(v map[int16]int16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -31379,23 +29947,22 @@ func (_ fastpathT) DecMapInt16Int16V(v map[int16]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16Int32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16Int32V(rv2i(rv).(map[int16]int32), false, d) + return } + 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 { + if v, changed := f.DecMapInt16Int32V(*vp, true, d); 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) @@ -31406,6 +29973,7 @@ func (_ fastpathT) DecMapInt16Int32V(v map[int16]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv int32 hasLen := containerLen > 0 @@ -31413,20 +29981,19 @@ func (_ fastpathT) DecMapInt16Int32V(v map[int16]int32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -31438,23 +30005,22 @@ func (_ fastpathT) DecMapInt16Int32V(v map[int16]int32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16Int64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16Int64V(rv2i(rv).(map[int16]int64), false, d) + return } + 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 { + if v, changed := f.DecMapInt16Int64V(*vp, true, d); 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) @@ -31465,6 +30031,7 @@ func (_ fastpathT) DecMapInt16Int64V(v map[int16]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv int64 hasLen := containerLen > 0 @@ -31472,20 +30039,19 @@ func (_ fastpathT) DecMapInt16Int64V(v map[int16]int64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -31497,23 +30063,22 @@ func (_ fastpathT) DecMapInt16Int64V(v map[int16]int64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16Float32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16Float32V(rv2i(rv).(map[int16]float32), false, d) + return } + 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 { + if v, changed := f.DecMapInt16Float32V(*vp, true, d); 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) @@ -31524,6 +30089,7 @@ func (_ fastpathT) DecMapInt16Float32V(v map[int16]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv float32 hasLen := containerLen > 0 @@ -31531,20 +30097,19 @@ func (_ fastpathT) DecMapInt16Float32V(v map[int16]float32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -31556,23 +30121,22 @@ func (_ fastpathT) DecMapInt16Float32V(v map[int16]float32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16Float64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16Float64V(rv2i(rv).(map[int16]float64), false, d) + return } + 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 { + if v, changed := f.DecMapInt16Float64V(*vp, true, d); 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) @@ -31583,6 +30147,7 @@ func (_ fastpathT) DecMapInt16Float64V(v map[int16]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv float64 hasLen := containerLen > 0 @@ -31590,20 +30155,19 @@ func (_ fastpathT) DecMapInt16Float64V(v map[int16]float64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -31615,23 +30179,22 @@ func (_ fastpathT) DecMapInt16Float64V(v map[int16]float64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt16BoolV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt16BoolV(rv2i(rv).(map[int16]bool), false, d) + return } + 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 { + if v, changed := f.DecMapInt16BoolV(*vp, true, d); 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) @@ -31642,6 +30205,7 @@ func (_ fastpathT) DecMapInt16BoolV(v map[int16]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int16 var mv bool hasLen := containerLen > 0 @@ -31649,13 +30213,12 @@ func (_ fastpathT) DecMapInt16BoolV(v map[int16]bool, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mk = int16(dd.DecodeInt(16)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -31674,23 +30237,22 @@ func (_ fastpathT) DecMapInt16BoolV(v map[int16]bool, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32IntfV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32IntfV(rv2i(rv).(map[int32]interface{}), false, d) + return } + 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 { + if v, changed := f.DecMapInt32IntfV(*vp, true, d); 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) @@ -31701,7 +30263,7 @@ func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk int32 var mv interface{} hasLen := containerLen > 0 @@ -31709,13 +30271,12 @@ func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -31739,23 +30300,22 @@ func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32StringV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32StringV(rv2i(rv).(map[int32]string), false, d) + return } + 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 { + if v, changed := f.DecMapInt32StringV(*vp, true, d); 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) @@ -31766,6 +30326,7 @@ func (_ fastpathT) DecMapInt32StringV(v map[int32]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv string hasLen := containerLen > 0 @@ -31773,13 +30334,12 @@ func (_ fastpathT) DecMapInt32StringV(v map[int32]string, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -31798,23 +30358,22 @@ func (_ fastpathT) DecMapInt32StringV(v map[int32]string, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32UintV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32UintV(rv2i(rv).(map[int32]uint), false, d) + return } + 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 { + if v, changed := f.DecMapInt32UintV(*vp, true, d); 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) @@ -31825,6 +30384,7 @@ func (_ fastpathT) DecMapInt32UintV(v map[int32]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv uint hasLen := containerLen > 0 @@ -31832,20 +30392,19 @@ func (_ fastpathT) DecMapInt32UintV(v map[int32]uint, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -31857,23 +30416,22 @@ func (_ fastpathT) DecMapInt32UintV(v map[int32]uint, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32Uint8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32Uint8V(rv2i(rv).(map[int32]uint8), false, d) + return } + 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 { + if v, changed := f.DecMapInt32Uint8V(*vp, true, d); 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) @@ -31884,6 +30442,7 @@ func (_ fastpathT) DecMapInt32Uint8V(v map[int32]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv uint8 hasLen := containerLen > 0 @@ -31891,20 +30450,19 @@ func (_ fastpathT) DecMapInt32Uint8V(v map[int32]uint8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -31916,23 +30474,22 @@ func (_ fastpathT) DecMapInt32Uint8V(v map[int32]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32Uint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32Uint16V(rv2i(rv).(map[int32]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapInt32Uint16V(*vp, true, d); 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) @@ -31943,6 +30500,7 @@ func (_ fastpathT) DecMapInt32Uint16V(v map[int32]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv uint16 hasLen := containerLen > 0 @@ -31950,20 +30508,19 @@ func (_ fastpathT) DecMapInt32Uint16V(v map[int32]uint16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -31975,23 +30532,22 @@ func (_ fastpathT) DecMapInt32Uint16V(v map[int32]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32Uint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32Uint32V(rv2i(rv).(map[int32]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapInt32Uint32V(*vp, true, d); 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) @@ -32002,6 +30558,7 @@ func (_ fastpathT) DecMapInt32Uint32V(v map[int32]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv uint32 hasLen := containerLen > 0 @@ -32009,20 +30566,19 @@ func (_ fastpathT) DecMapInt32Uint32V(v map[int32]uint32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -32034,23 +30590,22 @@ func (_ fastpathT) DecMapInt32Uint32V(v map[int32]uint32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32Uint64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32Uint64V(rv2i(rv).(map[int32]uint64), false, d) + return } + 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 { + if v, changed := f.DecMapInt32Uint64V(*vp, true, d); 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) @@ -32061,6 +30616,7 @@ func (_ fastpathT) DecMapInt32Uint64V(v map[int32]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv uint64 hasLen := containerLen > 0 @@ -32068,20 +30624,19 @@ func (_ fastpathT) DecMapInt32Uint64V(v map[int32]uint64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -32093,23 +30648,22 @@ func (_ fastpathT) DecMapInt32Uint64V(v map[int32]uint64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32UintptrV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32UintptrV(rv2i(rv).(map[int32]uintptr), false, d) + return } + 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 { + if v, changed := f.DecMapInt32UintptrV(*vp, true, d); 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) @@ -32120,6 +30674,7 @@ func (_ fastpathT) DecMapInt32UintptrV(v map[int32]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv uintptr hasLen := containerLen > 0 @@ -32127,20 +30682,19 @@ func (_ fastpathT) DecMapInt32UintptrV(v map[int32]uintptr, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -32152,23 +30706,22 @@ func (_ fastpathT) DecMapInt32UintptrV(v map[int32]uintptr, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32IntV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32IntV(rv2i(rv).(map[int32]int), false, d) + return } + 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 { + if v, changed := f.DecMapInt32IntV(*vp, true, d); 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) @@ -32179,6 +30732,7 @@ func (_ fastpathT) DecMapInt32IntV(v map[int32]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv int hasLen := containerLen > 0 @@ -32186,20 +30740,19 @@ func (_ fastpathT) DecMapInt32IntV(v map[int32]int, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -32211,23 +30764,22 @@ func (_ fastpathT) DecMapInt32IntV(v map[int32]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32Int8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32Int8V(rv2i(rv).(map[int32]int8), false, d) + return } + 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 { + if v, changed := f.DecMapInt32Int8V(*vp, true, d); 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) @@ -32238,6 +30790,7 @@ func (_ fastpathT) DecMapInt32Int8V(v map[int32]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv int8 hasLen := containerLen > 0 @@ -32245,20 +30798,19 @@ func (_ fastpathT) DecMapInt32Int8V(v map[int32]int8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -32270,23 +30822,22 @@ func (_ fastpathT) DecMapInt32Int8V(v map[int32]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32Int16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32Int16V(rv2i(rv).(map[int32]int16), false, d) + return } + 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 { + if v, changed := f.DecMapInt32Int16V(*vp, true, d); 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) @@ -32297,6 +30848,7 @@ func (_ fastpathT) DecMapInt32Int16V(v map[int32]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv int16 hasLen := containerLen > 0 @@ -32304,20 +30856,19 @@ func (_ fastpathT) DecMapInt32Int16V(v map[int32]int16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -32329,23 +30880,22 @@ func (_ fastpathT) DecMapInt32Int16V(v map[int32]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32Int32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32Int32V(rv2i(rv).(map[int32]int32), false, d) + return } + 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 { + if v, changed := f.DecMapInt32Int32V(*vp, true, d); 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) @@ -32356,6 +30906,7 @@ func (_ fastpathT) DecMapInt32Int32V(v map[int32]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv int32 hasLen := containerLen > 0 @@ -32363,20 +30914,19 @@ func (_ fastpathT) DecMapInt32Int32V(v map[int32]int32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -32388,23 +30938,22 @@ func (_ fastpathT) DecMapInt32Int32V(v map[int32]int32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32Int64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32Int64V(rv2i(rv).(map[int32]int64), false, d) + return } + 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 { + if v, changed := f.DecMapInt32Int64V(*vp, true, d); 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) @@ -32415,6 +30964,7 @@ func (_ fastpathT) DecMapInt32Int64V(v map[int32]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv int64 hasLen := containerLen > 0 @@ -32422,20 +30972,19 @@ func (_ fastpathT) DecMapInt32Int64V(v map[int32]int64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -32447,23 +30996,22 @@ func (_ fastpathT) DecMapInt32Int64V(v map[int32]int64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32Float32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32Float32V(rv2i(rv).(map[int32]float32), false, d) + return } + 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 { + if v, changed := f.DecMapInt32Float32V(*vp, true, d); 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) @@ -32474,6 +31022,7 @@ func (_ fastpathT) DecMapInt32Float32V(v map[int32]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv float32 hasLen := containerLen > 0 @@ -32481,20 +31030,19 @@ func (_ fastpathT) DecMapInt32Float32V(v map[int32]float32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -32506,23 +31054,22 @@ func (_ fastpathT) DecMapInt32Float32V(v map[int32]float32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32Float64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32Float64V(rv2i(rv).(map[int32]float64), false, d) + return } + 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 { + if v, changed := f.DecMapInt32Float64V(*vp, true, d); 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) @@ -32533,6 +31080,7 @@ func (_ fastpathT) DecMapInt32Float64V(v map[int32]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv float64 hasLen := containerLen > 0 @@ -32540,20 +31088,19 @@ func (_ fastpathT) DecMapInt32Float64V(v map[int32]float64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -32565,23 +31112,22 @@ func (_ fastpathT) DecMapInt32Float64V(v map[int32]float64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt32BoolV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt32BoolV(rv2i(rv).(map[int32]bool), false, d) + return } + 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 { + if v, changed := f.DecMapInt32BoolV(*vp, true, d); 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) @@ -32592,6 +31138,7 @@ func (_ fastpathT) DecMapInt32BoolV(v map[int32]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int32 var mv bool hasLen := containerLen > 0 @@ -32599,13 +31146,12 @@ func (_ fastpathT) DecMapInt32BoolV(v map[int32]bool, canChange bool, if esep { dd.ReadMapElemKey() } - mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mk = int32(dd.DecodeInt(32)) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -32624,23 +31170,22 @@ func (_ fastpathT) DecMapInt32BoolV(v map[int32]bool, canChange bool, 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 { - fastpathTV.DecMapInt64IntfV(rv2i(rv).(map[int64]interface{}), false, d) + return } + fastpathTV.DecMapInt64IntfV(rv2i(rv).(map[int64]interface{}), false, d) } 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, d *Decoder) (_ map[int64]interface{}, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -32651,7 +31196,7 @@ func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk int64 var mv interface{} hasLen := containerLen > 0 @@ -32659,13 +31204,12 @@ func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -32689,23 +31233,22 @@ func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, canChange bool, 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 { - fastpathTV.DecMapInt64StringV(rv2i(rv).(map[int64]string), false, d) + return } + fastpathTV.DecMapInt64StringV(rv2i(rv).(map[int64]string), false, d) } 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, d *Decoder) (_ map[int64]string, changed bool) { dd, esep := d.d, d.hh.hasElemSeparators() + containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) @@ -32716,6 +31259,7 @@ func (_ fastpathT) DecMapInt64StringV(v map[int64]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv string hasLen := containerLen > 0 @@ -32723,13 +31267,12 @@ func (_ fastpathT) DecMapInt64StringV(v map[int64]string, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -32748,23 +31291,22 @@ func (_ fastpathT) DecMapInt64StringV(v map[int64]string, canChange bool, func (d *Decoder) fastpathDecMapInt64UintR(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 { + if v, changed := fastpathTV.DecMapInt64UintV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64UintV(rv2i(rv).(map[int64]uint), false, d) + return } + fastpathTV.DecMapInt64UintV(rv2i(rv).(map[int64]uint), false, d) } func (f fastpathT) DecMapInt64UintX(vp *map[int64]uint, d *Decoder) { - v, changed := f.DecMapInt64UintV(*vp, true, d) - if changed { + if v, changed := f.DecMapInt64UintV(*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() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) @@ -32775,6 +31317,7 @@ func (_ fastpathT) DecMapInt64UintV(v map[int64]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv uint hasLen := containerLen > 0 @@ -32782,20 +31325,19 @@ func (_ fastpathT) DecMapInt64UintV(v map[int64]uint, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -32807,23 +31349,22 @@ func (_ fastpathT) DecMapInt64UintV(v map[int64]uint, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt64Uint8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64Uint8V(rv2i(rv).(map[int64]uint8), false, d) + return } + 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 { + if v, changed := f.DecMapInt64Uint8V(*vp, true, d); 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) @@ -32834,6 +31375,7 @@ func (_ fastpathT) DecMapInt64Uint8V(v map[int64]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv uint8 hasLen := containerLen > 0 @@ -32841,20 +31383,19 @@ func (_ fastpathT) DecMapInt64Uint8V(v map[int64]uint8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -32866,23 +31407,22 @@ func (_ fastpathT) DecMapInt64Uint8V(v map[int64]uint8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt64Uint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64Uint16V(rv2i(rv).(map[int64]uint16), false, d) + return } + 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 { + if v, changed := f.DecMapInt64Uint16V(*vp, true, d); 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) @@ -32893,6 +31433,7 @@ func (_ fastpathT) DecMapInt64Uint16V(v map[int64]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv uint16 hasLen := containerLen > 0 @@ -32900,20 +31441,19 @@ func (_ fastpathT) DecMapInt64Uint16V(v map[int64]uint16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -32925,23 +31465,22 @@ func (_ fastpathT) DecMapInt64Uint16V(v map[int64]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt64Uint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64Uint32V(rv2i(rv).(map[int64]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapInt64Uint32V(*vp, true, d); 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) @@ -32952,6 +31491,7 @@ func (_ fastpathT) DecMapInt64Uint32V(v map[int64]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv uint32 hasLen := containerLen > 0 @@ -32959,20 +31499,19 @@ func (_ fastpathT) DecMapInt64Uint32V(v map[int64]uint32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -32984,23 +31523,22 @@ func (_ fastpathT) DecMapInt64Uint32V(v map[int64]uint32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt64Uint64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64Uint64V(rv2i(rv).(map[int64]uint64), false, d) + return } + 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 { + if v, changed := f.DecMapInt64Uint64V(*vp, true, d); 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) @@ -33011,6 +31549,7 @@ func (_ fastpathT) DecMapInt64Uint64V(v map[int64]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv uint64 hasLen := containerLen > 0 @@ -33018,20 +31557,19 @@ func (_ fastpathT) DecMapInt64Uint64V(v map[int64]uint64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -33043,23 +31581,22 @@ func (_ fastpathT) DecMapInt64Uint64V(v map[int64]uint64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt64UintptrV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64UintptrV(rv2i(rv).(map[int64]uintptr), false, d) + return } + 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 { + if v, changed := f.DecMapInt64UintptrV(*vp, true, d); 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) @@ -33070,6 +31607,7 @@ func (_ fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv uintptr hasLen := containerLen > 0 @@ -33077,20 +31615,19 @@ func (_ fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -33102,23 +31639,22 @@ func (_ fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt64IntV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64IntV(rv2i(rv).(map[int64]int), false, d) + return } + 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 { + if v, changed := f.DecMapInt64IntV(*vp, true, d); 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) @@ -33129,6 +31665,7 @@ func (_ fastpathT) DecMapInt64IntV(v map[int64]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv int hasLen := containerLen > 0 @@ -33136,20 +31673,19 @@ func (_ fastpathT) DecMapInt64IntV(v map[int64]int, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -33161,23 +31697,22 @@ func (_ fastpathT) DecMapInt64IntV(v map[int64]int, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt64Int8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64Int8V(rv2i(rv).(map[int64]int8), false, d) + return } + 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 { + if v, changed := f.DecMapInt64Int8V(*vp, true, d); 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) @@ -33188,6 +31723,7 @@ func (_ fastpathT) DecMapInt64Int8V(v map[int64]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv int8 hasLen := containerLen > 0 @@ -33195,20 +31731,19 @@ func (_ fastpathT) DecMapInt64Int8V(v map[int64]int8, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -33220,23 +31755,22 @@ func (_ fastpathT) DecMapInt64Int8V(v map[int64]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt64Int16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64Int16V(rv2i(rv).(map[int64]int16), false, d) + return } + 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 { + if v, changed := f.DecMapInt64Int16V(*vp, true, d); 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) @@ -33247,6 +31781,7 @@ func (_ fastpathT) DecMapInt64Int16V(v map[int64]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv int16 hasLen := containerLen > 0 @@ -33254,20 +31789,19 @@ func (_ fastpathT) DecMapInt64Int16V(v map[int64]int16, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -33279,23 +31813,22 @@ func (_ fastpathT) DecMapInt64Int16V(v map[int64]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt64Int32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64Int32V(rv2i(rv).(map[int64]int32), false, d) + return } + 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 { + if v, changed := f.DecMapInt64Int32V(*vp, true, d); 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) @@ -33306,6 +31839,7 @@ func (_ fastpathT) DecMapInt64Int32V(v map[int64]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv int32 hasLen := containerLen > 0 @@ -33313,20 +31847,19 @@ func (_ fastpathT) DecMapInt64Int32V(v map[int64]int32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -33338,23 +31871,22 @@ func (_ fastpathT) DecMapInt64Int32V(v map[int64]int32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt64Int64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64Int64V(rv2i(rv).(map[int64]int64), false, d) + return } + 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 { + if v, changed := f.DecMapInt64Int64V(*vp, true, d); 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) @@ -33365,6 +31897,7 @@ func (_ fastpathT) DecMapInt64Int64V(v map[int64]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv int64 hasLen := containerLen > 0 @@ -33372,20 +31905,19 @@ func (_ fastpathT) DecMapInt64Int64V(v map[int64]int64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -33397,23 +31929,22 @@ func (_ fastpathT) DecMapInt64Int64V(v map[int64]int64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt64Float32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64Float32V(rv2i(rv).(map[int64]float32), false, d) + return } + 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 { + if v, changed := f.DecMapInt64Float32V(*vp, true, d); 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) @@ -33424,6 +31955,7 @@ func (_ fastpathT) DecMapInt64Float32V(v map[int64]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv float32 hasLen := containerLen > 0 @@ -33431,20 +31963,19 @@ func (_ fastpathT) DecMapInt64Float32V(v map[int64]float32, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -33456,23 +31987,22 @@ func (_ fastpathT) DecMapInt64Float32V(v map[int64]float32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt64Float64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64Float64V(rv2i(rv).(map[int64]float64), false, d) + return } + 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 { + if v, changed := f.DecMapInt64Float64V(*vp, true, d); 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) @@ -33483,6 +32013,7 @@ func (_ fastpathT) DecMapInt64Float64V(v map[int64]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv float64 hasLen := containerLen > 0 @@ -33490,20 +32021,19 @@ func (_ fastpathT) DecMapInt64Float64V(v map[int64]float64, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -33515,23 +32045,22 @@ func (_ fastpathT) DecMapInt64Float64V(v map[int64]float64, canChange bool, 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 { + if v, changed := fastpathTV.DecMapInt64BoolV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapInt64BoolV(rv2i(rv).(map[int64]bool), false, d) + return } + 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 { + if v, changed := f.DecMapInt64BoolV(*vp, true, d); 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) @@ -33542,6 +32071,7 @@ func (_ fastpathT) DecMapInt64BoolV(v map[int64]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk int64 var mv bool hasLen := containerLen > 0 @@ -33549,13 +32079,12 @@ func (_ fastpathT) DecMapInt64BoolV(v map[int64]bool, canChange bool, if esep { dd.ReadMapElemKey() } - mk = dd.DecodeInt64() + mk = dd.DecodeInt(64) if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false @@ -33574,23 +32103,22 @@ func (_ fastpathT) DecMapInt64BoolV(v map[int64]bool, canChange bool, 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 { + if v, changed := fastpathTV.DecMapBoolIntfV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolIntfV(rv2i(rv).(map[bool]interface{}), false, d) + return } + 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 { + if v, changed := f.DecMapBoolIntfV(*vp, true, d); 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) @@ -33601,7 +32129,7 @@ func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, canChange bool, dd.ReadMapEnd() return v, changed } - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + mapGet := !d.h.MapValueReset && !d.h.InterfaceReset var mk bool var mv interface{} hasLen := containerLen > 0 @@ -33614,8 +32142,7 @@ func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = nil @@ -33639,23 +32166,22 @@ func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, canChange bool, func (d *Decoder) fastpathDecMapBoolStringR(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 { + if v, changed := fastpathTV.DecMapBoolStringV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolStringV(rv2i(rv).(map[bool]string), false, d) + return } + fastpathTV.DecMapBoolStringV(rv2i(rv).(map[bool]string), false, d) } func (f fastpathT) DecMapBoolStringX(vp *map[bool]string, d *Decoder) { - v, changed := f.DecMapBoolStringV(*vp, true, d) - if changed { + if v, changed := f.DecMapBoolStringV(*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() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) @@ -33666,6 +32192,7 @@ func (_ fastpathT) DecMapBoolStringV(v map[bool]string, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv string hasLen := containerLen > 0 @@ -33678,8 +32205,7 @@ func (_ fastpathT) DecMapBoolStringV(v map[bool]string, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = "" @@ -33698,23 +32224,22 @@ func (_ fastpathT) DecMapBoolStringV(v map[bool]string, canChange bool, 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 { + if v, changed := fastpathTV.DecMapBoolUintV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolUintV(rv2i(rv).(map[bool]uint), false, d) + return } + 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 { + if v, changed := f.DecMapBoolUintV(*vp, true, d); 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) @@ -33725,6 +32250,7 @@ func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv uint hasLen := containerLen > 0 @@ -33737,15 +32263,14 @@ func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -33757,23 +32282,22 @@ func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, canChange bool, func (d *Decoder) fastpathDecMapBoolUint8R(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 { + if v, changed := fastpathTV.DecMapBoolUint8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolUint8V(rv2i(rv).(map[bool]uint8), false, d) + return } + fastpathTV.DecMapBoolUint8V(rv2i(rv).(map[bool]uint8), false, d) } func (f fastpathT) DecMapBoolUint8X(vp *map[bool]uint8, d *Decoder) { - v, changed := f.DecMapBoolUint8V(*vp, true, d) - if changed { + if v, changed := f.DecMapBoolUint8V(*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() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) @@ -33784,6 +32308,7 @@ func (_ fastpathT) DecMapBoolUint8V(v map[bool]uint8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv uint8 hasLen := containerLen > 0 @@ -33796,15 +32321,14 @@ func (_ fastpathT) DecMapBoolUint8V(v map[bool]uint8, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } @@ -33816,23 +32340,22 @@ func (_ fastpathT) DecMapBoolUint8V(v map[bool]uint8, canChange bool, func (d *Decoder) fastpathDecMapBoolUint16R(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 { + if v, changed := fastpathTV.DecMapBoolUint16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolUint16V(rv2i(rv).(map[bool]uint16), false, d) + return } + fastpathTV.DecMapBoolUint16V(rv2i(rv).(map[bool]uint16), false, d) } func (f fastpathT) DecMapBoolUint16X(vp *map[bool]uint16, d *Decoder) { - v, changed := f.DecMapBoolUint16V(*vp, true, d) - if changed { + if v, changed := f.DecMapBoolUint16V(*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() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) @@ -33843,6 +32366,7 @@ func (_ fastpathT) DecMapBoolUint16V(v map[bool]uint16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv uint16 hasLen := containerLen > 0 @@ -33855,15 +32379,14 @@ func (_ fastpathT) DecMapBoolUint16V(v map[bool]uint16, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } @@ -33875,23 +32398,22 @@ func (_ fastpathT) DecMapBoolUint16V(v map[bool]uint16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapBoolUint32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolUint32V(rv2i(rv).(map[bool]uint32), false, d) + return } + 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 { + if v, changed := f.DecMapBoolUint32V(*vp, true, d); 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) @@ -33902,6 +32424,7 @@ func (_ fastpathT) DecMapBoolUint32V(v map[bool]uint32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv uint32 hasLen := containerLen > 0 @@ -33914,15 +32437,14 @@ func (_ fastpathT) DecMapBoolUint32V(v map[bool]uint32, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } @@ -33934,23 +32456,22 @@ func (_ fastpathT) DecMapBoolUint32V(v map[bool]uint32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapBoolUint64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolUint64V(rv2i(rv).(map[bool]uint64), false, d) + return } + 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 { + if v, changed := f.DecMapBoolUint64V(*vp, true, d); 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) @@ -33961,6 +32482,7 @@ func (_ fastpathT) DecMapBoolUint64V(v map[bool]uint64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv uint64 hasLen := containerLen > 0 @@ -33973,15 +32495,14 @@ func (_ fastpathT) DecMapBoolUint64V(v map[bool]uint64, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeUint64() + mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } @@ -33993,23 +32514,22 @@ func (_ fastpathT) DecMapBoolUint64V(v map[bool]uint64, canChange bool, func (d *Decoder) fastpathDecMapBoolUintptrR(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 { + if v, changed := fastpathTV.DecMapBoolUintptrV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolUintptrV(rv2i(rv).(map[bool]uintptr), false, d) + return } + fastpathTV.DecMapBoolUintptrV(rv2i(rv).(map[bool]uintptr), false, d) } func (f fastpathT) DecMapBoolUintptrX(vp *map[bool]uintptr, d *Decoder) { - v, changed := f.DecMapBoolUintptrV(*vp, true, d) - if changed { + if v, changed := f.DecMapBoolUintptrV(*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() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -34020,6 +32540,7 @@ func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv uintptr hasLen := containerLen > 0 @@ -34032,15 +32553,14 @@ func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } @@ -34052,23 +32572,22 @@ func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, canChange bool, func (d *Decoder) fastpathDecMapBoolIntR(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 { + if v, changed := fastpathTV.DecMapBoolIntV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolIntV(rv2i(rv).(map[bool]int), false, d) + return } + fastpathTV.DecMapBoolIntV(rv2i(rv).(map[bool]int), false, d) } func (f fastpathT) DecMapBoolIntX(vp *map[bool]int, d *Decoder) { - v, changed := f.DecMapBoolIntV(*vp, true, d) - if changed { + if v, changed := f.DecMapBoolIntV(*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() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -34079,6 +32598,7 @@ func (_ fastpathT) DecMapBoolIntV(v map[bool]int, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv int hasLen := containerLen > 0 @@ -34091,15 +32611,14 @@ func (_ fastpathT) DecMapBoolIntV(v map[bool]int, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } @@ -34111,23 +32630,22 @@ func (_ fastpathT) DecMapBoolIntV(v map[bool]int, canChange bool, func (d *Decoder) fastpathDecMapBoolInt8R(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 { + if v, changed := fastpathTV.DecMapBoolInt8V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolInt8V(rv2i(rv).(map[bool]int8), false, d) + return } + fastpathTV.DecMapBoolInt8V(rv2i(rv).(map[bool]int8), false, d) } func (f fastpathT) DecMapBoolInt8X(vp *map[bool]int8, d *Decoder) { - v, changed := f.DecMapBoolInt8V(*vp, true, d) - if changed { + if v, changed := f.DecMapBoolInt8V(*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() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) @@ -34138,6 +32656,7 @@ func (_ fastpathT) DecMapBoolInt8V(v map[bool]int8, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv int8 hasLen := containerLen > 0 @@ -34150,15 +32669,14 @@ func (_ fastpathT) DecMapBoolInt8V(v map[bool]int8, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } @@ -34170,23 +32688,22 @@ func (_ fastpathT) DecMapBoolInt8V(v map[bool]int8, canChange bool, 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 { + if v, changed := fastpathTV.DecMapBoolInt16V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolInt16V(rv2i(rv).(map[bool]int16), false, d) + return } + 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 { + if v, changed := f.DecMapBoolInt16V(*vp, true, d); 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) @@ -34197,6 +32714,7 @@ func (_ fastpathT) DecMapBoolInt16V(v map[bool]int16, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv int16 hasLen := containerLen > 0 @@ -34209,15 +32727,14 @@ func (_ fastpathT) DecMapBoolInt16V(v map[bool]int16, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } @@ -34229,23 +32746,22 @@ func (_ fastpathT) DecMapBoolInt16V(v map[bool]int16, canChange bool, 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 { + if v, changed := fastpathTV.DecMapBoolInt32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolInt32V(rv2i(rv).(map[bool]int32), false, d) + return } + 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 { + if v, changed := f.DecMapBoolInt32V(*vp, true, d); 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) @@ -34256,6 +32772,7 @@ func (_ fastpathT) DecMapBoolInt32V(v map[bool]int32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv int32 hasLen := containerLen > 0 @@ -34268,15 +32785,14 @@ func (_ fastpathT) DecMapBoolInt32V(v map[bool]int32, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } @@ -34288,23 +32804,22 @@ func (_ fastpathT) DecMapBoolInt32V(v map[bool]int32, canChange bool, 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 { + if v, changed := fastpathTV.DecMapBoolInt64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolInt64V(rv2i(rv).(map[bool]int64), false, d) + return } + 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 { + if v, changed := f.DecMapBoolInt64V(*vp, true, d); 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) @@ -34315,6 +32830,7 @@ func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv int64 hasLen := containerLen > 0 @@ -34327,15 +32843,14 @@ func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeInt64() + mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } @@ -34347,23 +32862,22 @@ func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, canChange bool, func (d *Decoder) fastpathDecMapBoolFloat32R(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 { + if v, changed := fastpathTV.DecMapBoolFloat32V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolFloat32V(rv2i(rv).(map[bool]float32), false, d) + return } + fastpathTV.DecMapBoolFloat32V(rv2i(rv).(map[bool]float32), false, d) } func (f fastpathT) DecMapBoolFloat32X(vp *map[bool]float32, d *Decoder) { - v, changed := f.DecMapBoolFloat32V(*vp, true, d) - if changed { + if v, changed := f.DecMapBoolFloat32V(*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() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) @@ -34374,6 +32888,7 @@ func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv float32 hasLen := containerLen > 0 @@ -34386,15 +32901,14 @@ func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } @@ -34406,23 +32920,22 @@ func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, canChange bool, func (d *Decoder) fastpathDecMapBoolFloat64R(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 { + if v, changed := fastpathTV.DecMapBoolFloat64V(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolFloat64V(rv2i(rv).(map[bool]float64), false, d) + return } + fastpathTV.DecMapBoolFloat64V(rv2i(rv).(map[bool]float64), false, d) } func (f fastpathT) DecMapBoolFloat64X(vp *map[bool]float64, d *Decoder) { - v, changed := f.DecMapBoolFloat64V(*vp, true, d) - if changed { + if v, changed := f.DecMapBoolFloat64V(*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() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) @@ -34433,6 +32946,7 @@ func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv float64 hasLen := containerLen > 0 @@ -34445,15 +32959,14 @@ func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = 0 } continue } - mv = dd.DecodeFloat64() + mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } @@ -34465,23 +32978,22 @@ func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, canChange bool, func (d *Decoder) fastpathDecMapBoolBoolR(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 { + if v, changed := fastpathTV.DecMapBoolBoolV(*vp, true, d); changed { *vp = v } - } else { - fastpathTV.DecMapBoolBoolV(rv2i(rv).(map[bool]bool), false, d) + return } + fastpathTV.DecMapBoolBoolV(rv2i(rv).(map[bool]bool), false, d) } func (f fastpathT) DecMapBoolBoolX(vp *map[bool]bool, d *Decoder) { - v, changed := f.DecMapBoolBoolV(*vp, true, d) - if changed { + if v, changed := f.DecMapBoolBoolV(*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() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) @@ -34492,6 +33004,7 @@ func (_ fastpathT) DecMapBoolBoolV(v map[bool]bool, canChange bool, dd.ReadMapEnd() return v, changed } + var mk bool var mv bool hasLen := containerLen > 0 @@ -34504,8 +33017,7 @@ func (_ fastpathT) DecMapBoolBoolV(v map[bool]bool, canChange bool, dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { + if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = false diff --git a/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl b/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl index 2023e05d..eebc31b3 100644 --- a/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl @@ -3,7 +3,10 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. -// Code generated from fast-path.go.tmpl - DO NOT EDIT. +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED from fast-path.go.tmpl +// ************************************************************ package codec @@ -15,19 +18,19 @@ package codec // This file can be omitted without causing a build failure. // // The advantage of fast paths is: -// - Many calls bypass reflection altogether +// - 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, +// - map of all builtin types to string or interface value +// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8) // This should provide adequate "typical" implementations. // // Note that fast track decode functions must handle values for which an address cannot be obtained. // For example: -// m2 := map[string]int{} -// p2 := []interface{}{m2} -// // decoding into p2 will bomb if fast track functions do not treat like unaddressable. +// m2 := map[string]int{} +// p2 := []interface{}{m2} +// // decoding into p2 will bomb if fast track functions do not treat like unaddressable. // import ( @@ -83,13 +86,17 @@ func init() { fd func(*Decoder, *codecFnInfo, reflect.Value)) (f fastpathE) { xrt := reflect.TypeOf(v) xptr := rt2id(xrt) + if useLookupRecognizedTypes { + recognizedRtids = append(recognizedRtids, xptr) + recognizedRtidPtrs = append(recognizedRtidPtrs, rt2id(reflect.PtrTo(xrt))) + } fastpathAV[i] = fastpathE{xptr, xrt, fe, fd} i++ return } - {{/* do not register []uint8 in fast-path */}} - {{range .Values}}{{if not .Primitive}}{{if not .MapKey }}{{if ne .Elem "uint8"}} - fn([]{{ .Elem }}(nil), (*Encoder).{{ .MethodNamePfx "fastpathEnc" false }}R, (*Decoder).{{ .MethodNamePfx "fastpathDec" false }}R){{end}}{{end}}{{end}}{{end}} + + {{range .Values}}{{if not .Primitive}}{{if not .MapKey }} + fn([]{{ .Elem }}(nil), (*Encoder).{{ .MethodNamePfx "fastpathEnc" false }}R, (*Decoder).{{ .MethodNamePfx "fastpathDec" false }}R){{end}}{{end}}{{end}} {{range .Values}}{{if not .Primitive}}{{if .MapKey }} fn(map[{{ .MapKey }}]{{ .Elem }}(nil), (*Encoder).{{ .MethodNamePfx "fastpathEnc" false }}R, (*Decoder).{{ .MethodNamePfx "fastpathDec" false }}R){{end}}{{end}}{{end}} @@ -102,37 +109,21 @@ func init() { // -- -- fast path type switch func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { switch v := iv.(type) { - -{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}{{if ne .Elem "uint8"}} - case []{{ .Elem }}: - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, e) - case *[]{{ .Elem }}: - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, e){{/* -*/}}{{end}}{{end}}{{end}}{{end}} - -{{range .Values}}{{if not .Primitive}}{{if .MapKey }} - case map[{{ .MapKey }}]{{ .Elem }}: - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, e) - case *map[{{ .MapKey }}]{{ .Elem }}: - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, e){{/* -*/}}{{end}}{{end}}{{end}} - +{{range .Values}}{{if not .Primitive}}{{if not .MapKey }} + case []{{ .Elem }}:{{else}} + case map[{{ .MapKey }}]{{ .Elem }}:{{end}} + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, e){{if not .MapKey }} + case *[]{{ .Elem }}:{{else}} + case *map[{{ .MapKey }}]{{ .Elem }}:{{end}} + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, e) +{{end}}{{end}} default: - _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true } -{{/* -**** removing this block, as they are never called directly **** - - - -**** removing this block, as they are never called directly **** - - - func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { switch v := iv.(type) { {{range .Values}}{{if not .Primitive}}{{if not .MapKey }} @@ -142,7 +133,7 @@ func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, e) {{end}}{{end}}{{end}} default: - _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true @@ -157,23 +148,15 @@ func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, e) {{end}}{{end}}{{end}} default: - _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true } - - -**** removing this block, as they are never called directly **** - - - -**** removing this block, as they are never called directly **** -*/}} - // -- -- fast path functions {{range .Values}}{{if not .Primitive}}{{if not .MapKey }} + func (e *Encoder) {{ .MethodNamePfx "fastpathEnc" false }}R(f *codecFnInfo, rv reflect.Value) { if f.ti.mbs { fastpathTV.{{ .MethodNamePfx "EncAsMap" false }}V(rv2i(rv).([]{{ .Elem }}), e) @@ -182,25 +165,15 @@ func (e *Encoder) {{ .MethodNamePfx "fastpathEnc" false }}R(f *codecFnInfo, rv r } } 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)) - if esep { - for _, v2 := range v { - ee.WriteArrayElem() - {{ encmd .Elem "v2"}} - } - } else { - for _, v2 := range v { - {{ encmd .Elem "v2"}} - } - } {{/* 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 { @@ -208,20 +181,6 @@ func (_ fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, e *En return } ee.WriteMapStart(len(v) / 2) - if esep { - for j, v2 := range v { - if j%2 == 0 { - ee.WriteMapElemKey() - } else { - ee.WriteMapElemValue() - } - {{ encmd .Elem "v2"}} - } - } else { - for _, v2 := range v { - {{ encmd .Elem "v2"}} - } - } {{/* for j, v2 := range v { if esep { if j%2 == 0 { @@ -231,20 +190,22 @@ func (_ fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, e *En } } {{ encmd .Elem "v2"}} - } */}} + } ee.WriteMapEnd() } + {{end}}{{end}}{{end}} {{range .Values}}{{if not .Primitive}}{{if .MapKey }} + 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) { - 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 "string"}}asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + {{end}}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 e2 := NewEncoderBytes(&mksv, e.hh) @@ -260,126 +221,76 @@ func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Ele i++ } sort.Sort(bytesISlice(v2)) - if esep { - for j := range v2 { - ee.WriteMapElemKey() - e.asis(v2[j].v) - ee.WriteMapElemValue() - e.encode(v[v2[j].i]) - } - } else { - for j := range v2 { - e.asis(v2[j].v) - e.encode(v[v2[j].i]) - } - } {{/* for j := range v2 { if esep { ee.WriteMapElemKey() } e.asis(v2[j].v) if esep { ee.WriteMapElemValue() } e.encode(v[v2[j].i]) - } */}} {{else}}{{ $x := sorttype .MapKey true}}v2 := make([]{{ $x }}, len(v)) + } {{else}}{{ $x := sorttype .MapKey true}}v2 := make([]{{ $x }}, len(v)) var i int for k, _ := range v { v2[i] = {{ $x }}(k) i++ } sort.Sort({{ sorttype .MapKey false}}(v2)) - if esep { - for _, k2 := range v2 { - ee.WriteMapElemKey() - {{if eq .MapKey "string"}}ee.EncodeString(cUTF8, k2){{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}} - ee.WriteMapElemValue() - {{ $y := printf "v[%s(k2)]" .MapKey }}{{ encmd .Elem $y }} - } - } else { - for _, k2 := range v2 { - {{if eq .MapKey "string"}}ee.EncodeString(cUTF8, k2){{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}} - {{ $y := printf "v[%s(k2)]" .MapKey }}{{ encmd .Elem $y }} - } - } {{/* for _, k2 := range v2 { if esep { ee.WriteMapElemKey() } - {{if eq .MapKey "string"}}ee.EncodeString(cUTF8, k2){{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}} + {{if eq .MapKey "string"}}if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + }{{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}} if esep { ee.WriteMapElemValue() } {{ $y := printf "v[%s(k2)]" .MapKey }}{{ encmd .Elem $y }} - } */}} {{end}} + } {{end}} } else { - if esep { - for k2, v2 := range v { - ee.WriteMapElemKey() - {{if eq .MapKey "string"}}ee.EncodeString(cUTF8, k2){{else}}{{ encmd .MapKey "k2"}}{{end}} - ee.WriteMapElemValue() - {{ encmd .Elem "v2"}} - } - } else { - for k2, v2 := range v { - {{if eq .MapKey "string"}}ee.EncodeString(cUTF8, k2){{else}}{{ encmd .MapKey "k2"}}{{end}} - {{ encmd .Elem "v2"}} - } - } {{/* for k2, v2 := range v { if esep { ee.WriteMapElemKey() } - {{if eq .MapKey "string"}}ee.EncodeString(cUTF8, k2){{else}}{{ encmd .MapKey "k2"}}{{end}} + {{if eq .MapKey "string"}}if asSymbols { + ee.EncodeSymbol(k2) + } else { + ee.EncodeString(c_UTF8, k2) + }{{else}}{{ encmd .MapKey "k2"}}{{end}} if esep { ee.WriteMapElemValue() } {{ encmd .Elem "v2"}} - } */}} + } } ee.WriteMapEnd() } + {{end}}{{end}}{{end}} // -- decode // -- -- fast path type switch func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { - var changed bool switch v := iv.(type) { -{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}{{if ne .Elem "uint8"}} - case []{{ .Elem }}: - var v2 []{{ .Elem }} - v2, changed = fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, false, d) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) +{{range .Values}}{{if not .Primitive}}{{if not .MapKey }} + case []{{ .Elem }}:{{else}} + case map[{{ .MapKey }}]{{ .Elem }}:{{end}} + fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, false, d){{if not .MapKey }} + case *[]{{ .Elem }}: {{else}} + case *map[{{ .MapKey }}]{{ .Elem }}: {{end}} + if v2, changed2 := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*v, true, d); changed2 { + *v = v2 } - case *[]{{ .Elem }}: - var v2 []{{ .Elem }} - v2, changed = fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*v, true, d) - if changed { - *v = v2 - }{{/* -*/}}{{end}}{{end}}{{end}}{{end}} -{{range .Values}}{{if not .Primitive}}{{if .MapKey }}{{/* -// maps only change if nil, and in that case, there's no point copying -*/}} - case map[{{ .MapKey }}]{{ .Elem }}: - fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, false, d) - case *map[{{ .MapKey }}]{{ .Elem }}: - var v2 map[{{ .MapKey }}]{{ .Elem }} - v2, changed = fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*v, true, d) - if changed { - *v = v2 - }{{/* -*/}}{{end}}{{end}}{{end}} +{{end}}{{end}} default: - _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true } -func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { +func fastpathDecodeSetZeroTypeSwitch(iv interface{}, d *Decoder) bool { switch v := iv.(type) { {{range .Values}}{{if not .Primitive}}{{if not .MapKey }} - case *[]{{ .Elem }}: - *v = nil {{/* -*/}}{{end}}{{end}}{{end}} -{{range .Values}}{{if not .Primitive}}{{if .MapKey }} - case *map[{{ .MapKey }}]{{ .Elem }}: - *v = nil {{/* -*/}}{{end}}{{end}}{{end}} + case *[]{{ .Elem }}: {{else}} + case *map[{{ .MapKey }}]{{ .Elem }}: {{end}} + *v = nil +{{end}}{{end}} default: - _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true @@ -393,36 +304,39 @@ Slices can change if they - are addressable (from a ptr) - are settable (e.g. contained in an interface{}) */}} -func (d *Decoder) {{ .MethodNamePfx "fastpathDec" false }}R(f *codecFnInfo, rv reflect.Value) { +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 } + var vp = rv2i(rv).(*[]{{ .Elem }}) + 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) - if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { - copy(v, v2) - } + fastpathTV.{{ .MethodNamePfx "Dec" false }}V(rv2i(rv).([]{{ .Elem }}), !array, d) } } + 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() - */}} + dd := d.d + {{/* // if dd.isContainerType(valueTypeNil) { dd.TryDecodeAsNil() */}} slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { - if v == nil { v = []{{ .Elem }}{} } else if len(v) != 0 { v = v[:0] } + if v == nil { + v = []{{ .Elem }}{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } slh.End() return v, changed } + hasLen := containerLenS > 0 var xlen int if hasLen && canChange { @@ -441,7 +355,7 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange } j := 0 for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && len(v) == 0 && canChange { + if j == 0 && len(v) == 0 { if hasLen { xlen = decInferLen(containerLenS, d.h.MaxInitLen, {{ .Size }}) } else { @@ -460,12 +374,10 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange d.arrayCannotExpand(len(v), j+1) decodeIntoBlank = true } - } + } slh.ElemContainerState(j) if decodeIntoBlank { d.swallow() - } else if dd.TryDecodeAsNil() { - v[j] = {{ zerocmd .Elem }} } else { {{ if eq .Elem "interface{}" }}d.decode(&v[j]){{ else }}v[j] = {{ decmd .Elem }}{{ end }} } @@ -482,8 +394,10 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange slh.End() return v, changed } + {{end}}{{end}}{{end}} + {{range .Values}}{{if not .Primitive}}{{if .MapKey }} {{/* Maps can change if they are @@ -493,21 +407,22 @@ 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 } - } else { - fastpathTV.{{ .MethodNamePfx "Dec" false }}V(rv2i(rv).(map[{{ .MapKey }}]{{ .Elem }}), false, d) - } + if v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d); changed { + *vp = v + } + return + } + 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, d *Decoder) (_ map[{{ .MapKey }}]{{ .Elem }}, changed bool) { - dd, esep := d.d, d.hh.hasElemSeparators(){{/* - // if dd.isContainerType(valueTypeNil) {dd.TryDecodeAsNil() - */}} + dd, esep := d.d, d.hh.hasElemSeparators() + {{/* // if dd.isContainerType(valueTypeNil) {dd.TryDecodeAsNil() */}} containerLen := dd.ReadMapStart() if canChange && v == nil { xlen := decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }}) @@ -518,8 +433,8 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v map[{{ .MapKey }}]{{ .Ele dd.ReadMapEnd() return v, changed } - {{ if eq .Elem "interface{}" }}mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset - {{end}}var mk {{ .MapKey }} + {{ if eq .Elem "interface{}" }}mapGet := !d.h.MapValueReset && !d.h.InterfaceReset{{end}} + var mk {{ .MapKey }} var mv {{ .Elem }} hasLen := containerLen > 0 for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { @@ -531,14 +446,17 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v map[{{ .MapKey }}]{{ .Ele }{{ else }}mk = {{ decmd .MapKey }}{{ end }} if esep { dd.ReadMapElemValue() } if dd.TryDecodeAsNil() { - if v == nil {} else if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = {{ zerocmd .Elem }} } + 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 v != nil { v[mk] = mv } + if v != nil { + v[mk] = mv + } } dd.ReadMapEnd() return v, changed } + {{end}}{{end}}{{end}} diff --git a/vendor/github.com/ugorji/go/codec/fast-path.not.go b/vendor/github.com/ugorji/go/codec/fast-path.not.go index f11b4674..9573d64a 100644 --- a/vendor/github.com/ugorji/go/codec/fast-path.not.go +++ b/vendor/github.com/ugorji/go/codec/fast-path.not.go @@ -1,6 +1,3 @@ -// 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. - // +build notfastpath package codec @@ -17,11 +14,11 @@ const fastpathEnabled = false // This tag disables fastpath during build, allowing for faster build, test execution, // short-program runs, etc. -func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return false } -func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false } -func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false } -func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false } -func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { return false } +func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return false } +func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false } +func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false } +func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false } +func fastpathDecodeSetZeroTypeSwitch(iv interface{}, d *Decoder) bool { return false } type fastpathT struct{} type fastpathE struct { @@ -34,14 +31,5 @@ type fastpathA [0]fastpathE func (x fastpathA) index(rtid uintptr) int { return -1 } -func (_ fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []uint8, changed bool) { - fn := d.cfer().get(uint8SliceTyp, true, true) - d.kSlice(&fn.i, reflect.ValueOf(&v).Elem()) - return v, true -} - var fastpathAV fastpathA var fastpathTV fastpathT - -// ---- -type TestMammoth2Wrapper struct{} // to allow testMammoth work in notfastpath mode diff --git a/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl index fbe802ed..d9940c0a 100644 --- a/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl @@ -43,7 +43,7 @@ if {{var "l"}} == 0 { {{var "c"}} = true }{{end}} {{var "h"}}.ElemContainerState({{var "j"}}) - {{/* {{var "dn"}} = r.TryDecodeAsNil() */}} + // {{var "dn"}} = r.TryDecodeAsNil() {{if isChan}}{{ $x := printf "%[1]vv%[2]v" .TempVar .Rand }}var {{var $x}} {{ .Typ }} {{ decLineVar $x }} {{var "v"}} <- {{ $x }} diff --git a/vendor/github.com/ugorji/go/codec/gen-helper.generated.go b/vendor/github.com/ugorji/go/codec/gen-helper.generated.go index 917d2828..9293463d 100644 --- a/vendor/github.com/ugorji/go/codec/gen-helper.generated.go +++ b/vendor/github.com/ugorji/go/codec/gen-helper.generated.go @@ -3,7 +3,10 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. -// Code generated from gen-helper.go.tmpl - DO NOT EDIT. +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED from gen-helper.go.tmpl +// ************************************************************ package codec @@ -28,73 +31,30 @@ const GenVersion = 8 // GenHelperEncoder is exported so that it can be used externally by codecgen. // // Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE. -func GenHelperEncoder(e *Encoder) (ge genHelperEncoder, ee genHelperEncDriver) { - ge = genHelperEncoder{e: e} - ee = genHelperEncDriver{encDriver: e.e} - return +func GenHelperEncoder(e *Encoder) (genHelperEncoder, encDriver) { + return genHelperEncoder{e: e}, e.e } // GenHelperDecoder is exported so that it can be used externally by codecgen. // // Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE. -func GenHelperDecoder(d *Decoder) (gd genHelperDecoder, dd genHelperDecDriver) { - gd = genHelperDecoder{d: d} - dd = genHelperDecDriver{decDriver: d.d} - return +func GenHelperDecoder(d *Decoder) (genHelperDecoder, decDriver) { + return genHelperDecoder{d: d}, d.d } -type genHelperEncDriver struct { - encDriver -} - -func (x genHelperEncDriver) EncodeBuiltin(rt uintptr, v interface{}) {} -func (x genHelperEncDriver) EncStructFieldKey(keyType valueType, s string) { - encStructFieldKey(x.encDriver, keyType, s) -} -func (x genHelperEncDriver) EncodeSymbol(s string) { - x.encDriver.EncodeString(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 +// Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE. +func BasicHandleDoNotUse(h Handle) *BasicHandle { + return h.getBasicHandle() } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperEncoder struct { - M must e *Encoder F fastpathT } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperDecoder struct { - C checkOverflow d *Decoder F fastpathT } @@ -106,12 +66,7 @@ func (f genHelperEncoder) EncBasicHandle() *BasicHandle { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncBinary() bool { - return f.e.be // f.e.hh.isBinaryEncoding() -} - -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) IsJSONHandle() bool { - return f.e.js + return f.e.cf.be // f.e.hh.isBinaryEncoding() } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* @@ -124,65 +79,52 @@ func (f genHelperEncoder) EncFallback(iv interface{}) { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncTextMarshal(iv encoding.TextMarshaler) { bs, fnerr := iv.MarshalText() - f.e.marshal(bs, fnerr, false, cUTF8) + f.e.marshal(bs, fnerr, false, c_UTF8) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncJSONMarshal(iv jsonMarshaler) { bs, fnerr := iv.MarshalJSON() - f.e.marshal(bs, fnerr, true, cUTF8) + f.e.marshal(bs, fnerr, true, c_UTF8) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) { bs, fnerr := iv.MarshalBinary() - f.e.marshal(bs, fnerr, false, cRAW) + f.e.marshal(bs, fnerr, false, c_RAW) } // 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) +func (f genHelperEncoder) EncRaw(iv Raw) { + f.e.rawBytes(iv) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) Extension(rtid uintptr) (xfn *extTypeTagFn) { - return f.e.h.getExt(rtid) +func (f genHelperEncoder) TimeRtidIfBinc() uintptr { + if _, ok := f.e.hh.(*BincHandle); ok { + return timeTypId + } + return 0 } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncExtension(v interface{}, xfFn *extTypeTagFn) { - f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e) +func (f genHelperEncoder) IsJSONHandle() bool { + return f.e.cf.js } // 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 } // 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 { + rt := reflect.TypeOf(v) + if rt.Kind() == reflect.Ptr { + rt = rt.Elem() + } + rtid := rt2id(rt) + if xfFn := f.e.h.getExt(rtid); xfFn != nil { f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e) return true } @@ -202,18 +144,15 @@ func (f genHelperDecoder) DecBinary() bool { } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecSwallow() { f.d.swallow() } +func (f genHelperDecoder) DecSwallow() { + f.d.swallow() +} // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecScratchBuffer() []byte { return f.d.b[:] } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte { - return &f.d.b -} - // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) { // println(">>>>>>>>> DecFallback") @@ -221,7 +160,7 @@ func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) { if chkPtr { rv = f.d.ensureDecodeable(rv) } - f.d.decodeValue(rv, nil, false) + f.d.decodeValue(rv, nil, false, false) // f.d.decodeValueFallback(rv) } @@ -267,21 +206,17 @@ 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() } +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 -// } +func (f genHelperDecoder) TimeRtidIfBinc() uintptr { + 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 { @@ -289,34 +224,15 @@ func (f genHelperDecoder) IsJSONHandle() bool { } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) I2Rtid(v interface{}) uintptr { - return i2rtid(v) -} - -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) Extension(rtid uintptr) (xfn *extTypeTagFn) { - return f.d.h.getExt(rtid) -} - -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -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 { + rt := reflect.TypeOf(v).Elem() + rtid := rt2id(rt) + if xfFn := f.d.h.getExt(rtid); xfFn != nil { f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext) return true } @@ -329,7 +245,6 @@ func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int) { } // 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) } +func (f genHelperDecoder) StringView(v []byte) string { + return stringView(v) +} diff --git a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl index 6aeb8565..dfa1def2 100644 --- a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl @@ -3,7 +3,10 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. -// Code generated from gen-helper.go.tmpl - DO NOT EDIT. +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED from gen-helper.go.tmpl +// ************************************************************ package codec @@ -18,83 +21,40 @@ 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. -// +// // Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE. -func GenHelperEncoder(e *Encoder) (ge genHelperEncoder, ee genHelperEncDriver) { - ge = genHelperEncoder{e: e} - ee = genHelperEncDriver{encDriver: e.e} - return +func GenHelperEncoder(e *Encoder) (genHelperEncoder, encDriver) { + return genHelperEncoder{e:e}, e.e } // GenHelperDecoder is exported so that it can be used externally by codecgen. -// +// // Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE. -func GenHelperDecoder(d *Decoder) (gd genHelperDecoder, dd genHelperDecDriver) { - gd = genHelperDecoder{d: d} - dd = genHelperDecDriver{decDriver: d.d} - return +func GenHelperDecoder(d *Decoder) (genHelperDecoder, decDriver) { + return genHelperDecoder{d:d}, d.d } -type genHelperEncDriver struct { - encDriver -} - -func (x genHelperEncDriver) EncodeBuiltin(rt uintptr, v interface{}) {} -func (x genHelperEncDriver) EncStructFieldKey(keyType valueType, s string) { - encStructFieldKey(x.encDriver, keyType, s) -} -func (x genHelperEncDriver) EncodeSymbol(s string) { - x.encDriver.EncodeString(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 +// Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE. +func BasicHandleDoNotUse(h Handle) *BasicHandle { + return h.getBasicHandle() } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperEncoder struct { - M must e *Encoder F fastpathT } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperDecoder struct { - C checkOverflow d *Decoder F fastpathT } @@ -103,13 +63,10 @@ type genHelperDecoder struct { func (f genHelperEncoder) EncBasicHandle() *BasicHandle { return f.e.h } + // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncBinary() bool { - return f.e.be // f.e.hh.isBinaryEncoding() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) IsJSONHandle() bool { - return f.e.js + return f.e.cf.be // f.e.hh.isBinaryEncoding() } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncFallback(iv interface{}) { @@ -120,61 +77,58 @@ func (f genHelperEncoder) EncFallback(iv interface{}) { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncTextMarshal(iv encoding.TextMarshaler) { bs, fnerr := iv.MarshalText() - f.e.marshal(bs, fnerr, false, cUTF8) + f.e.marshal(bs, fnerr, false, c_UTF8) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncJSONMarshal(iv jsonMarshaler) { bs, fnerr := iv.MarshalJSON() - f.e.marshal(bs, fnerr, true, cUTF8) + f.e.marshal(bs, fnerr, true, c_UTF8) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) { bs, fnerr := iv.MarshalBinary() - f.e.marshal(bs, fnerr, false, cRAW) + f.e.marshal(bs, fnerr, false, c_RAW) } // 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) +func (f genHelperEncoder) EncRaw(iv Raw) { + f.e.rawBytes(iv) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) Extension(rtid uintptr) (xfn *extTypeTagFn) { - return f.e.h.getExt(rtid) +func (f genHelperEncoder) TimeRtidIfBinc() uintptr { + if _, ok := f.e.hh.(*BincHandle); ok { + return timeTypId + } + return 0 } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncExtension(v interface{}, xfFn *extTypeTagFn) { - f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e) +func (f genHelperEncoder) IsJSONHandle() bool { + return f.e.cf.js } // 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 } // 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 { + rt := reflect.TypeOf(v) + if rt.Kind() == reflect.Ptr { + rt = rt.Elem() + } + rtid := rt2id(rt) + if xfFn := f.e.h.getExt(rtid); xfFn != nil { f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e) return true } return false } +{{/* +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncSendContainerState(c containerState) { + if f.e.cr != nil { + f.e.cr.sendContainerState(c) + } +} +*/}} // ---------------- DECODER FOLLOWS ----------------- @@ -187,23 +141,21 @@ func (f genHelperDecoder) DecBinary() bool { return f.d.be // f.d.hh.isBinaryEncoding() } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecSwallow() { f.d.swallow() } +func (f genHelperDecoder) DecSwallow() { + f.d.swallow() +} // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecScratchBuffer() []byte { return f.d.b[:] } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte { - return &f.d.b -} -// 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.decodeValue(rv, nil, false, false) // f.d.decodeValueFallback(rv) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* @@ -242,49 +194,29 @@ 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() } +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 -// } - +func (f genHelperDecoder) TimeRtidIfBinc() uintptr { + 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 } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) I2Rtid(v interface{}) uintptr { - return i2rtid(v) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) Extension(rtid uintptr) (xfn *extTypeTagFn) { - return f.d.h.getExt(rtid) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -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 { + rt := reflect.TypeOf(v).Elem() + rtid := rt2id(rt) + if xfFn := f.d.h.getExt(rtid); xfFn != nil { f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext) return true } @@ -295,8 +227,170 @@ 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) } +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) DecSendContainerState(c containerState) { + if f.d.cr != nil { + f.d.cr.sendContainerState(c) + } +} +*/}} +{{/* + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncDriver() encDriver { + return f.e.e +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecDriver() decDriver { + return f.d.d +} + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncNil() { + f.e.e.EncodeNil() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncBytes(v []byte) { + f.e.e.EncodeStringBytes(c_RAW, v) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncArrayStart(length int) { + f.e.e.EncodeArrayStart(length) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncArrayEnd() { + f.e.e.EncodeArrayEnd() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncArrayEntrySeparator() { + f.e.e.EncodeArrayEntrySeparator() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncMapStart(length int) { + f.e.e.EncodeMapStart(length) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncMapEnd() { + f.e.e.EncodeMapEnd() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncMapEntrySeparator() { + f.e.e.EncodeMapEntrySeparator() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncMapKVSeparator() { + f.e.e.EncodeMapKVSeparator() +} + +// --------- + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecBytes(v *[]byte) { + *v = f.d.d.DecodeBytes(*v) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecTryNil() bool { + return f.d.d.TryDecodeAsNil() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecContainerIsNil() (b bool) { + return f.d.d.IsContainerType(valueTypeNil) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecContainerIsMap() (b bool) { + return f.d.d.IsContainerType(valueTypeMap) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecContainerIsArray() (b bool) { + return f.d.d.IsContainerType(valueTypeArray) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecCheckBreak() bool { + return f.d.d.CheckBreak() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecMapStart() int { + return f.d.d.ReadMapStart() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecArrayStart() int { + return f.d.d.ReadArrayStart() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecMapEnd() { + f.d.d.ReadMapEnd() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecArrayEnd() { + f.d.d.ReadArrayEnd() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecArrayEntrySeparator() { + f.d.d.ReadArrayEntrySeparator() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecMapEntrySeparator() { + f.d.d.ReadMapEntrySeparator() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecMapKVSeparator() { + f.d.d.ReadMapKVSeparator() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) ReadStringAsBytes(bs []byte) []byte { + return f.d.d.DecodeStringAsBytes(bs) +} + + +// -- encode calls (primitives) +{{range .Values}}{{if .Primitive }}{{if ne .Primitive "interface{}" }} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) {{ .MethodNamePfx "Enc" true }}(v {{ .Primitive }}) { + ee := f.e.e + {{ encmd .Primitive "v" }} +} +{{ end }}{{ end }}{{ end }} + +// -- decode calls (primitives) +{{range .Values}}{{if .Primitive }}{{if ne .Primitive "interface{}" }} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) {{ .MethodNamePfx "Dec" true }}(vp *{{ .Primitive }}) { + dd := f.d.d + *vp = {{ decmd .Primitive }} +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) {{ .MethodNamePfx "Read" true }}() (v {{ .Primitive }}) { + dd := f.d.d + v = {{ decmd .Primitive }} + return +} +{{ end }}{{ end }}{{ end }} + + +// -- encode calls (slices/maps) +{{range .Values}}{{if not .Primitive }}{{if .Slice }} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) {{ .MethodNamePfx "Enc" false }}(v []{{ .Elem }}) { {{ else }} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) {{ .MethodNamePfx "Enc" false }}(v map[{{ .MapKey }}]{{ .Elem }}) { {{end}} + f.F.{{ .MethodNamePfx "Enc" false }}V(v, false, f.e) +} +{{ end }}{{ end }} + +// -- decode calls (slices/maps) +{{range .Values}}{{if not .Primitive }} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +{{if .Slice }}func (f genHelperDecoder) {{ .MethodNamePfx "Dec" false }}(vp *[]{{ .Elem }}) { +{{else}}func (f genHelperDecoder) {{ .MethodNamePfx "Dec" false }}(vp *map[{{ .MapKey }}]{{ .Elem }}) { {{end}} + v, changed := f.F.{{ .MethodNamePfx "Dec" false }}V(*vp, false, true, f.d) + if changed { + *vp = v + } +} +{{ end }}{{ end }} +*/}} diff --git a/vendor/github.com/ugorji/go/codec/gen.generated.go b/vendor/github.com/ugorji/go/codec/gen.generated.go index 799bc76e..b50a6024 100644 --- a/vendor/github.com/ugorji/go/codec/gen.generated.go +++ b/vendor/github.com/ugorji/go/codec/gen.generated.go @@ -1,5 +1,3 @@ -// +build codecgen.exec - // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. @@ -98,7 +96,7 @@ if {{var "l"}} == 0 { {{var "c"}} = true }{{end}} {{var "h"}}.ElemContainerState({{var "j"}}) - {{/* {{var "dn"}} = r.TryDecodeAsNil() */}} + // {{var "dn"}} = r.TryDecodeAsNil() {{if isChan}}{{ $x := printf "%[1]vv%[2]v" .TempVar .Rand }}var {{var $x}} {{ .Typ }} {{ decLineVar $x }} {{var "v"}} <- {{ $x }} @@ -131,3 +129,4 @@ if {{var "l"}} == 0 { }{{end}} ` + diff --git a/vendor/github.com/ugorji/go/codec/gen.go b/vendor/github.com/ugorji/go/codec/gen.go index 5794452d..043f10d8 100644 --- a/vendor/github.com/ugorji/go/codec/gen.go +++ b/vendor/github.com/ugorji/go/codec/gen.go @@ -1,6 +1,6 @@ // +build codecgen.exec -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -30,6 +30,7 @@ import ( // codecgen supports the full cycle of reflection-based codec: // - RawExt // - Raw +// - Builtins // - Extensions // - (Binary|Text|JSON)(Unm|M)arshal // - generic by-kind @@ -100,8 +101,6 @@ import ( // v4: Removed separator support from (en|de)cDriver, and refactored codec(gen) // v5: changes to support faster json decoding. Let encoder/decoder maintain state of collections. // v6: removed unsafe from gen, and now uses codecgen.exec tag -// v7: -// v8: current - we now maintain compatibility with old generated code. const genVersion = 8 const ( @@ -130,27 +129,12 @@ const ( ) var ( - errGenAllTypesSamePkg = errors.New("All types must be in the same package") - errGenExpectArrayOrMap = errors.New("unexpected type. Expecting array/map/slice") - - genBase64enc = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789__") - genQNameRegex = regexp.MustCompile(`[A-Za-z_.]+`) + genAllTypesSamePkgErr = errors.New("All types must be in the same package") + genExpectArrayOrMapErr = errors.New("unexpected type. Expecting array/map/slice") + genBase64enc = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789__") + genQNameRegex = regexp.MustCompile(`[A-Za-z_.]+`) ) -type genBuf struct { - buf []byte -} - -func (x *genBuf) s(s string) *genBuf { x.buf = append(x.buf, s...); return x } -func (x *genBuf) b(s []byte) *genBuf { x.buf = append(x.buf, s...); return x } -func (x *genBuf) v() string { return string(x.buf) } -func (x *genBuf) f(s string, args ...interface{}) { x.s(fmt.Sprintf(s, args...)) } -func (x *genBuf) reset() { - if x.buf != nil { - x.buf = x.buf[:0] - } -} - // genRunner holds some state used during a Gen run. type genRunner struct { w io.Writer // output @@ -186,7 +170,7 @@ type genRunner struct { // Gen will write a complete go file containing Selfer implementations for each // type passed. All the types must be in the same package. // -// Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINUOUSLY WITHOUT NOTICE. +// Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE. func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, ti *TypeInfos, typ ...reflect.Type) { // All types passed to this method do not have a codec.Selfer method implemented directly. @@ -225,7 +209,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, for _, t := range typ { // fmt.Printf("###########: PkgPath: '%v', Name: '%s'\n", genImportPath(t), t.Name()) if genImportPath(t) != x.bp { - panic(errGenAllTypesSamePkg) + panic(genAllTypesSamePkgErr) } x.genRefPkgs(t) } @@ -235,7 +219,10 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, } x.line(` -// Code generated by codecgen - DO NOT EDIT. +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED BY codecgen. +// ************************************************************ `) x.line("package " + pkgName) @@ -247,19 +234,15 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, } // use a sorted set of im keys, so that we can get consistent output imKeys := make([]string, 0, len(x.im)) - for k := range x.im { + for k, _ := range x.im { imKeys = append(imKeys, k) } sort.Strings(imKeys) for _, k := range imKeys { // for k, _ := range x.im { - if k == x.imn[k] { - x.linef("\"%s\"", k) - } else { - x.linef("%s \"%s\"", x.imn[k], k) - } + x.linef("%s \"%s\"", x.imn[k], k) } // add required packages - for _, k := range [...]string{"runtime", "errors", "strconv"} { // "reflect", "fmt" + for _, k := range [...]string{"reflect", "runtime", "fmt", "errors"} { if _, ok := x.im[k]; !ok { x.line("\"" + k + "\"") } @@ -269,19 +252,21 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, x.line("const (") x.linef("// ----- content types ----") - x.linef("codecSelferCcUTF8%s = %v", x.xs, int64(cUTF8)) - x.linef("codecSelferCcRAW%s = %v", x.xs, int64(cRAW)) + x.linef("codecSelferC_UTF8%s = %v", x.xs, int64(c_UTF8)) + x.linef("codecSelferC_RAW%s = %v", x.xs, int64(c_RAW)) x.linef("// ----- value types used ----") - for _, vt := range [...]valueType{ - valueTypeArray, valueTypeMap, valueTypeString, - valueTypeInt, valueTypeUint, valueTypeFloat} { - x.linef("codecSelferValueType%s%s = %v", vt.String(), x.xs, int64(vt)) - } - - x.linef("codecSelferBitsize%s = uint8(strconv.IntSize) // uint8(32 << (^uint(0) >> 63))", x.xs) + x.linef("codecSelferValueTypeArray%s = %v", x.xs, int64(valueTypeArray)) + x.linef("codecSelferValueTypeMap%s = %v", x.xs, int64(valueTypeMap)) + x.linef("// ----- containerStateValues ----") + x.linef("codecSelfer_containerMapKey%s = %v", x.xs, int64(containerMapKey)) + x.linef("codecSelfer_containerMapValue%s = %v", x.xs, int64(containerMapValue)) + x.linef("codecSelfer_containerMapEnd%s = %v", x.xs, int64(containerMapEnd)) + x.linef("codecSelfer_containerArrayElem%s = %v", x.xs, int64(containerArrayElem)) + x.linef("codecSelfer_containerArrayEnd%s = %v", x.xs, int64(containerArrayEnd)) 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("codecSelferBitsize" + x.xs + " = uint8(reflect.TypeOf(uint(0)).Bits())") + x.line("codecSelferOnlyMapOrArrayEncodeToStructErr" + x.xs + " = errors.New(`only encoded map or array can be decoded into a struct`)") x.line(")") x.line("") @@ -293,12 +278,11 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, 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.out(`panic(fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", `) - // x.linef(`%v, %sGenVersion, file))`, genVersion, x.cpfx) + x.line(`err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", `) + x.linef(`%v, %sGenVersion, file)`, genVersion, x.cpfx) + x.line("panic(err)") x.linef("}") x.line("if false { // 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 { @@ -339,7 +323,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, case reflect.Map: x.encMapFallback("v", t) default: - panic(errGenExpectArrayOrMap) + panic(genExpectArrayOrMapErr) } x.line("}") x.line("") @@ -354,7 +338,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, case reflect.Map: x.decMapFallback("v", rtid, t) default: - panic(errGenExpectArrayOrMap) + panic(genExpectArrayOrMapErr) } x.line("}") x.line("") @@ -390,6 +374,7 @@ func (x *genRunner) genRefPkgs(t reflect.Type) { if _, ok := x.is[t]; ok { return } + // fmt.Printf(">>>>>>: PkgPath: '%v', Name: '%s'\n", genImportPath(t), t.Name()) x.is[t] = struct{}{} tpkg, tname := genImportPath(t), t.Name() if tpkg != "" && tpkg != x.bp && tpkg != x.cp && tname != "" && tname[0] >= 'A' && tname[0] <= 'Z' { @@ -418,6 +403,13 @@ func (x *genRunner) genRefPkgs(t reflect.Type) { } } +func (x *genRunner) line(s string) { + x.out(s) + if len(s) == 0 || s[len(s)-1] != '\n' { + x.out("\n") + } +} + func (x *genRunner) varsfx() string { x.c++ return strconv.FormatUint(x.c, 10) @@ -428,31 +420,17 @@ func (x *genRunner) varsfxreset() { } func (x *genRunner) out(s string) { - _, err := io.WriteString(x.w, s) - if err != nil { + if _, err := io.WriteString(x.w, s); err != nil { panic(err) } } -func (x *genRunner) outf(s string, params ...interface{}) { - _, err := fmt.Fprintf(x.w, s, params...) - if err != nil { - panic(err) - } -} - -func (x *genRunner) line(s string) { - x.out(s) - if len(s) == 0 || s[len(s)-1] != '\n' { - x.out("\n") - } -} - func (x *genRunner) linef(s string, params ...interface{}) { - x.outf(s, params...) - if len(s) == 0 || s[len(s)-1] != '\n' { - x.out("\n") - } + x.line(fmt.Sprintf(s, params...)) +} + +func (x *genRunner) outf(s string, params ...interface{}) { + x.out(fmt.Sprintf(s, params...)) } func (x *genRunner) genTypeName(t reflect.Type) (n string) { @@ -525,17 +503,16 @@ func (x *genRunner) selfer(encode bool) { t := x.tc t0 := t // always make decode use a pointer receiver, - // and structs/arrays always use a ptr receiver (encode|decode) - isptr := !encode || t.Kind() == reflect.Array || (t.Kind() == reflect.Struct && t != timeTyp) + // and structs always use a ptr receiver (encode|decode) + isptr := !encode || t.Kind() == reflect.Struct x.varsfxreset() - - fnSigPfx := "func (" + genTopLevelVarName + " " + fnSigPfx := "func (x " if isptr { fnSigPfx += "*" } fnSigPfx += x.genTypeName(t) - x.out(fnSigPfx) + x.out(fnSigPfx) if isptr { t = reflect.PtrTo(t) } @@ -551,7 +528,7 @@ func (x *genRunner) selfer(encode bool) { // or way to elegantly handle that, and also setting it to a // non-nil value doesn't affect the pointer passed. // x.decVar(genTopLevelVarName, t, false) - x.dec(genTopLevelVarName, t0, true) + x.dec(genTopLevelVarName, t0) } x.line("}") x.line("") @@ -595,17 +572,11 @@ func (x *genRunner) selfer(encode bool) { } // used for chan, array, slice, map -func (x *genRunner) xtraSM(varname string, t reflect.Type, encode, isptr bool) { - var ptrPfx, addrPfx string - if isptr { - ptrPfx = "*" - } else { - addrPfx = "&" - } +func (x *genRunner) xtraSM(varname string, encode bool, t reflect.Type) { if encode { - x.linef("h.enc%s((%s%s)(%s), e)", x.genMethodNameT(t), ptrPfx, x.genTypeName(t), varname) + x.linef("h.enc%s((%s%s)(%s), e)", x.genMethodNameT(t), x.arr2str(t, "*"), x.genTypeName(t), varname) } else { - x.linef("h.dec%s((*%s)(%s%s), d)", x.genMethodNameT(t), x.genTypeName(t), addrPfx, varname) + x.linef("h.dec%s((*%s)(%s), d)", x.genMethodNameT(t), x.genTypeName(t), varname) } x.registerXtraT(t) } @@ -644,23 +615,17 @@ func (x *genRunner) encVar(varname string, t reflect.Type) { if checkNil { x.linef("if %s == nil { r.EncodeNil() } else { ", varname) } - switch t.Kind() { case reflect.Ptr: - telem := t.Elem() - tek := telem.Kind() - if tek == reflect.Array || (tek == reflect.Struct && t != timeTyp) { + switch t.Elem().Kind() { + case reflect.Struct, reflect.Array: x.enc(varname, genNonPtr(t)) - break + default: + i := x.varsfx() + x.line(genTempVarPfx + i + " := *" + varname) + x.enc(genTempVarPfx+i, genNonPtr(t)) } - i := x.varsfx() - x.line(genTempVarPfx + i + " := *" + varname) - x.enc(genTempVarPfx+i, genNonPtr(t)) case reflect.Struct, reflect.Array: - if t == timeTyp { - x.enc(varname, t) - break - } i := x.varsfx() x.line(genTempVarPfx + i + " := &" + varname) x.enc(genTempVarPfx+i, t) @@ -674,33 +639,29 @@ func (x *genRunner) encVar(varname string, t reflect.Type) { } -// enc will encode a variable (varname) of type t, where t represents T. -// if t is !time.Time and t is of kind reflect.Struct or reflect.Array, varname is of type *T -// (to prevent copying), -// else t is of type T +// enc will encode a variable (varname) of type t, +// except t is of kind reflect.Struct or reflect.Array, wherein varname is of type ptrTo(T) (to prevent copying) func (x *genRunner) enc(varname string, t reflect.Type) { rtid := rt2id(t) - ti2 := x.ti.get(rtid, t) // We call CodecEncodeSelf if one of the following are honored: // - the type already implements Selfer, call that // - the type has a Selfer implementation just created, use that // - the type is in the list of the ones we will generate for, but it is not currently being generated mi := x.varsfx() - // tptr := reflect.PtrTo(t) + tptr := reflect.PtrTo(t) tk := t.Kind() if x.checkForSelfer(t, varname) { - if tk == reflect.Array || (tk == reflect.Struct && rtid != timeTypId) { // varname is of type *T - // if tptr.Implements(selferTyp) || t.Implements(selferTyp) { - if ti2.isFlag(typeInfoFlagIsZeroerPtr) || ti2.isFlag(typeInfoFlagIsZeroer) { + if tk == reflect.Array || tk == reflect.Struct { // varname is of type *T + if tptr.Implements(selferTyp) || t.Implements(selferTyp) { x.line(varname + ".CodecEncodeSelf(e)") return } } else { // varname is of type T - if ti2.cs { // t.Implements(selferTyp) { + if t.Implements(selferTyp) { x.line(varname + ".CodecEncodeSelf(e)") return - } else if ti2.csp { // tptr.Implements(selferTyp) { + } else if tptr.Implements(selferTyp) { x.linef("%ssf%s := &%s", genTempVarPfx, mi, varname) x.linef("%ssf%s.CodecEncodeSelf(e)", genTempVarPfx, mi) return @@ -732,53 +693,57 @@ func (x *genRunner) enc(varname string, t reflect.Type) { } // check if - // - type is time.Time, RawExt, Raw + // - type is RawExt, Raw // - the type implements (Text|JSON|Binary)(Unm|M)arshal - + x.linef("%sm%s := z.EncBinary()", genTempVarPfx, mi) + x.linef("_ = %sm%s", genTempVarPfx, mi) x.line("if false {") //start if block defer func() { x.line("}") }() //end if block - if t == timeTyp { - x.linef("} else { r.EncodeTime(%s)", varname) - return - } if t == rawTyp { - x.linef("} else { z.EncRaw(%s)", varname) + x.linef("} else { z.EncRaw(%v)", varname) return } if t == rawExtTyp { - x.linef("} else { r.EncodeRawExt(%s, e)", varname) + x.linef("} else { r.EncodeRawExt(%v, e)", 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) + // HACK: Support for Builtins. + // Currently, only Binc supports builtins, and the only builtin type is time.Time. + // Have a method that returns the rtid for time.Time if Handle is Binc. + if t == timeTyp { + vrtid := genTempVarPfx + "m" + x.varsfx() + x.linef("} else if %s := z.TimeRtidIfBinc(); %s != 0 { ", vrtid, vrtid) + x.linef("r.EncodeBuiltin(%s, %s)", vrtid, varname) } - 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) + // only check for extensions if the type is named, and has a packagePath. + if !x.nx && genImportPath(t) != "" && t.Name() != "" { + // first check if extensions are configued, before doing the interface conversion + x.linef("} else if z.HasExtensions() && z.EncExt(%s) {", varname) + } + if tk == reflect.Array || tk == reflect.Struct { // varname is of type *T + if t.Implements(binaryMarshalerTyp) || tptr.Implements(binaryMarshalerTyp) { + x.linef("} else if %sm%s { z.EncBinaryMarshal(%v) ", genTempVarPfx, mi, varname) } - if ti2.jm || ti2.jmp { // t.Implements(jsonMarshalerTyp) || tptr.Implements(jsonMarshalerTyp) { - x.linef("} else if !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", varname) - } else if ti2.tm || ti2.tmp { // t.Implements(textMarshalerTyp) || tptr.Implements(textMarshalerTyp) { - x.linef("} else if !z.EncBinary() { z.EncTextMarshal(%v) ", varname) + if t.Implements(jsonMarshalerTyp) || tptr.Implements(jsonMarshalerTyp) { + x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", genTempVarPfx, mi, varname) + } else if t.Implements(textMarshalerTyp) || tptr.Implements(textMarshalerTyp) { + x.linef("} else if !%sm%s { z.EncTextMarshal(%v) ", genTempVarPfx, mi, varname) } } else { // varname is of type T - if ti2.bm { // t.Implements(binaryMarshalerTyp) { - x.linef("} else if z.EncBinary() { z.EncBinaryMarshal(%v) ", varname) - } else if ti2.bmp { // tptr.Implements(binaryMarshalerTyp) { - x.linef("} else if z.EncBinary() { z.EncBinaryMarshal(&%v) ", varname) + if t.Implements(binaryMarshalerTyp) { + x.linef("} else if %sm%s { z.EncBinaryMarshal(%v) ", genTempVarPfx, mi, varname) + } else if tptr.Implements(binaryMarshalerTyp) { + x.linef("} else if %sm%s { z.EncBinaryMarshal(&%v) ", genTempVarPfx, mi, varname) } - if ti2.jm { // t.Implements(jsonMarshalerTyp) { - x.linef("} else if !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", varname) - } else if ti2.jmp { // tptr.Implements(jsonMarshalerTyp) { - x.linef("} else if !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(&%v) ", varname) - } else if ti2.tm { // t.Implements(textMarshalerTyp) { - x.linef("} else if !z.EncBinary() { z.EncTextMarshal(%v) ", varname) - } else if ti2.tmp { // tptr.Implements(textMarshalerTyp) { - x.linef("} else if !z.EncBinary() { z.EncTextMarshal(&%v) ", varname) + if t.Implements(jsonMarshalerTyp) { + x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", genTempVarPfx, mi, varname) + } else if tptr.Implements(jsonMarshalerTyp) { + x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(&%v) ", genTempVarPfx, mi, varname) + } else if t.Implements(textMarshalerTyp) { + x.linef("} else if !%sm%s { z.EncTextMarshal(%v) ", genTempVarPfx, mi, varname) + } else if tptr.Implements(textMarshalerTyp) { + x.linef("} else if !%sm%s { z.EncTextMarshal(&%v) ", genTempVarPfx, mi, varname) } } x.line("} else {") @@ -795,12 +760,12 @@ func (x *genRunner) enc(varname string, t reflect.Type) { case reflect.Bool: x.line("r.EncodeBool(bool(" + varname + "))") case reflect.String: - x.line("r.EncodeString(codecSelferCcUTF8" + x.xs + ", string(" + varname + "))") + x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + ", string(" + varname + "))") case reflect.Chan: - x.xtraSM(varname, t, true, false) + x.xtraSM(varname, true, t) // x.encListFallback(varname, rtid, t) case reflect.Array: - x.xtraSM(varname, t, true, true) + x.xtraSM(varname, true, t) case reflect.Slice: // if nil, call dedicated function // if a []uint8, call dedicated function @@ -809,12 +774,12 @@ func (x *genRunner) enc(varname string, t reflect.Type) { // - if elements are primitives or Selfers, call dedicated function on each member. // - else call Encoder.encode(XXX) on it. if rtid == uint8SliceTypId { - x.line("r.EncodeStringBytes(codecSelferCcRAW" + x.xs + ", []byte(" + varname + "))") + x.line("r.EncodeStringBytes(codecSelferC_RAW" + x.xs + ", []byte(" + varname + "))") } else if fastpathAV.index(rtid) != -1 { g := x.newGenV(t) x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", e)") } else { - x.xtraSM(varname, t, true, false) + x.xtraSM(varname, true, t) // x.encListFallback(varname, rtid, t) } case reflect.Map: @@ -828,7 +793,7 @@ func (x *genRunner) enc(varname string, t reflect.Type) { g := x.newGenV(t) x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", e)") } else { - x.xtraSM(varname, t, true, false) + x.xtraSM(varname, true, t) // x.encMapFallback(varname, rtid, t) } case reflect.Struct: @@ -859,53 +824,12 @@ func (x *genRunner) encZero(t reflect.Type) { case reflect.Bool: x.line("r.EncodeBool(false)") case reflect.String: - x.line("r.EncodeString(codecSelferCcUTF8" + x.xs + `, "")`) + x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + `, "")`) default: x.line("r.EncodeNil()") } } -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) - varname2 := varname + "." + t2.Name - switch t2.Type.Kind() { - case reflect.Struct: - rtid2 := rt2id(t2.Type) - ti2 := x.ti.get(rtid2, t2.Type) - // fmt.Printf(">>>> structfield: omitempty: type: %s, field: %s\n", t2.Type.Name(), t2.Name) - if ti2.rtid == timeTypId { - buf.s("!(").s(varname2).s(".IsZero())") - break - } - if ti2.isFlag(typeInfoFlagIsZeroerPtr) || ti2.isFlag(typeInfoFlagIsZeroer) { - buf.s("!(").s(varname2).s(".IsZero())") - break - } - if ti2.isFlag(typeInfoFlagComparable) { - buf.s(varname2).s(" != ").s(x.genZeroValueR(t2.Type)) - break - } - // buf.s("(") - buf.s("false") - for i, n := 0, t2.Type.NumField(); i < n; i++ { - f := t2.Type.Field(i) - if f.PkgPath != "" { // unexported - continue - } - buf.s(" || ") - x.encOmitEmptyLine(f, varname2, buf) - } - //buf.s(")") - case reflect.Bool: - buf.s(varname2) - case reflect.Map, reflect.Slice, reflect.Array, reflect.Chan: - buf.s("len(").s(varname2).s(") != 0") - default: - buf.s(varname2).s(" != ").s(x.genZeroValueR(t2.Type)) - } -} - func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { // 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,34 +844,29 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { 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) - - tisfi := ti.sfiSrc // always use sequence from file. decStruct expects same thing. - - // var nn int + tisfi := ti.sfip // always use sequence from file. decStruct expects same thing. // due to omitEmpty, we need to calculate the // number of non-empty things we write out first. // This is required as we need to pre-determine the size of the container, // to support length-prefixing. if ti.anyOmitEmpty { - x.linef("var %s = [%v]bool{ // should field at this index be written?", numfieldsvar, len(tisfi)) - + x.linef("var %s [%v]bool", numfieldsvar, len(tisfi)) + x.linef("_ = %s", numfieldsvar) + } + x.linef("_, _ = %s, %s", sepVarname, struct2arrvar) + x.linef("const %s bool = %v", ti2arrayvar, ti.toArray) + var nn int + if ti.anyOmitEmpty { for j, si := range tisfi { - _ = j - if !si.omitEmpty() { - // x.linef("%s[%v] = true // %s", numfieldsvar, j, si.fieldName) - x.linef("true, // %s", si.fieldName) - // nn++ + if !si.omitEmpty { + nn++ continue } var t2 reflect.StructField - var omitline genBuf + var omitline string { t2typ := t varname3 := varname - // go through the loop, record the t2 field explicitly, - // and gather the omit line if embedded in pointers. for ij, ix := range si.is { if uint8(ij) == si.nis { break @@ -958,27 +877,30 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { t2 = t2typ.Field(int(ix)) t2typ = t2.Type varname3 = varname3 + "." + t2.Name - // do not include actual field in the omit line. - // that is done subsequently (right after - below). - if uint8(ij+1) < si.nis && t2typ.Kind() == reflect.Ptr { - omitline.s(varname3).s(" != nil && ") + if t2typ.Kind() == reflect.Ptr { + omitline += varname3 + " != nil && " } } } - x.encOmitEmptyLine(t2, varname, &omitline) - x.linef("%s, // %s", omitline.v(), si.fieldName) + // never 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) + switch t2.Type.Kind() { + case reflect.Struct: + omitline += " true" + case reflect.Map, reflect.Slice, reflect.Array, reflect.Chan: + omitline += "len(" + varname + "." + t2.Name + ") != 0" + default: + omitline += varname + "." + t2.Name + " != " + x.genZeroValueR(t2.Type) + } + x.linef("%s[%v] = %s", numfieldsvar, j, omitline) } - 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("var %snn%s = %v", genTempVarPfx, i, nn) 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) @@ -999,6 +921,7 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { if uint8(ij) == si.nis { break } + // fmt.Printf("%%%% %v, ix: %v\n", t2typ, ix) for t2typ.Kind() == reflect.Ptr { t2typ = t2typ.Elem() } @@ -1026,13 +949,14 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray if labelUsed { x.linef("if %s { r.WriteArrayElem(); r.EncodeNil() } else { ", isNilVarName) + // x.linef("if %s { z.EncSendContainerState(codecSelfer_containerArrayElem%s); r.EncodeNil() } else { ", isNilVarName, x.xs) } - x.line("r.WriteArrayElem()") - if si.omitEmpty() { + x.line("r.WriteArrayElem()") // x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) + if si.omitEmpty { x.linef("if %s[%v] {", numfieldsvar, j) } x.encVar(varname+"."+t2.Name, t2.Type) - if si.omitEmpty() { + if si.omitEmpty { x.linef("} else {") x.encZero(t2.Type) x.linef("}") @@ -1043,25 +967,12 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { x.linef("} else {") // if not ti.toArray - if si.omitEmpty() { + if si.omitEmpty { x.linef("if %s[%v] {", numfieldsvar, j) } - x.line("r.WriteMapElemKey()") - - // x.line("r.EncodeString(codecSelferCcUTF8" + x.xs + ", `" + si.encName + "`)") - // emulate EncStructFieldKey - switch ti.keyType { - case valueTypeInt: - x.linef("r.EncodeInt(z.M.Int(strconv.ParseInt(`%s`, 10, 64)))", si.encName) - case valueTypeUint: - x.linef("r.EncodeUint(z.M.Uint(strconv.ParseUint(`%s`, 10, 64)))", si.encName) - case valueTypeFloat: - x.linef("r.EncodeFloat64(z.M.Float(strconv.ParseFloat(`%s`, 64)))", si.encName) - default: // string - x.linef("r.EncodeString(codecSelferCcUTF8%s, `%s`)", x.xs, si.encName) - } - // x.linef("r.EncStructFieldKey(codecSelferValueType%s%s, `%s`)", ti.keyType.String(), x.xs, si.encName) - x.line("r.WriteMapElemValue()") + x.line("r.WriteMapElemKey()") // x.linef("z.EncSendContainerState(codecSelfer_containerMapKey%s)", x.xs) + x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + ", string(\"" + si.encName + "\"))") + x.line("r.WriteMapElemValue()") // x.linef("z.EncSendContainerState(codecSelfer_containerMapValue%s)", x.xs) if labelUsed { x.line("if " + isNilVarName + " { r.EncodeNil() } else { ") x.encVar(varname+"."+t2.Name, t2.Type) @@ -1069,26 +980,26 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { } else { x.encVar(varname+"."+t2.Name, t2.Type) } - if si.omitEmpty() { + 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("r.WriteArrayEnd()") // x.linef("z.EncSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs) x.line("} else {") - x.line("r.WriteMapEnd()") + x.line("r.WriteMapEnd()") // x.linef("z.EncSendContainerState(codecSelfer_containerMapEnd%s)", x.xs) x.line("}") } func (x *genRunner) encListFallback(varname string, t reflect.Type) { if t.AssignableTo(uint8SliceTyp) { - x.linef("r.EncodeStringBytes(codecSelferCcRAW%s, []byte(%s))", x.xs, varname) + x.linef("r.EncodeStringBytes(codecSelferC_RAW%s, []byte(%s))", x.xs, varname) return } if t.Kind() == reflect.Array && t.Elem().Kind() == reflect.Uint8 { - x.linef("r.EncodeStringBytes(codecSelferCcRAW%s, ((*[%d]byte)(%s))[:])", x.xs, t.Len(), varname) + x.linef("r.EncodeStringBytes(codecSelferC_RAW%s, ([%v]byte(%s))[:])", x.xs, t.Len(), varname) return } i := x.varsfx() @@ -1096,15 +1007,16 @@ func (x *genRunner) encListFallback(varname string, t reflect.Type) { x.line("r.WriteArrayStart(len(" + varname + "))") if t.Kind() == reflect.Chan { x.linef("for %si%s, %si2%s := 0, len(%s); %si%s < %si2%s; %si%s++ {", g, i, g, i, varname, g, i, g, i, g, i) - x.line("r.WriteArrayElem()") + x.line("r.WriteArrayElem()") // x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) x.linef("%sv%s := <-%s", g, i, varname) } else { + // x.linef("for %si%s, %sv%s := range %s {", genTempVarPfx, i, genTempVarPfx, i, varname) x.linef("for _, %sv%s := range %s {", genTempVarPfx, i, varname) - x.line("r.WriteArrayElem()") + x.line("r.WriteArrayElem()") // x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) } x.encVar(genTempVarPfx+"v"+i, t.Elem()) x.line("}") - x.line("r.WriteArrayEnd()") + x.line("r.WriteArrayEnd()") // x.linef("z.EncSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs) } func (x *genRunner) encMapFallback(varname string, t reflect.Type) { @@ -1112,154 +1024,94 @@ func (x *genRunner) encMapFallback(varname string, t reflect.Type) { i := x.varsfx() x.line("r.WriteMapStart(len(" + varname + "))") x.linef("for %sk%s, %sv%s := range %s {", genTempVarPfx, i, genTempVarPfx, i, varname) - x.line("r.WriteMapElemKey()") + // x.line("for " + genTempVarPfx + "k" + i + ", " + genTempVarPfx + "v" + i + " := range " + varname + " {") + x.line("r.WriteMapElemKey()") // f("z.EncSendContainerState(codecSelfer_containerMapKey%s)", x.xs) x.encVar(genTempVarPfx+"k"+i, t.Key()) - x.line("r.WriteMapElemValue()") + x.line("r.WriteMapElemValue()") // f("z.EncSendContainerState(codecSelfer_containerMapValue%s)", x.xs) x.encVar(genTempVarPfx+"v"+i, t.Elem()) x.line("}") - x.line("r.WriteMapEnd()") + x.line("r.WriteMapEnd()") // f("z.EncSendContainerState(codecSelfer_containerMapEnd%s)", x.xs) } -func (x *genRunner) decVarInitPtr(varname, nilvar string, t reflect.Type, si *structFieldInfo, - newbuf, nilbuf *genBuf) (t2 reflect.StructField) { - //we must accommodate anonymous fields, where the embedded field is a nil pointer in the value. - // t2 = t.FieldByIndex(si.is) - t2typ := t - varname3 := varname - t2kind := t2typ.Kind() - var nilbufed bool - if si != nil { - for ij, ix := range si.is { - if uint8(ij) == si.nis { - break - } - for t2typ.Kind() == reflect.Ptr { - t2typ = t2typ.Elem() - } - t2 = t2typ.Field(int(ix)) - t2typ = t2.Type - varname3 = varname3 + "." + t2.Name - t2kind = t2typ.Kind() - if t2kind != reflect.Ptr { - continue - } - if newbuf != nil { - newbuf.f("if %s == nil { %s = new(%s) }\n", varname3, varname3, x.genTypeName(t2typ.Elem())) - } - if nilbuf != nil { - if !nilbufed { - nilbuf.s("if true") - nilbufed = true - } - nilbuf.s(" && ").s(varname3).s(" != nil") - } - } - } - // if t2typ.Kind() == reflect.Ptr { - // varname3 = varname3 + t2.Name - // } - if nilbuf != nil { - if nilbufed { - nilbuf.s(" { ") - } - if nilvar != "" { - nilbuf.s(nilvar).s(" = true") - } else if tk := t2typ.Kind(); tk == reflect.Ptr { - if strings.IndexByte(varname3, '.') != -1 || strings.IndexByte(varname3, '[') != -1 { - nilbuf.s(varname3).s(" = nil") - } else { - nilbuf.s("*").s(varname3).s(" = ").s(x.genZeroValueR(t2typ.Elem())) - } - } else { - nilbuf.s(varname3).s(" = ").s(x.genZeroValueR(t2typ)) - } - if nilbufed { - nilbuf.s("}") - } - } - return t2 -} - -// decVar takes a variable called varname, of type t -func (x *genRunner) decVarMain(varname, rand string, t reflect.Type, checkNotNil bool) { +func (x *genRunner) decVar(varname, decodedNilVarname string, t reflect.Type, canBeNil bool) { // We only encode as nil if a nillable value. // This removes some of the wasted checks for TryDecodeAsNil. // We need to think about this more, to see what happens if omitempty, etc // cause a nil value to be stored when something is expected. // This could happen when decoding from a struct encoded as an array. // For that, decVar should be called with canNil=true, to force true as its value. - var varname2 string + i := x.varsfx() + if !canBeNil { + canBeNil = genAnythingCanBeNil || !genIsImmutable(t) + } + if canBeNil { + x.line("if r.TryDecodeAsNil() {") + if decodedNilVarname != "" { + x.line(decodedNilVarname + " = true") + } else if t.Kind() == reflect.Ptr { + x.line("if " + varname + " != nil { ") + + // if varname is a field of a struct (has a dot in it), + // then just set it to nil + if strings.IndexByte(varname, '.') != -1 { + x.line(varname + " = nil") + } else { + x.line("*" + varname + " = " + x.genZeroValueR(t.Elem())) + } + x.line("}") + } else { + x.line(varname + " = " + x.genZeroValueR(t)) + } + x.line("} else {") + } else { + x.line("// cannot be nil") + } if t.Kind() != reflect.Ptr { - if t.PkgPath() != "" || !x.decTryAssignPrimitive(varname, t, false) { - x.dec(varname, t, false) + if x.decTryAssignPrimitive(varname, t) { + x.line(genTempVarPfx + "v" + i + " := &" + varname) + x.dec(genTempVarPfx+"v"+i, t) } } else { - if checkNotNil { - x.linef("if %s == nil { %s = new(%s) }", varname, varname, x.genTypeName(t.Elem())) - } + x.linef("if %s == nil { %s = new(%s) }", varname, varname, x.genTypeName(t.Elem())) // Ensure we set underlying ptr to a non-nil value (so we can deref to it later). // There's a chance of a **T in here which is nil. var ptrPfx string for t = t.Elem(); t.Kind() == reflect.Ptr; t = t.Elem() { ptrPfx += "*" - if checkNotNil { - x.linef("if %s%s == nil { %s%s = new(%s)}", - ptrPfx, varname, ptrPfx, varname, x.genTypeName(t)) - } + x.linef("if %s%s == nil { %s%s = new(%s)}", + ptrPfx, varname, ptrPfx, varname, x.genTypeName(t)) + } + // if varname has [ in it, then create temp variable for this ptr thingie + if strings.Index(varname, "[") >= 0 { + varname2 := genTempVarPfx + "w" + i + x.line(varname2 + " := " + varname) + varname = varname2 } - // Should we create temp var if a slice/map indexing? No. dec(...) can now handle it. if ptrPfx == "" { - x.dec(varname, t, true) + x.dec(varname, t) } else { - varname2 = genTempVarPfx + "z" + rand - x.line(varname2 + " := " + ptrPfx + varname) - x.dec(varname2, t, true) + x.line(genTempVarPfx + "z" + i + " := " + ptrPfx + varname) + x.dec(genTempVarPfx+"z"+i, t) } + } -} - -// decVar takes a variable called varname, of type t -func (x *genRunner) decVar(varname, nilvar string, t reflect.Type, canBeNil, checkNotNil bool) { - i := x.varsfx() - - // We only encode as nil if a nillable value. - // This removes some of the wasted checks for TryDecodeAsNil. - // We need to think about this more, to see what happens if omitempty, etc - // cause a nil value to be stored when something is expected. - // This could happen when decoding from a struct encoded as an array. - // For that, decVar should be called with canNil=true, to force true as its value. - - if !canBeNil { - canBeNil = genAnythingCanBeNil || !genIsImmutable(t) - } - - if canBeNil { - var buf genBuf - x.decVarInitPtr(varname, nilvar, t, nil, nil, &buf) - x.linef("if r.TryDecodeAsNil() { %s } else {", buf.buf) - } else { - x.line("// cannot be nil") - } - - x.decVarMain(varname, i, t, checkNotNil) if canBeNil { x.line("} ") } } -// dec will decode a variable (varname) of type t or ptrTo(t) if isptr==true. +// dec will decode a variable (varname) of type ptrTo(t). // t is always a basetype (i.e. not of kind reflect.Ptr). -func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { +func (x *genRunner) dec(varname string, t reflect.Type) { // assumptions: // - the varname is to a pointer already. No need to take address of it // - t is always a baseType T (not a *T, etc). rtid := rt2id(t) - ti2 := x.ti.get(rtid, t) - // tptr := reflect.PtrTo(t) + tptr := reflect.PtrTo(t) if x.checkForSelfer(t, varname) { - if ti2.cs || ti2.csp { // t.Implements(selferTyp) || tptr.Implements(selferTyp) { + if t.Implements(selferTyp) || tptr.Implements(selferTyp) { x.line(varname + ".CodecDecodeSelf(d)") return } @@ -1288,61 +1140,100 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { } // check if - // - type is time.Time, Raw, RawExt + // - type is Raw, RawExt // - the type implements (Text|JSON|Binary)(Unm|M)arshal - mi := x.varsfx() - // x.linef("%sm%s := z.DecBinary()", genTempVarPfx, mi) - // x.linef("_ = %sm%s", genTempVarPfx, mi) + 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 ptrPfx, addrPfx string - if isptr { - ptrPfx = "*" - } else { - addrPfx = "&" - } - if t == timeTyp { - x.linef("} else { %s%v = r.DecodeTime()", ptrPfx, varname) - return - } if t == rawTyp { - x.linef("} else { %s%v = z.DecRaw()", ptrPfx, varname) + x.linef("} else { *%v = z.DecRaw()", varname) return } - if t == rawExtTyp { - x.linef("} else { r.DecodeExt(%s%v, 0, nil)", addrPfx, varname) + x.linef("} else { r.DecodeExt(%v, 0, nil)", varname) return } + // HACK: Support for Builtins. + // Currently, only Binc supports builtins, and the only builtin type is time.Time. + // Have a method that returns the rtid for time.Time if Handle is Binc. + if t == timeTyp { + vrtid := genTempVarPfx + "m" + x.varsfx() + x.linef("} else if %s := z.TimeRtidIfBinc(); %s != 0 { ", vrtid, vrtid) + x.linef("r.DecodeBuiltin(%s, %s)", vrtid, varname) + } // only check for extensions if the type is named, and has a packagePath. if !x.nx && genImportPath(t) != "" && t.Name() != "" { // 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("} else if z.HasExtensions() && z.DecExt(%s) {", varname) } - if ti2.bu || ti2.bup { // t.Implements(binaryUnmarshalerTyp) || tptr.Implements(binaryUnmarshalerTyp) { - x.linef("} else if z.DecBinary() { z.DecBinaryUnmarshal(%s%v) ", addrPfx, varname) + if t.Implements(binaryUnmarshalerTyp) || tptr.Implements(binaryUnmarshalerTyp) { + x.linef("} else if %sm%s { z.DecBinaryUnmarshal(%v) ", genTempVarPfx, mi, 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) - } else if ti2.tu || ti2.tup { // t.Implements(textUnmarshalerTyp) || tptr.Implements(textUnmarshalerTyp) { - x.linef("} else if !z.DecBinary() { z.DecTextUnmarshal(%s%v)", addrPfx, varname) + if t.Implements(jsonUnmarshalerTyp) || tptr.Implements(jsonUnmarshalerTyp) { + x.linef("} else if !%sm%s && z.IsJSONHandle() { z.DecJSONUnmarshal(%v)", genTempVarPfx, mi, varname) + } else if t.Implements(textUnmarshalerTyp) || tptr.Implements(textUnmarshalerTyp) { + x.linef("} else if !%sm%s { z.DecTextUnmarshal(%v)", genTempVarPfx, mi, varname) } x.line("} else {") - if x.decTryAssignPrimitive(varname, t, isptr) { - return - } - + // Since these are pointers, we cannot share, and have to use them one by one switch t.Kind() { + case reflect.Int: + x.line("*((*int)(" + varname + ")) = int(r.DecodeInt(codecSelferBitsize" + x.xs + "))") + // x.line("z.DecInt((*int)(" + varname + "))") + case reflect.Int8: + x.line("*((*int8)(" + varname + ")) = int8(r.DecodeInt(8))") + // x.line("z.DecInt8((*int8)(" + varname + "))") + case reflect.Int16: + x.line("*((*int16)(" + varname + ")) = int16(r.DecodeInt(16))") + // x.line("z.DecInt16((*int16)(" + varname + "))") + case reflect.Int32: + x.line("*((*int32)(" + varname + ")) = int32(r.DecodeInt(32))") + // x.line("z.DecInt32((*int32)(" + varname + "))") + case reflect.Int64: + x.line("*((*int64)(" + varname + ")) = int64(r.DecodeInt(64))") + // x.line("z.DecInt64((*int64)(" + varname + "))") + + case reflect.Uint: + x.line("*((*uint)(" + varname + ")) = uint(r.DecodeUint(codecSelferBitsize" + x.xs + "))") + // x.line("z.DecUint((*uint)(" + varname + "))") + case reflect.Uint8: + x.line("*((*uint8)(" + varname + ")) = uint8(r.DecodeUint(8))") + // x.line("z.DecUint8((*uint8)(" + varname + "))") + case reflect.Uint16: + x.line("*((*uint16)(" + varname + ")) = uint16(r.DecodeUint(16))") + //x.line("z.DecUint16((*uint16)(" + varname + "))") + case reflect.Uint32: + x.line("*((*uint32)(" + varname + ")) = uint32(r.DecodeUint(32))") + //x.line("z.DecUint32((*uint32)(" + varname + "))") + case reflect.Uint64: + x.line("*((*uint64)(" + varname + ")) = uint64(r.DecodeUint(64))") + //x.line("z.DecUint64((*uint64)(" + varname + "))") + case reflect.Uintptr: + x.line("*((*uintptr)(" + varname + ")) = uintptr(r.DecodeUint(codecSelferBitsize" + x.xs + "))") + + case reflect.Float32: + x.line("*((*float32)(" + varname + ")) = float32(r.DecodeFloat(true))") + //x.line("z.DecFloat32((*float32)(" + varname + "))") + case reflect.Float64: + x.line("*((*float64)(" + varname + ")) = float64(r.DecodeFloat(false))") + // x.line("z.DecFloat64((*float64)(" + varname + "))") + + case reflect.Bool: + x.line("*((*bool)(" + varname + ")) = r.DecodeBool()") + // x.line("z.DecBool((*bool)(" + varname + "))") + case reflect.String: + x.line("*((*string)(" + varname + ")) = r.DecodeString()") + // x.line("z.DecString((*string)(" + varname + "))") case reflect.Array, reflect.Chan: - x.xtraSM(varname, t, false, isptr) + x.xtraSM(varname, false, t) + // x.decListFallback(varname, rtid, true, t) case reflect.Slice: // if a []uint8, call dedicated function // if a known fastpath slice, call dedicated function @@ -1350,13 +1241,12 @@ 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 rtid == uint8SliceTypId { - x.linef("%s%s = r.DecodeBytes(%s(%s[]byte)(%s), false)", - ptrPfx, varname, ptrPfx, ptrPfx, varname) + x.line("*" + varname + " = r.DecodeBytes(*(*[]byte)(" + varname + "), false)") } else if fastpathAV.index(rtid) != -1 { g := x.newGenV(t) - x.linef("z.F.%sX(%s%s, d)", g.MethodNamePfx("Dec", false), addrPfx, varname) + x.line("z.F." + g.MethodNamePfx("Dec", false) + "X(" + varname + ", d)") } else { - x.xtraSM(varname, t, false, isptr) + x.xtraSM(varname, false, t) // x.decListFallback(varname, rtid, false, t) } case reflect.Map: @@ -1366,80 +1256,74 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { // - else call Encoder.encode(XXX) on it. if fastpathAV.index(rtid) != -1 { g := x.newGenV(t) - x.linef("z.F.%sX(%s%s, d)", g.MethodNamePfx("Dec", false), addrPfx, varname) + x.line("z.F." + g.MethodNamePfx("Dec", false) + "X(" + varname + ", d)") } else { - x.xtraSM(varname, t, false, isptr) + x.xtraSM(varname, false, t) // x.decMapFallback(varname, rtid, t) } case reflect.Struct: if inlist { - // no need to create temp variable if isptr, or x.F or x[F] - if isptr || strings.IndexByte(varname, '.') != -1 || strings.IndexByte(varname, '[') != -1 { - x.decStruct(varname, rtid, t) - } else { - varname2 := genTempVarPfx + "j" + mi - x.line(varname2 + " := &" + varname) - x.decStruct(varname2, rtid, t) - } + x.decStruct(varname, rtid, t) } else { // delete(x.td, rtid) - x.line("z.DecFallback(" + addrPfx + varname + ", false)") + x.line("z.DecFallback(" + varname + ", false)") } default: if rtidAdded { delete(x.te, rtid) } - x.line("z.DecFallback(" + addrPfx + varname + ", true)") + x.line("z.DecFallback(" + varname + ", true)") } } -func (x *genRunner) decTryAssignPrimitive(varname string, t reflect.Type, isptr bool) (done bool) { +func (x *genRunner) decTryAssignPrimitive(varname string, t reflect.Type) (tryAsPtr bool) { // This should only be used for exact primitives (ie un-named types). // Named types may be implementations of Selfer, Unmarshaler, etc. // They should be handled by dec(...) - var ptr string - if isptr { - ptr = "*" + if t.Name() != "" { + tryAsPtr = true + return } + switch t.Kind() { case reflect.Int: - x.linef("%s%s = (%s)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize%s))", ptr, varname, x.genTypeName(t), x.xs) + x.linef("%s = r.DecodeInt(codecSelferBitsize%s)", varname, x.xs) case reflect.Int8: - x.linef("%s%s = (%s)(z.C.IntV(r.DecodeInt64(), 8))", ptr, varname, x.genTypeName(t)) + x.linef("%s = r.DecodeInt(8)", varname) case reflect.Int16: - x.linef("%s%s = (%s)(z.C.IntV(r.DecodeInt64(), 16))", ptr, varname, x.genTypeName(t)) + x.linef("%s = r.DecodeInt(16)", varname) case reflect.Int32: - x.linef("%s%s = (%s)(z.C.IntV(r.DecodeInt64(), 32))", ptr, varname, x.genTypeName(t)) + x.linef("%s = r.DecodeInt(32)", varname) case reflect.Int64: - x.linef("%s%s = (%s)(r.DecodeInt64())", ptr, varname, x.genTypeName(t)) + x.linef("%s = r.DecodeInt(64)", varname) case reflect.Uint: - x.linef("%s%s = (%s)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize%s))", ptr, varname, x.genTypeName(t), x.xs) + x.linef("%s = r.DecodeUint(codecSelferBitsize%s)", varname, x.xs) case reflect.Uint8: - x.linef("%s%s = (%s)(z.C.UintV(r.DecodeUint64(), 8))", ptr, varname, x.genTypeName(t)) + x.linef("%s = r.DecodeUint(8)", varname) case reflect.Uint16: - x.linef("%s%s = (%s)(z.C.UintV(r.DecodeUint64(), 16))", ptr, varname, x.genTypeName(t)) + x.linef("%s = r.DecodeUint(16)", varname) case reflect.Uint32: - x.linef("%s%s = (%s)(z.C.UintV(r.DecodeUint64(), 32))", ptr, varname, x.genTypeName(t)) + x.linef("%s = r.DecodeUint(32)", varname) case reflect.Uint64: - x.linef("%s%s = (%s)(r.DecodeUint64())", ptr, varname, x.genTypeName(t)) + x.linef("%s = r.DecodeUint(64)", varname) case reflect.Uintptr: - x.linef("%s%s = (%s)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize%s))", ptr, varname, x.genTypeName(t), x.xs) + x.linef("%s = r.DecodeUint(codecSelferBitsize%s)", varname, x.xs) case reflect.Float32: - x.linef("%s%s = (%s)(r.DecodeFloat32As64())", ptr, varname, x.genTypeName(t)) + x.linef("%s = r.DecodeFloat(true)", varname) case reflect.Float64: - x.linef("%s%s = (%s)(r.DecodeFloat64())", ptr, varname, x.genTypeName(t)) + x.linef("%s = r.DecodeFloat(false)", varname) case reflect.Bool: - x.linef("%s%s = (%s)(r.DecodeBool())", ptr, varname, x.genTypeName(t)) + x.linef("%s = r.DecodeBool()", varname) case reflect.String: - x.linef("%s%s = (%s)(r.DecodeString())", ptr, varname, x.genTypeName(t)) + x.linef("%s = r.DecodeString()", varname) default: - return false + tryAsPtr = true } - return true + return } func (x *genRunner) decListFallback(varname string, rtid uintptr, t reflect.Type) { @@ -1448,7 +1332,7 @@ func (x *genRunner) decListFallback(varname string, rtid uintptr, t reflect.Type return } if t.Kind() == reflect.Array && t.Elem().Kind() == reflect.Uint8 { - x.linef("r.DecodeBytes( ((*[%d]byte)(%s))[:], true)", t.Len(), varname) + x.linef("r.DecodeBytes( ((*[%s]byte)(%s))[:], true)", t.Len(), varname) return } type tstruc struct { @@ -1466,9 +1350,13 @@ func (x *genRunner) decListFallback(varname string, rtid uintptr, t reflect.Type funcs := make(template.FuncMap) funcs["decLineVar"] = func(varname string) string { - x.decVar(varname, "", telem, false, true) + x.decVar(varname, "", telem, false) return "" } + // funcs["decLine"] = func(pfx string) string { + // x.decVar(ts.TempVar+pfx+ts.Rand, "", reflect.PtrTo(telem), false) + // return "" + // } funcs["var"] = func(s string) string { return ts.TempVar + s + ts.Rand } @@ -1524,13 +1412,21 @@ func (x *genRunner) decMapFallback(varname string, rtid uintptr, t reflect.Type) return telem.Kind() == reflect.Interface } funcs["decLineVarK"] = func(varname string) string { - x.decVar(varname, "", tkey, false, true) + x.decVar(varname, "", tkey, false) return "" } funcs["decLineVar"] = func(varname, decodedNilVarname string) string { - x.decVar(varname, decodedNilVarname, telem, false, true) + x.decVar(varname, decodedNilVarname, telem, false) return "" } + // funcs["decLineK"] = func(pfx string) string { + // x.decVar(ts.TempVar+pfx+ts.Rand, reflect.PtrTo(tkey), false) + // return "" + // } + // funcs["decLine"] = func(pfx string) string { + // x.decVar(ts.TempVar+pfx+ts.Rand, reflect.PtrTo(telem), false) + // return "" + // } funcs["var"] = func(s string) string { return ts.TempVar + s + ts.Rand } @@ -1546,17 +1442,32 @@ func (x *genRunner) decMapFallback(varname string, rtid uintptr, t reflect.Type) func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintptr, t reflect.Type) { ti := x.ti.get(rtid, t) - tisfi := ti.sfiSrc // always use sequence from file. decStruct expects same thing. + tisfi := ti.sfip // always use sequence from file. decStruct expects same thing. x.line("switch (" + kName + ") {") - var newbuf, nilbuf genBuf for _, si := range tisfi { x.line("case \"" + si.encName + "\":") - newbuf.reset() - nilbuf.reset() - 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.line("}") + var t2 reflect.StructField + { + //we must accommodate anonymous fields, where the embedded field is a nil pointer in the value. + // t2 = t.FieldByIndex(si.is) + t2typ := t + varname3 := varname + for ij, ix := range si.is { + if uint8(ij) == si.nis { + break + } + for t2typ.Kind() == reflect.Ptr { + t2typ = t2typ.Elem() + } + t2 = t2typ.Field(int(ix)) + t2typ = t2.Type + varname3 = varname3 + "." + t2.Name + if t2typ.Kind() == reflect.Ptr { + x.linef("if %s == nil { %s = new(%s) }", varname3, varname3, x.genTypeName(t2typ.Elem())) + } + } + } + x.decVar(varname+"."+t2.Name, "", t2.Type, false) } x.line("default:") // pass the slice here, so that the string will not escape, and maybe save allocation @@ -1566,10 +1477,16 @@ func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintpt func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t reflect.Type, style genStructMapStyle) { tpfx := genTempVarPfx - ti := x.ti.get(rtid, t) i := x.varsfx() kName := tpfx + "s" + i + // x.line("var " + kName + "Arr = [32]byte{} // default string to decode into") + // x.line("var " + kName + "Slc = " + kName + "Arr[:] // default slice to decode into") + // use the scratch buffer to avoid allocation (most field names are < 32). + + x.line("var " + kName + "Slc = z.DecScratchBuffer() // default slice to decode into") + + x.line("_ = " + kName + "Slc") switch style { case genStructMapStyleLenPrefix: x.linef("for %sj%s := 0; %sj%s < %s; %sj%s++ {", tpfx, i, tpfx, i, lenvarname, tpfx, i) @@ -1581,49 +1498,55 @@ 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()") - - // emulate decstructfieldkey - switch ti.keyType { - case valueTypeInt: - x.linef("%s := z.StringView(strconv.AppendInt(z.DecScratchArrayBuffer()[:0], r.DecodeInt64(), 10))", kName) - case valueTypeUint: - x.linef("%s := z.StringView(strconv.AppendUint(z.DecScratchArrayBuffer()[:0], r.DecodeUint64(), 10))", kName) - case valueTypeFloat: - x.linef("%s := z.StringView(strconv.AppendFloat(z.DecScratchArrayBuffer()[:0], r.DecodeFloat64(), 'f', -1, 64))", kName) - default: // string - x.linef("%s := z.StringView(r.DecodeStringAsBytes())", kName) - } - // x.linef("%s := z.StringView(r.DecStructFieldKey(codecSelferValueType%s%s, z.DecScratchArrayBuffer()))", kName, ti.keyType.String(), x.xs) - - x.line("r.ReadMapElemValue()") + x.line("r.ReadMapElemKey()") // f("z.DecSendContainerState(codecSelfer_containerMapKey%s)", x.xs) + x.line(kName + "Slc = r.DecodeStringAsBytes()") + // let string be scoped to this loop alone, so it doesn't escape. + x.line(kName + " := string(" + kName + "Slc)") + x.line("r.ReadMapElemValue()") // f("z.DecSendContainerState(codecSelfer_containerMapValue%s)", x.xs) x.decStructMapSwitch(kName, varname, rtid, t) x.line("} // end for " + tpfx + "j" + i) - x.line("r.ReadMapEnd()") + x.line("r.ReadMapEnd()") // f("z.DecSendContainerState(codecSelfer_containerMapEnd%s)", x.xs) } func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid uintptr, t reflect.Type) { tpfx := genTempVarPfx i := x.varsfx() ti := x.ti.get(rtid, t) - tisfi := ti.sfiSrc // always use sequence from file. decStruct expects same thing. + tisfi := ti.sfip // always use sequence from file. decStruct expects same thing. x.linef("var %sj%s int", tpfx, i) x.linef("var %sb%s bool", tpfx, i) // break x.linef("var %shl%s bool = %s >= 0", tpfx, i, lenvarname) // has length - var newbuf, nilbuf genBuf for _, si := range tisfi { + var t2 reflect.StructField + { + //we must accommodate anonymous fields, where the embedded field is a nil pointer in the value. + // t2 = t.FieldByIndex(si.is) + t2typ := t + varname3 := varname + for ij, ix := range si.is { + if uint8(ij) == si.nis { + break + } + for t2typ.Kind() == reflect.Ptr { + t2typ = t2typ.Elem() + } + t2 = t2typ.Field(int(ix)) + t2typ = t2.Type + varname3 = varname3 + "." + t2.Name + if t2typ.Kind() == reflect.Ptr { + x.linef("if %s == nil { %s = new(%s) }", varname3, varname3, x.genTypeName(t2typ.Elem())) + } + } + } + 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()") - newbuf.reset() - nilbuf.reset() - 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.line("}") + // x.linef("if %sb%s { z.DecSendContainerState(codecSelfer_containerArrayEnd%s); %s }", tpfx, i, x.xs, breakString) + x.line("r.ReadArrayElem()") // f("z.DecSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) + x.decVar(varname+"."+t2.Name, "", t2.Type, true) } // read remaining values and throw away. x.line("for {") @@ -1631,28 +1554,28 @@ 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("r.ReadArrayElem()") // f("z.DecSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) x.linef(`z.DecStructFieldNotFound(%sj%s - 1, "")`, tpfx, i) x.line("}") - x.line("r.ReadArrayEnd()") + x.line("r.ReadArrayEnd()") // f("z.DecSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs) } func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) { - // varname MUST be a ptr, or a struct field or a slice element. + // if container is map 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.linef("if %sl%s == 0 {", genTempVarPfx, i) - x.line("r.ReadMapEnd()") + x.line("r.ReadMapEnd()") // f("z.DecSendContainerState(codecSelfer_containerMapEnd%s)", x.xs) if genUseOneFunctionForDecStructMap { x.line("} else { ") - x.linef("%s.codecDecodeSelfFromMap(%sl%s, d)", varname, genTempVarPfx, i) + x.linef("x.codecDecodeSelfFromMap(%sl%s, d)", genTempVarPfx, i) } else { x.line("} else if " + genTempVarPfx + "l" + i + " > 0 { ") - x.line(varname + ".codecDecodeSelfFromMapLenPrefix(" + genTempVarPfx + "l" + i + ", d)") + x.line("x.codecDecodeSelfFromMapLenPrefix(" + genTempVarPfx + "l" + i + ", d)") x.line("} else {") - x.line(varname + ".codecDecodeSelfFromMapCheckBreak(" + genTempVarPfx + "l" + i + ", d)") + x.line("x.codecDecodeSelfFromMapCheckBreak(" + genTempVarPfx + "l" + i + ", d)") } x.line("}") @@ -1660,13 +1583,13 @@ func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) { x.linef("} else if %sct%s == codecSelferValueTypeArray%s {", genTempVarPfx, i, x.xs) x.line(genTempVarPfx + "l" + i + " := r.ReadArrayStart()") x.linef("if %sl%s == 0 {", genTempVarPfx, i) - x.line("r.ReadArrayEnd()") + x.line("r.ReadArrayEnd()") // f("z.DecSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs) x.line("} else { ") - x.linef("%s.codecDecodeSelfFromArray(%sl%s, d)", varname, genTempVarPfx, i) + x.linef("x.codecDecodeSelfFromArray(%sl%s, d)", genTempVarPfx, i) x.line("}") // else panic x.line("} else { ") - x.line("panic(errCodecSelferOnlyMapOrArrayEncodeToStruct" + x.xs + ")") + x.line("panic(codecSelferOnlyMapOrArrayEncodeToStructErr" + x.xs + ")") x.line("} ") } @@ -1726,7 +1649,7 @@ func genImportPath(t reflect.Type) (s string) { s = t.PkgPath() if genCheckVendor { // HACK: always handle vendoring. It should be typically on in go 1.6, 1.7 - s = genStripVendor(s) + s = stripVendor(s) } return } @@ -1854,7 +1777,7 @@ type genInternal struct { func (x genInternal) FastpathLen() (l int) { for _, v := range x.Values { - if v.Primitive == "" && !(v.MapKey == "" && v.Elem == "uint8") { + if v.Primitive == "" { l++ } } @@ -1874,32 +1797,6 @@ 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"}, -} - -func genInternalNonZeroValue(s string) string { - switch s { - case "interface{}", "interface {}": - genInternalNonZeroValueIdx[0]++ - return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[0]%2][0] // return string, to remove ambiguity - case "bool": - genInternalNonZeroValueIdx[1]++ - return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[1]%2][1] - case "string": - genInternalNonZeroValueIdx[2]++ - return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[2]%2][2] - case "float32", "float64", "float", "double": - genInternalNonZeroValueIdx[3]++ - return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[3]%2][3] - default: - genInternalNonZeroValueIdx[4]++ - return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[4]%2][4] - } -} - func genInternalEncCommandAsString(s string, vname string) string { switch s { case "uint", "uint8", "uint16", "uint32", "uint64": @@ -1907,15 +1804,15 @@ func genInternalEncCommandAsString(s string, vname string) string { case "int", "int8", "int16", "int32", "int64": return "ee.EncodeInt(int64(" + vname + "))" case "string": - return "ee.EncodeString(cUTF8, " + vname + ")" + return "ee.EncodeString(c_UTF8, " + vname + ")" case "float32": return "ee.EncodeFloat32(" + vname + ")" case "float64": return "ee.EncodeFloat64(" + vname + ")" case "bool": return "ee.EncodeBool(" + vname + ")" - // case "symbol": - // return "ee.EncodeSymbol(" + vname + ")" + case "symbol": + return "ee.EncodeSymbol(" + vname + ")" default: return "e.encode(" + vname + ")" } @@ -1924,34 +1821,34 @@ 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(dd.DecodeUint(uintBitsize))" case "uint8": - return "uint8(chkOvf.UintV(dd.DecodeUint64(), 8))" + return "uint8(dd.DecodeUint(8))" case "uint16": - return "uint16(chkOvf.UintV(dd.DecodeUint64(), 16))" + return "uint16(dd.DecodeUint(16))" case "uint32": - return "uint32(chkOvf.UintV(dd.DecodeUint64(), 32))" + return "uint32(dd.DecodeUint(32))" case "uint64": - return "dd.DecodeUint64()" + return "dd.DecodeUint(64)" case "uintptr": - return "uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))" + return "uintptr(dd.DecodeUint(uintBitsize))" case "int": - return "int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))" + return "int(dd.DecodeInt(intBitsize))" case "int8": - return "int8(chkOvf.IntV(dd.DecodeInt64(), 8))" + return "int8(dd.DecodeInt(8))" case "int16": - return "int16(chkOvf.IntV(dd.DecodeInt64(), 16))" + return "int16(dd.DecodeInt(16))" case "int32": - return "int32(chkOvf.IntV(dd.DecodeInt64(), 32))" + return "int32(dd.DecodeInt(32))" case "int64": - return "dd.DecodeInt64()" + return "dd.DecodeInt(64)" case "string": return "dd.DecodeString()" case "float32": - return "float32(chkOvf.Float32V(dd.DecodeFloat64()))" + return "float32(dd.DecodeFloat(true))" case "float64": - return "dd.DecodeFloat64()" + return "dd.DecodeFloat(false)" case "bool": return "dd.DecodeBool()" default: @@ -1975,7 +1872,7 @@ func genInternalSortType(s string, elem bool) string { panic("sorttype: unexpected type: " + s) } -func genStripVendor(s string) string { +func stripVendor(s string) string { // HACK: Misbehaviour occurs in go 1.5. May have to re-visit this later. // if s contains /vendor/ OR startsWith vendor/, then return everything after it. const vendorStart = "vendor/" @@ -2057,10 +1954,9 @@ func genInternalInit() { // 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]}) - // 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, genV{Elem: s, Size: mapvaltypes2[s]}) + 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]}) + } if _, ok := mapvaltypes2[s]; !ok { gt.Values = append(gt.Values, genV{MapKey: s, Elem: s, Size: 2 * mapvaltypes2[s]}) } @@ -2074,7 +1970,6 @@ func genInternalInit() { funcs["encmd"] = genInternalEncCommandAsString funcs["decmd"] = genInternalDecCommandAsString funcs["zerocmd"] = genInternalZeroValue - funcs["nonzerocmd"] = genInternalNonZeroValue funcs["hasprefix"] = strings.HasPrefix funcs["sorttype"] = genInternalSortType diff --git a/vendor/github.com/ugorji/go/codec/goversion_arrayof_gte_go15.go b/vendor/github.com/ugorji/go/codec/goversion_arrayof_gte_go15.go index 9ddbe205..7567e2c0 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_arrayof_gte_go15.go +++ b/vendor/github.com/ugorji/go/codec/goversion_arrayof_gte_go15.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.5 diff --git a/vendor/github.com/ugorji/go/codec/goversion_arrayof_lt_go15.go b/vendor/github.com/ugorji/go/codec/goversion_arrayof_lt_go15.go index c5fcd669..ec94bd0c 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_arrayof_lt_go15.go +++ b/vendor/github.com/ugorji/go/codec/goversion_arrayof_lt_go15.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build !go1.5 diff --git a/vendor/github.com/ugorji/go/codec/goversion_makemap_gte_go19.go b/vendor/github.com/ugorji/go/codec/goversion_makemap_gte_go19.go index bc39d6b7..51fe40e5 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_makemap_gte_go19.go +++ b/vendor/github.com/ugorji/go/codec/goversion_makemap_gte_go19.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.9 diff --git a/vendor/github.com/ugorji/go/codec/goversion_makemap_lt_go19.go b/vendor/github.com/ugorji/go/codec/goversion_makemap_lt_go19.go index cde4cd37..d4b9c2c8 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_makemap_lt_go19.go +++ b/vendor/github.com/ugorji/go/codec/goversion_makemap_lt_go19.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build !go1.9 diff --git a/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_gte_go110.go b/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_gte_go110.go deleted file mode 100644 index 794133a3..00000000 --- a/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_gte_go110.go +++ /dev/null @@ -1,8 +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. - -// +build go1.10 - -package codec - -const allowSetUnexportedEmbeddedPtr = false diff --git a/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_lt_go110.go b/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_lt_go110.go deleted file mode 100644 index fd92ede3..00000000 --- a/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_lt_go110.go +++ /dev/null @@ -1,8 +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. - -// +build !go1.10 - -package codec - -const allowSetUnexportedEmbeddedPtr = true diff --git a/vendor/github.com/ugorji/go/codec/goversion_unsupported_lt_go14.go b/vendor/github.com/ugorji/go/codec/goversion_unsupported_lt_go14.go index 8debfa61..dcd8c3d1 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_unsupported_lt_go14.go +++ b/vendor/github.com/ugorji/go/codec/goversion_unsupported_lt_go14.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build !go1.4 diff --git a/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go15.go b/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go15.go index 0f1bb01e..68626e1c 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go15.go +++ b/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go15.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.5,!go1.6 diff --git a/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go16.go b/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go16.go index 2fb4b057..344f5967 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go16.go +++ b/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go16.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.6,!go1.7 diff --git a/vendor/github.com/ugorji/go/codec/goversion_vendor_gte_go17.go b/vendor/github.com/ugorji/go/codec/goversion_vendor_gte_go17.go index c5b81550..de91d294 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_vendor_gte_go17.go +++ b/vendor/github.com/ugorji/go/codec/goversion_vendor_gte_go17.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.7 diff --git a/vendor/github.com/ugorji/go/codec/goversion_vendor_lt_go15.go b/vendor/github.com/ugorji/go/codec/goversion_vendor_lt_go15.go index 837cf240..9d007bfe 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_vendor_lt_go15.go +++ b/vendor/github.com/ugorji/go/codec/goversion_vendor_lt_go15.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build !go1.5 diff --git a/vendor/github.com/ugorji/go/codec/helper.go b/vendor/github.com/ugorji/go/codec/helper.go index 35f71d64..b846df0d 100644 --- a/vendor/github.com/ugorji/go/codec/helper.go +++ b/vendor/github.com/ugorji/go/codec/helper.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -102,8 +102,8 @@ import ( "encoding/binary" "errors" "fmt" - "io" "math" + "os" "reflect" "sort" "strconv" @@ -128,14 +128,42 @@ const ( // allowing zero-alloc initialization. arrayCacheLen = 8 - // size of the cacheline: defaulting to value for archs: amd64, arm64, 386 - // should use "runtime/internal/sys".CacheLineSize, but that is not exposed. - cacheLineSize = 64 + // We tried an optimization, where we detect if a type is one of the known types + // we optimized for (e.g. int, []uint64, etc). + // + // However, we notice some worse performance when using this optimization. + // So we hide it behind a flag, to turn on if needed. + useLookupRecognizedTypes = false - wordSizeBits = strconv.IntSize - wordSize = wordSizeBits / 8 + // using recognized allows us to do d.decode(interface{}) instead of d.decodeValue(reflect.Value) + // when we can infer that the kind of the interface{} is one of the ones hard-coded in the + // type switch for known types or the ones defined by fast-path. + // + // However, it seems we get better performance when we don't recognize, and just let + // reflection handle it. + // + // Reasoning is as below: + // typeswitch is a binary search with a branch to a code-point. + // getdecfn is a binary search with a call to a function pointer. + // + // both are about the same. + // + // so: why prefer typeswitch? + // + // is recognized does the following: + // - lookup rtid + // - check if in sorted list + // - calls decode(type switch) + // - 1 or 2 binary search to a point in code + // - branch there + // + // vs getdecfn + // - lookup rtid + // - check in sorted list for a function pointer + // - calls it to decode using reflection (optimized) - maxLevelsEmbedding = 15 // use this, so structFieldInfo fits into 8 bytes + // always set xDebug = false before releasing software + xDebug = true ) var ( @@ -143,28 +171,29 @@ var ( zeroByteSlice = oneByteArr[:0:0] ) -var refBitset bitset32 var pool pooler -var panicv panicHdl func init() { pool.init() - - refBitset.set(byte(reflect.Map)) - refBitset.set(byte(reflect.Ptr)) - refBitset.set(byte(reflect.Func)) - refBitset.set(byte(reflect.Chan)) } +// type findCodecFnMode uint8 + +// const ( +// findCodecFnModeMap findCodecFnMode = iota +// findCodecFnModeBinarySearch +// findCodecFnModeLinearSearch +// ) + type charEncoding uint8 const ( - cRAW charEncoding = iota - cUTF8 - cUTF16LE - cUTF16BE - cUTF32LE - cUTF32BE + c_RAW charEncoding = iota + c_UTF8 + c_UTF16LE + c_UTF16BE + c_UTF32LE + c_UTF32BE ) // valueType is the stream type @@ -182,31 +211,38 @@ const ( valueTypeBytes valueTypeMap valueTypeArray - valueTypeTime + valueTypeTimestamp valueTypeExt // valueTypeInvalid = 0xff ) -var valueTypeStrings = [...]string{ - "Unset", - "Nil", - "Int", - "Uint", - "Float", - "Bool", - "String", - "Symbol", - "Bytes", - "Map", - "Array", - "Timestamp", - "Ext", -} - func (x valueType) String() string { - if int(x) < len(valueTypeStrings) { - return valueTypeStrings[x] + switch x { + case valueTypeNil: + return "Nil" + case valueTypeInt: + return "Int" + case valueTypeUint: + return "Uint" + case valueTypeFloat: + return "Float" + case valueTypeBool: + return "Bool" + case valueTypeString: + return "String" + case valueTypeSymbol: + return "Symbol" + case valueTypeBytes: + return "Bytes" + case valueTypeMap: + return "Map" + case valueTypeArray: + return "Array" + case valueTypeTimestamp: + return "Timestamp" + case valueTypeExt: + return "Ext" } return strconv.FormatInt(int64(x), 10) } @@ -236,11 +272,11 @@ const ( containerArrayEnd ) -// // sfiIdx used for tracking where a (field/enc)Name is seen in a []*structFieldInfo -// type sfiIdx struct { -// name string -// index int -// } +// sfiIdx used for tracking where a (field/enc)Name is seen in a []*structFieldInfo +type sfiIdx struct { + name string + index int +} // do not recurse if a containing type refers to an embedded type // which refers back to its containing type (via a pointer). @@ -249,39 +285,30 @@ const ( const rgetMaxRecursion = 2 // Anecdotally, we believe most types have <= 12 fields. -// - even Java's PMD rules set TooManyFields threshold to 15. -// However, go has embedded fields, which should be regarded as -// top level, allowing structs to possibly double or triple. -// In addition, we don't want to keep creating transient arrays, -// especially for the sfi index tracking, and the evtypes tracking. -// -// So - try to keep typeInfoLoadArray within 2K bytes -const ( - typeInfoLoadArraySfisLen = 16 - typeInfoLoadArraySfiidxLen = 8 * 112 - typeInfoLoadArrayEtypesLen = 12 - typeInfoLoadArrayBLen = 8 * 4 -) +// Java's PMD rules set TooManyFields threshold to 15. +const typeInfoLoadArrayLen = 12 type typeInfoLoad struct { - // fNames []string - // encNames []string - etypes []uintptr - sfis []structFieldInfo + fNames []string + encNames []string + etypes []uintptr + sfis []*structFieldInfo } type typeInfoLoadArray struct { - // fNames [typeInfoLoadArrayLen]string - // encNames [typeInfoLoadArrayLen]string - sfis [typeInfoLoadArraySfisLen]structFieldInfo - sfiidx [typeInfoLoadArraySfiidxLen]byte - etypes [typeInfoLoadArrayEtypesLen]uintptr - b [typeInfoLoadArrayBLen]byte // scratch - used for struct field names + fNames [typeInfoLoadArrayLen]string + encNames [typeInfoLoadArrayLen]string + etypes [typeInfoLoadArrayLen]uintptr + sfis [typeInfoLoadArrayLen]*structFieldInfo + sfiidx [typeInfoLoadArrayLen]sfiIdx } +// type containerStateRecv interface { +// sendContainerState(containerState) +// } + // mirror json.Marshaler and json.Unmarshaler here, // so we don't import the encoding/json package - type jsonMarshaler interface { MarshalJSON() ([]byte, error) } @@ -289,10 +316,6 @@ type jsonUnmarshaler interface { UnmarshalJSON([]byte) error } -type isZeroer interface { - IsZero() bool -} - // type byteAccepter func(byte) bool var ( @@ -304,17 +327,11 @@ var ( intfSliceTyp = reflect.TypeOf([]interface{}(nil)) intfTyp = intfSliceTyp.Elem() - reflectValTyp = reflect.TypeOf((*reflect.Value)(nil)).Elem() - stringTyp = reflect.TypeOf("") timeTyp = reflect.TypeOf(time.Time{}) rawExtTyp = reflect.TypeOf(RawExt{}) rawTyp = reflect.TypeOf(Raw{}) - uintptrTyp = reflect.TypeOf(uintptr(0)) - uint8Typ = reflect.TypeOf(uint8(0)) uint8SliceTyp = reflect.TypeOf([]uint8(nil)) - uintTyp = reflect.TypeOf(uint(0)) - intTyp = reflect.TypeOf(int(0)) mapBySliceTyp = reflect.TypeOf((*MapBySlice)(nil)).Elem() @@ -328,9 +345,7 @@ var ( jsonUnmarshalerTyp = reflect.TypeOf((*jsonUnmarshaler)(nil)).Elem() selferTyp = reflect.TypeOf((*Selfer)(nil)).Elem() - iszeroTyp = reflect.TypeOf((*isZeroer)(nil)).Elem() - uint8TypId = rt2id(uint8Typ) uint8SliceTypId = rt2id(uint8SliceTyp) rawExtTypId = rt2id(rawExtTyp) rawTypId = rt2id(rawTyp) @@ -343,15 +358,15 @@ var ( intfSliceTypId = rt2id(intfSliceTyp) // mapBySliceTypId = rt2id(mapBySliceTyp) - intBitsize = uint8(intTyp.Bits()) - uintBitsize = uint8(uintTyp.Bits()) + intBitsize uint8 = uint8(reflect.TypeOf(int(0)).Bits()) + uintBitsize uint8 = uint8(reflect.TypeOf(uint(0)).Bits()) bsAll0x00 = []byte{0, 0, 0, 0, 0, 0, 0, 0} bsAll0xff = []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} chkOvf checkOverflow - errNoFieldNameToStructFieldInfo = errors.New("no field name passed to parseStructFieldInfo") + noFieldNameToStructFieldInfoErr = errors.New("no field name passed to parseStructFieldInfo") ) var defTypeInfos = NewTypeInfos([]string{"codec", "json"}) @@ -386,6 +401,69 @@ var immutableKindsSet = [32]bool{ // reflect.UnsafePointer } +var recognizedRtids []uintptr +var recognizedRtidPtrs []uintptr +var recognizedRtidOrPtrs []uintptr + +func init() { + if !useLookupRecognizedTypes { + return + } + for _, v := range [...]interface{}{ + float32(0), + float64(0), + uintptr(0), + uint(0), + uint8(0), + uint16(0), + uint32(0), + uint64(0), + uintptr(0), + int(0), + int8(0), + int16(0), + int32(0), + int64(0), + bool(false), + string(""), + Raw{}, + []byte(nil), + } { + rt := reflect.TypeOf(v) + recognizedRtids = append(recognizedRtids, rt2id(rt)) + recognizedRtidPtrs = append(recognizedRtidPtrs, rt2id(reflect.PtrTo(rt))) + } +} + +func containsU(s []uintptr, v uintptr) bool { + // return false // TODO: REMOVE + h, i, j := 0, 0, len(s) + for i < j { + h = i + (j-i)/2 + if s[h] < v { + i = h + 1 + } else { + j = h + } + } + if i < len(s) && s[i] == v { + return true + } + return false +} + +func isRecognizedRtid(rtid uintptr) bool { + return containsU(recognizedRtids, rtid) +} + +func isRecognizedRtidPtr(rtid uintptr) bool { + return containsU(recognizedRtidPtrs, rtid) +} + +func isRecognizedRtidOrPtr(rtid uintptr) bool { + return containsU(recognizedRtidOrPtrs, rtid) +} + // Selfer defines methods by which a value can encode or decode itself. // // Any type which implements Selfer will be able to encode or decode itself. @@ -396,55 +474,30 @@ type Selfer interface { CodecDecodeSelf(*Decoder) } -// MapBySlice is a tag interface that denotes wrapped slice should encode as a map in the stream. +// MapBySlice represents a slice which should be encoded as a map in the stream. // The slice contains a sequence of key-value pairs. // This affords storing a map in a specific sequence in the stream. // -// Example usage: -// type T1 []string // or []int or []Point or any other "slice" type -// func (_ T1) MapBySlice{} // T1 now implements MapBySlice, and will be encoded as a map -// type T2 struct { KeyValues T1 } -// -// var kvs = []string{"one", "1", "two", "2", "three", "3"} -// var v2 = T2{ KeyValues: T1(kvs) } -// // v2 will be encoded like the map: {"KeyValues": {"one": "1", "two": "2", "three": "3"} } -// // The support of MapBySlice affords the following: // - A slice type which implements MapBySlice will be encoded as a map // - A slice can be decoded from a map in the stream -// - It MUST be a slice type (not a pointer receiver) that implements MapBySlice type MapBySlice interface { MapBySlice() } -// BasicHandle encapsulates the common options and extension functions. +// WARNING: DO NOT USE DIRECTLY. EXPORTED FOR GODOC BENEFIT. WILL BE REMOVED. // -// Deprecated: DO NOT USE DIRECTLY. EXPORTED FOR GODOC BENEFIT. WILL BE REMOVED. +// BasicHandle encapsulates the common options and extension functions. type BasicHandle struct { - // BasicHandle is always a part of a different type. - // It doesn't have to fit into it own cache lines. - // TypeInfos is used to get the type info for any type. // // If not configured, the default TypeInfos is used, which uses struct tag keys: codec, json TypeInfos *TypeInfos - // Note: BasicHandle is not comparable, due to these slices here (extHandle, intf2impls). - // If *[]T is used instead, this becomes comparable, at the cost of extra indirection. - // Thses slices are used all the time, so keep as slices (not pointers). - extHandle - - intf2impls - - RPCOptions - - // ---- cache line - DecodeOptions - - // ---- cache line EncodeOptions - // noBuiltInTypeChecker + DecodeOptions + noBuiltInTypeChecker } func (x *BasicHandle) getBasicHandle() *BasicHandle { @@ -464,36 +517,30 @@ func (x *BasicHandle) getTypeInfo(rtid uintptr, rt reflect.Type) (pti *typeInfo) // and not modified while in use. Such a pre-configured Handle // is safe for concurrent access. type Handle interface { - Name() string getBasicHandle() *BasicHandle - recreateEncDriver(encDriver) bool newEncDriver(w *Encoder) encDriver newDecDriver(r *Decoder) decDriver isBinary() bool hasElemSeparators() bool - // IsBuiltinType(rtid uintptr) bool + IsBuiltinType(rtid uintptr) bool } // Raw represents raw formatted bytes. -// We "blindly" store it during encode and retrieve the raw bytes during decode. -// Note: it is dangerous during encode, so we may gate the behaviour -// behind an Encode flag which must be explicitly set. +// We "blindly" store it during encode and store the raw bytes during decode. +// Note: it is dangerous during encode, so we may gate the behaviour behind an Encode flag which must be explicitly set. type Raw []byte // RawExt represents raw unprocessed extension data. -// Some codecs will decode extension data as a *RawExt -// if there is no registered extension for the tag. +// Some codecs will decode extension data as a *RawExt if there is no registered extension for the tag. // -// Only one of Data or Value is nil. -// If Data is nil, then the content of the RawExt is in the Value. +// Only one of Data or Value is nil. If Data is nil, then the content of the RawExt is in the Value. type RawExt struct { Tag uint64 - // Data is the []byte which represents the raw ext. If nil, ext is exposed in Value. - // Data is used by codecs (e.g. binc, msgpack, simple) which do custom serialization of types + // Data is the []byte which represents the raw ext. If Data is nil, ext is exposed in Value. + // Data is used by codecs (e.g. binc, msgpack, simple) which do custom serialization of the types Data []byte // Value represents the extension, if Data is nil. - // Value is used by codecs (e.g. cbor, json) which leverage the format to do - // custom serialization of the types. + // Value is used by codecs (e.g. cbor, json) which use the format to do custom serialization of the types. Value interface{} } @@ -502,30 +549,24 @@ type RawExt struct { type BytesExt interface { // WriteExt converts a value to a []byte. // - // Note: v is a pointer iff the registered extension type is a struct or array kind. + // Note: v *may* be a pointer to the extension type, if the extension type was a struct or array. WriteExt(v interface{}) []byte // ReadExt updates a value from a []byte. - // - // Note: dst is always a pointer kind to the registered extension type. ReadExt(dst interface{}, src []byte) } // InterfaceExt handles custom (de)serialization of types to/from another interface{} value. // The Encoder or Decoder will then handle the further (de)serialization of that known type. // -// It is used by codecs (e.g. cbor, json) which use the format to do custom serialization of types. +// It is used by codecs (e.g. cbor, json) which use the format to do custom serialization of the types. type InterfaceExt interface { - // ConvertExt converts a value into a simpler interface for easy encoding - // e.g. convert time.Time to int64. + // ConvertExt converts a value into a simpler interface for easy encoding e.g. convert time.Time to int64. // - // Note: v is a pointer iff the registered extension type is a struct or array kind. + // Note: v *may* be a pointer to the extension type, if the extension type was a struct or array. ConvertExt(v interface{}) interface{} - // UpdateExt updates a value from a simpler interface for easy decoding - // e.g. convert int64 to time.Time. - // - // Note: dst is always a pointer kind to the registered extension type. + // UpdateExt updates a value from a simpler interface for easy decoding e.g. convert int64 to time.Time. UpdateExt(dst interface{}, src interface{}) } @@ -563,59 +604,69 @@ func (x addExtWrapper) UpdateExt(dest interface{}, v interface{}) { x.ReadExt(dest, v.([]byte)) } -type extWrapper struct { - BytesExt - InterfaceExt +type setExtWrapper struct { + b BytesExt + i InterfaceExt } -type bytesExtFailer struct{} - -func (bytesExtFailer) WriteExt(v interface{}) []byte { - panicv.errorstr("BytesExt.WriteExt is not supported") - return nil -} -func (bytesExtFailer) ReadExt(v interface{}, bs []byte) { - panicv.errorstr("BytesExt.ReadExt is not supported") +func (x *setExtWrapper) WriteExt(v interface{}) []byte { + if x.b == nil { + panic("BytesExt.WriteExt is not supported") + } + return x.b.WriteExt(v) } -type interfaceExtFailer struct{} +func (x *setExtWrapper) ReadExt(v interface{}, bs []byte) { + if x.b == nil { + panic("BytesExt.WriteExt is not supported") -func (interfaceExtFailer) ConvertExt(v interface{}) interface{} { - panicv.errorstr("InterfaceExt.ConvertExt is not supported") - return nil + } + x.b.ReadExt(v, bs) } -func (interfaceExtFailer) UpdateExt(dest interface{}, v interface{}) { - panicv.errorstr("InterfaceExt.UpdateExt is not supported") + +func (x *setExtWrapper) ConvertExt(v interface{}) interface{} { + if x.i == nil { + panic("InterfaceExt.ConvertExt is not supported") + + } + return x.i.ConvertExt(v) +} + +func (x *setExtWrapper) UpdateExt(dest interface{}, v interface{}) { + if x.i == nil { + panic("InterfaceExxt.UpdateExt is not supported") + + } + x.i.UpdateExt(dest, v) } type binaryEncodingType struct{} -func (binaryEncodingType) isBinary() bool { return true } +func (_ binaryEncodingType) isBinary() bool { return true } type textEncodingType struct{} -func (textEncodingType) isBinary() bool { return false } +func (_ textEncodingType) isBinary() bool { return false } // noBuiltInTypes is embedded into many types which do not support builtins // e.g. msgpack, simple, cbor. -// type noBuiltInTypeChecker struct{} -// func (noBuiltInTypeChecker) IsBuiltinType(rt uintptr) bool { return false } -// type noBuiltInTypes struct{ noBuiltInTypeChecker } +type noBuiltInTypeChecker struct{} -type noBuiltInTypes struct{} +func (_ noBuiltInTypeChecker) IsBuiltinType(rt uintptr) bool { return false } -func (noBuiltInTypes) EncodeBuiltin(rt uintptr, v interface{}) {} -func (noBuiltInTypes) DecodeBuiltin(rt uintptr, v interface{}) {} +type noBuiltInTypes struct{ noBuiltInTypeChecker } + +func (_ noBuiltInTypes) EncodeBuiltin(rt uintptr, v interface{}) {} +func (_ noBuiltInTypes) DecodeBuiltin(rt uintptr, v interface{}) {} // type noStreamingCodec struct{} -// func (noStreamingCodec) CheckBreak() bool { return false } -// func (noStreamingCodec) hasElemSeparators() bool { return false } +// func (_ noStreamingCodec) CheckBreak() bool { return false } +// func (_ noStreamingCodec) hasElemSeparators() bool { return false } type noElemSeparators struct{} -func (noElemSeparators) hasElemSeparators() (v bool) { return } -func (noElemSeparators) recreateEncDriver(e encDriver) (v bool) { return } +func (_ noElemSeparators) hasElemSeparators() (v bool) { return } // bigenHelper. // Users must already slice the x completely, because we will not reslice. @@ -640,174 +691,90 @@ func (z bigenHelper) writeUint64(v uint64) { } type extTypeTagFn struct { - rtid uintptr - rtidptr uintptr - rt reflect.Type - tag uint64 - ext Ext - _ [1]uint64 // padding + rtid uintptr + rt reflect.Type + tag uint64 + ext Ext } type extHandle []extTypeTagFn -// AddExt registes an encode and decode function for a reflect.Type. -// To deregister an Ext, call AddExt with nil encfn and/or nil decfn. +// DEPRECATED: Use SetBytesExt or SetInterfaceExt on the Handle instead. // -// Deprecated: Use SetBytesExt or SetInterfaceExt on the Handle instead. -func (o *extHandle) AddExt(rt reflect.Type, tag byte, - encfn func(reflect.Value) ([]byte, error), - decfn func(reflect.Value, []byte) error) (err error) { +// AddExt registes an encode and decode function for a reflect.Type. +// AddExt internally calls SetExt. +// To deregister an Ext, call AddExt with nil encfn and/or nil decfn. +func (o *extHandle) AddExt( + rt reflect.Type, tag byte, + encfn func(reflect.Value) ([]byte, error), decfn func(reflect.Value, []byte) error, +) (err error) { if encfn == nil || decfn == nil { return o.SetExt(rt, uint64(tag), nil) } return o.SetExt(rt, uint64(tag), addExtWrapper{encfn, decfn}) } -// SetExt will set the extension for a tag and reflect.Type. -// Note that the type must be a named type, and specifically not a pointer or Interface. -// An error is returned if that is not honored. -// To Deregister an ext, call SetExt with nil Ext. +// DEPRECATED: Use SetBytesExt or SetInterfaceExt on the Handle instead. // -// Deprecated: Use SetBytesExt or SetInterfaceExt on the Handle instead. +// Note that the type must be a named type, and specifically not +// a pointer or Interface. An error is returned if that is not honored. +// +// To Deregister an ext, call SetExt with nil Ext func (o *extHandle) SetExt(rt reflect.Type, tag uint64, ext Ext) (err error) { // o is a pointer, because we may need to initialize it - rk := rt.Kind() - for rk == reflect.Ptr { - rt = rt.Elem() - rk = rt.Kind() - } - - if rt.PkgPath() == "" || rk == reflect.Interface { // || rk == reflect.Ptr { - return fmt.Errorf("codec.Handle.SetExt: Takes named type, not a pointer or interface: %v", rt) + if rt.PkgPath() == "" || rt.Kind() == reflect.Interface { + err = fmt.Errorf("codec.Handle.AddExt: Takes named type, not a pointer or interface: %T", + reflect.Zero(rt).Interface()) + return } rtid := rt2id(rt) - switch rtid { - case timeTypId, rawTypId, rawExtTypId: - // all natively supported type, so cannot have an extension - return // TODO: should we silently ignore, or return an error??? - } - // if o == nil { - // return errors.New("codec.Handle.SetExt: extHandle not initialized") - // } - o2 := *o - // if o2 == nil { - // return errors.New("codec.Handle.SetExt: extHandle not initialized") - // } - for i := range o2 { - v := &o2[i] + for _, v := range *o { if v.rtid == rtid { v.tag, v.ext = tag, ext return } } - rtidptr := rt2id(reflect.PtrTo(rt)) - *o = append(o2, extTypeTagFn{rtid, rtidptr, rt, tag, ext, [1]uint64{}}) + + if *o == nil { + *o = make([]extTypeTagFn, 0, 4) + } + *o = append(*o, extTypeTagFn{rtid, rt, tag, ext}) return } -func (o extHandle) getExt(rtid uintptr) (v *extTypeTagFn) { +func (o extHandle) getExt(rtid uintptr) *extTypeTagFn { + var v *extTypeTagFn for i := range o { v = &o[i] - if v.rtid == rtid || v.rtidptr == rtid { - return + if v.rtid == rtid { + return v } } return nil } -func (o extHandle) getExtForTag(tag uint64) (v *extTypeTagFn) { +func (o extHandle) getExtForTag(tag uint64) *extTypeTagFn { + var v *extTypeTagFn for i := range o { v = &o[i] if v.tag == tag { - return + return v } } return nil } -type intf2impl struct { - rtid uintptr // for intf - impl reflect.Type - // _ [1]uint64 // padding // not-needed, as *intf2impl is never returned. -} - -type intf2impls []intf2impl - -// Intf2Impl maps an interface to an implementing type. -// This allows us support infering the concrete type -// and populating it when passed an interface. -// e.g. var v io.Reader can be decoded as a bytes.Buffer, etc. -// -// Passing a nil impl will clear the mapping. -func (o *intf2impls) Intf2Impl(intf, impl reflect.Type) (err error) { - if impl != nil && !impl.Implements(intf) { - return fmt.Errorf("Intf2Impl: %v does not implement %v", impl, intf) - } - rtid := rt2id(intf) - o2 := *o - for i := range o2 { - v := &o2[i] - if v.rtid == rtid { - v.impl = impl - return - } - } - *o = append(o2, intf2impl{rtid, impl}) - return -} - -func (o intf2impls) intf2impl(rtid uintptr) (rv reflect.Value) { - for i := range o { - v := &o[i] - if v.rtid == rtid { - if v.impl == nil { - return - } - if v.impl.Kind() == reflect.Ptr { - return reflect.New(v.impl.Elem()) - } - return reflect.New(v.impl).Elem() - } - } - return -} - -type structFieldInfoFlag uint8 - -const ( - _ structFieldInfoFlag = 1 << iota - structFieldInfoFlagReady - structFieldInfoFlagOmitEmpty -) - -func (x *structFieldInfoFlag) flagSet(f structFieldInfoFlag) { - *x = *x | f -} - -func (x *structFieldInfoFlag) flagClr(f structFieldInfoFlag) { - *x = *x &^ f -} - -func (x structFieldInfoFlag) flagGet(f structFieldInfoFlag) bool { - return x&f != 0 -} - -func (x structFieldInfoFlag) omitEmpty() bool { - return x.flagGet(structFieldInfoFlagOmitEmpty) -} - -func (x structFieldInfoFlag) ready() bool { - return x.flagGet(structFieldInfoFlagReady) -} +const maxLevelsEmbedding = 16 type structFieldInfo struct { encName string // encode name fieldName string // field name - is [maxLevelsEmbedding]uint16 // (recursive/embedded) field index in struct - nis uint8 // num levels of embedding. if 1, then it's not embedded. - structFieldInfoFlag + is [maxLevelsEmbedding]uint16 // (recursive/embedded) field index in struct + nis uint8 // num levels of embedding. if 1, then it's not embedded. + omitEmpty bool + toArray bool // if field is _struct, is the toArray set? } func (si *structFieldInfo) setToZeroValue(v reflect.Value) { @@ -833,63 +800,36 @@ func (si *structFieldInfo) field(v reflect.Value, update bool) (rv2 reflect.Valu return v, true } -// func (si *structFieldInfo) fieldval(v reflect.Value, update bool) reflect.Value { -// v, _ = si.field(v, update) -// return v -// } - -func parseStructInfo(stag string) (toArray, omitEmpty bool, keytype valueType) { - keytype = valueTypeString // default - if stag == "" { - return - } - for i, s := range strings.Split(stag, ",") { - if i == 0 { - } else { - switch s { - case "omitempty": - omitEmpty = true - case "toarray": - toArray = true - case "int": - keytype = valueTypeInt - case "uint": - keytype = valueTypeUint - case "float": - keytype = valueTypeFloat - // case "bool": - // keytype = valueTypeBool - case "string": - keytype = valueTypeString - } - } - } - return +func (si *structFieldInfo) fieldval(v reflect.Value, update bool) reflect.Value { + v, _ = si.field(v, update) + return v } -func (si *structFieldInfo) parseTag(stag string) { +func parseStructFieldInfo(fname string, stag string) *structFieldInfo { // if fname == "" { - // panic(errNoFieldNameToStructFieldInfo) + // panic(noFieldNameToStructFieldInfoErr) // } - - if stag == "" { - return + si := structFieldInfo{ + encName: fname, } - for i, s := range strings.Split(stag, ",") { - if i == 0 { - if s != "" { - si.encName = s - } - } else { - switch s { - case "omitempty": - si.flagSet(structFieldInfoFlagOmitEmpty) - // si.omitEmpty = true - // case "toarray": - // si.toArray = true + + if stag != "" { + for i, s := range strings.Split(stag, ",") { + if i == 0 { + if s != "" { + si.encName = s + } + } else { + if s == "omitempty" { + si.omitEmpty = true + } else if s == "toarray" { + si.toArray = true + } } } } + // si.encNameBs = []byte(si.encName) + return &si } type sfiSortedByEncName []*structFieldInfo @@ -915,6 +855,7 @@ type structFieldNodeCache struct { } func (x *structFieldNodeCache) get(key uint32) (fv reflect.Value, valid bool) { + // defer func() { fmt.Printf(">>>> found in cache2? %v\n", valid) }() for i, k := range &x.idx { if uint8(i) == x.num { return // break @@ -996,15 +937,7 @@ func baseStructRv(v reflect.Value, update bool) (v2 reflect.Value, valid bool) { return v, true } -type typeInfoFlag uint8 - -const ( - typeInfoFlagComparable = 1 << iota - typeInfoFlagIsZeroer - typeInfoFlagIsZeroerPtr -) - -// typeInfo keeps information about each (non-ptr) type referenced in the encode/decode sequence. +// typeInfo keeps information about each 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 @@ -1013,77 +946,77 @@ const ( // - If type is text(M/Unm)arshaler, call Text(M/Unm)arshal method // - Else decode appropriately based on the reflect.Kind type typeInfo struct { - rt reflect.Type - elem reflect.Type - pkgpath string + sfi []*structFieldInfo // sorted. Used when enc/dec struct to map. + sfip []*structFieldInfo // unsorted. Used when enc/dec struct to array. + rt reflect.Type rtid uintptr // rv0 reflect.Value // saved zero value, used if immutableKind numMeth uint16 // number of methods - kind uint8 - chandir uint8 - anyOmitEmpty bool // true if a struct, and any of the fields are tagged "omitempty" - toArray bool // whether this (struct) type should be encoded as an array - keyType valueType // if struct, how is the field name stored in a stream? default is string - mbs bool // base type (T or *T) is a MapBySlice + // baseId gives pointer to the base reflect.Type, after deferencing + // the pointers. E.g. base type of ***time.Time is time.Time. + base reflect.Type + baseId uintptr + baseIndir int8 // number of indirections to get to base - // ---- cpu cache line boundary? - sfiSort []*structFieldInfo // sorted. Used when enc/dec struct to map. - sfiSrc []*structFieldInfo // unsorted. Used when enc/dec struct to array. + anyOmitEmpty bool - key reflect.Type + mbs bool // base type (T or *T) is a MapBySlice - // ---- cpu cache line boundary? - // sfis []structFieldInfo // all sfi, in src order, as created. - sfiNamesSort []byte // all names, with indexes into the sfiSort + bm bool // base type (T or *T) is a binaryMarshaler + bunm bool // base type (T or *T) is a binaryUnmarshaler + bmIndir int8 // number of indirections to get to binaryMarshaler type + bunmIndir int8 // number of indirections to get to binaryUnmarshaler type - // format of marshal type fields below: [btj][mu]p? OR csp? + tm bool // base type (T or *T) is a textMarshaler + tunm bool // base type (T or *T) is a textUnmarshaler + tmIndir int8 // number of indirections to get to textMarshaler type + tunmIndir int8 // number of indirections to get to textUnmarshaler type - bm bool // T is a binaryMarshaler - bmp bool // *T is a binaryMarshaler - bu bool // T is a binaryUnmarshaler - bup bool // *T is a binaryUnmarshaler - tm bool // T is a textMarshaler - tmp bool // *T is a textMarshaler - tu bool // T is a textUnmarshaler - tup bool // *T is a textUnmarshaler + jm bool // base type (T or *T) is a jsonMarshaler + junm bool // base type (T or *T) is a jsonUnmarshaler + jmIndir int8 // number of indirections to get to jsonMarshaler type + junmIndir int8 // number of indirections to get to jsonUnmarshaler type - jm bool // T is a jsonMarshaler - jmp bool // *T is a jsonMarshaler - ju bool // T is a jsonUnmarshaler - jup bool // *T is a jsonUnmarshaler - cs bool // T is a Selfer - csp bool // *T is a Selfer + cs bool // base type (T or *T) is a Selfer + csIndir int8 // number of indirections to get to Selfer type - // other flags, with individual bits representing if set. - flags typeInfoFlag - - // _ [2]byte // padding - _ [3]uint64 // padding + toArray bool // whether this (struct) type should be encoded as an array } -func (ti *typeInfo) isFlag(f typeInfoFlag) bool { - return ti.flags&f != 0 -} +// define length beyond which we do a binary search instead of a linear search. +// From our testing, linear search seems faster than binary search up to 16-field structs. +// However, we set to 8 similar to what python does for hashtables. +const indexForEncNameBinarySearchThreshold = 8 -func (ti *typeInfo) indexForEncName(name []byte) (index int16) { - var sn []byte - if len(name)+2 <= 32 { - var buf [32]byte // should not escape - sn = buf[:len(name)+2] - } else { - sn = make([]byte, len(name)+2) - } - copy(sn[1:], name) - sn[0], sn[len(sn)-1] = tiSep2(name), 0xff - j := bytes.Index(ti.sfiNamesSort, sn) - if j < 0 { +func (ti *typeInfo) indexForEncName(name string) int { + // NOTE: name may be a stringView, so don't pass it to another function. + //tisfi := ti.sfi + sfilen := len(ti.sfi) + if sfilen < indexForEncNameBinarySearchThreshold { + for i, si := range ti.sfi { + if si.encName == name { + return i + } + } return -1 } - index = int16(uint16(ti.sfiNamesSort[j+len(sn)+1]) | uint16(ti.sfiNamesSort[j+len(sn)])<<8) - return + // binary search. adapted from sort/search.go. + h, i, j := 0, 0, sfilen + for i < j { + h = i + (j-i)/2 + if ti.sfi[h].encName < name { + i = h + 1 + } else { + j = h + } + } + if i < sfilen && ti.sfi[i].encName == name { + return i + } + return -1 } type rtid2ti struct { @@ -1096,11 +1029,9 @@ type rtid2ti struct { // It is configured with a set of tag keys, which are used to get // configuration for the type. type TypeInfos struct { - // infos: formerly map[uintptr]*typeInfo, now *[]rtid2ti, 2 words expected - infos atomicTypeInfoSlice + infos atomicTypeInfoSlice // formerly map[uintptr]*typeInfo, now *[]rtid2ti mu sync.Mutex tags []string - _ [2]uint64 // padding } // NewTypeInfos creates a TypeInfos given a set of struct tags keys. @@ -1123,12 +1054,12 @@ func (x *TypeInfos) structTag(t reflect.StructTag) (s string) { return } -func (x *TypeInfos) find(s []rtid2ti, rtid uintptr) (idx int, ti *typeInfo) { +func (x *TypeInfos) find(sp *[]rtid2ti, rtid uintptr) (idx int, ti *typeInfo) { // binary search. adapted from sort/search.go. // if sp == nil { // return -1, nil // } - // s := *sp + s := *sp h, i, j := 0, 0, len(s) for i < j { h = i + (j-i)/2 @@ -1148,89 +1079,94 @@ func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) { sp := x.infos.load() var idx int if sp != nil { - idx, pti = x.find(*sp, rtid) + idx, pti = x.find(sp, rtid) if pti != nil { return } } - rk := rt.Kind() - - if rk == reflect.Ptr { // || (rk == reflect.Interface && rtid != intfTypId) { - panicv.errorf("invalid kind passed to TypeInfos.get: %v - %v", rk, rt) - } - // do not hold lock while computing this. // it may lead to duplication, but that's ok. - ti := typeInfo{rt: rt, rtid: rtid, kind: uint8(rk), pkgpath: rt.PkgPath()} + ti := typeInfo{rt: rt, rtid: rtid} // ti.rv0 = reflect.Zero(rt) - // ti.comparable = rt.Comparable() ti.numMeth = uint16(rt.NumMethod()) - - ti.bm, ti.bmp = implIntf(rt, binaryMarshalerTyp) - ti.bu, ti.bup = implIntf(rt, binaryUnmarshalerTyp) - ti.tm, ti.tmp = implIntf(rt, textMarshalerTyp) - ti.tu, ti.tup = implIntf(rt, textUnmarshalerTyp) - ti.jm, ti.jmp = implIntf(rt, jsonMarshalerTyp) - ti.ju, ti.jup = implIntf(rt, jsonUnmarshalerTyp) - ti.cs, ti.csp = implIntf(rt, selferTyp) - - b1, b2 := implIntf(rt, iszeroTyp) - if b1 { - ti.flags |= typeInfoFlagIsZeroer + var ok bool + var indir int8 + if ok, indir = implementsIntf(rt, binaryMarshalerTyp); ok { + ti.bm, ti.bmIndir = true, indir } - if b2 { - ti.flags |= typeInfoFlagIsZeroerPtr + if ok, indir = implementsIntf(rt, binaryUnmarshalerTyp); ok { + ti.bunm, ti.bunmIndir = true, indir } - if rt.Comparable() { - ti.flags |= typeInfoFlagComparable + if ok, indir = implementsIntf(rt, textMarshalerTyp); ok { + ti.tm, ti.tmIndir = true, indir + } + if ok, indir = implementsIntf(rt, textUnmarshalerTyp); ok { + ti.tunm, ti.tunmIndir = true, indir + } + if ok, indir = implementsIntf(rt, jsonMarshalerTyp); ok { + ti.jm, ti.jmIndir = true, indir + } + if ok, indir = implementsIntf(rt, jsonUnmarshalerTyp); ok { + ti.junm, ti.junmIndir = true, indir + } + if ok, indir = implementsIntf(rt, selferTyp); ok { + ti.cs, ti.csIndir = true, indir + } + if ok, _ = implementsIntf(rt, mapBySliceTyp); ok { + ti.mbs = true } - switch rk { - case reflect.Struct: + pt := rt + var ptIndir int8 + // for ; pt.Kind() == reflect.Ptr; pt, ptIndir = pt.Elem(), ptIndir+1 { } + for pt.Kind() == reflect.Ptr { + pt = pt.Elem() + ptIndir++ + } + if ptIndir == 0 { + ti.base = rt + ti.baseId = rtid + } else { + ti.base = pt + ti.baseId = rt2id(pt) + ti.baseIndir = ptIndir + } + + if rt.Kind() == reflect.Struct { var omitEmpty bool if f, ok := rt.FieldByName(structInfoFieldName); ok { - ti.toArray, omitEmpty, ti.keyType = parseStructInfo(x.structTag(f.Tag)) - } else { - ti.keyType = valueTypeString + siInfo := parseStructFieldInfo(structInfoFieldName, x.structTag(f.Tag)) + ti.toArray = siInfo.toArray + omitEmpty = siInfo.omitEmpty } pp, pi := pool.tiLoad() pv := pi.(*typeInfoLoadArray) - pv.etypes[0] = ti.rtid - // vv := typeInfoLoad{pv.fNames[:0], pv.encNames[:0], pv.etypes[:1], pv.sfis[:0]} - vv := typeInfoLoad{pv.etypes[:1], pv.sfis[:0]} + pv.etypes[0] = ti.baseId + vv := typeInfoLoad{pv.fNames[:0], pv.encNames[:0], pv.etypes[:1], pv.sfis[:0]} x.rget(rt, rtid, omitEmpty, nil, &vv) - // ti.sfis = vv.sfis - ti.sfiSrc, ti.sfiSort, ti.sfiNamesSort, ti.anyOmitEmpty = rgetResolveSFI(rt, vv.sfis, pv) + ti.sfip, ti.sfi, ti.anyOmitEmpty = rgetResolveSFI(vv.sfis, pv.sfiidx[:0]) pp.Put(pi) - case reflect.Map: - ti.elem = rt.Elem() - ti.key = rt.Key() - case reflect.Slice: - ti.mbs, _ = implIntf(rt, mapBySliceTyp) - ti.elem = rt.Elem() - case reflect.Chan: - ti.elem = rt.Elem() - ti.chandir = uint8(rt.ChanDir()) - case reflect.Array, reflect.Ptr: - ti.elem = rt.Elem() } - // sfi = sfiSrc + // sfi = sfip + var vs []rtid2ti x.mu.Lock() sp = x.infos.load() if sp == nil { pti = &ti - vs := append(make([]rtid2ti, 0, 16), rtid2ti{rtid, pti}) + vs = []rtid2ti{{rtid, pti}} x.infos.store(&vs) } else { - idx, pti = x.find(*sp, rtid) + idx, pti = x.find(sp, rtid) if pti == nil { + s := *sp pti = &ti - vs := append(*sp, rtid2ti{}) - copy(vs[idx+1:], vs[idx:]) + vs = make([]rtid2ti, len(s)+1) + copy(vs, s[:idx]) vs[idx] = rtid2ti{rtid, pti} + copy(vs[idx+1:], s[idx:]) x.infos.store(&vs) } } @@ -1239,7 +1175,8 @@ func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) { } func (x *TypeInfos) rget(rt reflect.Type, rtid uintptr, omitEmpty bool, - indexstack []uint16, pv *typeInfoLoad) { + indexstack []uint16, pv *typeInfoLoad, +) { // Read up fields and store how to access the value. // // It uses go's rules for message selectors, @@ -1250,10 +1187,8 @@ func (x *TypeInfos) rget(rt reflect.Type, rtid uintptr, omitEmpty bool, // and iteration using equals is faster than maps there flen := rt.NumField() if flen > (1< %v fields are not supported - has %v fields", - (1< maxLevelsEmbedding-1 { - panicv.errorf("codec: only supports up to %v depth of embedding - type has %v depth", - maxLevelsEmbedding-1, len(indexstack)) + panic(fmt.Errorf("codec: only supports up to %v depth of embedding - type has %v depth", maxLevelsEmbedding-1, len(indexstack))) } si.nis = uint8(len(indexstack)) + 1 copy(si.is[:], indexstack) si.is[len(indexstack)] = j if omitEmpty { - si.flagSet(structFieldInfoFlagOmitEmpty) + si.omitEmpty = true } pv.sfis = append(pv.sfis, si) } } -func tiSep(name string) uint8 { - // (xn[0]%64) // (between 192-255 - outside ascii BMP) - // return 0xfe - (name[0] & 63) - // return 0xfe - (name[0] & 63) - uint8(len(name)) - // return 0xfe - (name[0] & 63) - uint8(len(name)&63) - // return ((0xfe - (name[0] & 63)) & 0xf8) | (uint8(len(name) & 0x07)) - return 0xfe - (name[0] & 63) - uint8(len(name)&63) -} - -func tiSep2(name []byte) uint8 { - return 0xfe - (name[0] & 63) - uint8(len(name)&63) -} - // resolves the struct field info got from a call to rget. // Returns a trimmed, unsorted and sorted []*structFieldInfo. -func rgetResolveSFI(rt reflect.Type, x []structFieldInfo, pv *typeInfoLoadArray) ( - y, z []*structFieldInfo, ss []byte, anyOmitEmpty bool) { - sa := pv.sfiidx[:0] - sn := pv.b[:] - n := len(x) - - var xn string - var ui uint16 - var sep byte - - 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) { - sn = make([]byte, len(xn)+2) - } else { - sn = sn[:len(xn)+2] - } - // use a custom sep, so that misses are less frequent, - // since the sep (first char in search) is as unique as first char in field name. - sep = tiSep(xn) - sn[0], sn[len(sn)-1] = sep, 0xff - copy(sn[1:], xn) - j := bytes.Index(sa, sn) - if j == -1 { - sa = append(sa, sep) - sa = append(sa, xn...) - 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 { - 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-- +func rgetResolveSFI(x []*structFieldInfo, pv []sfiIdx) (y, z []*structFieldInfo, anyOmitEmpty bool) { + var n int + for i, v := range x { + xn := v.encName // TODO: fieldName or encName? use encName for now. + var found bool + for j, k := range pv { + if k.name == xn { + // one of them must be reset to nil, and the index updated appropriately to the other one + if v.nis == x[k.index].nis { + } else if v.nis < x[k.index].nis { + pv[j].index = i + if x[k.index] != nil { + x[k.index] = nil + n++ + } + } else { + if x[i] != nil { + x[i] = nil + n++ + } } + found = true + break } } - - } - var w []structFieldInfo - sharingArray := len(x) <= typeInfoLoadArraySfisLen // sharing array with typeInfoLoadArray - if sharingArray { - w = make([]structFieldInfo, n) + if !found { + pv = append(pv, sfiIdx{xn, i}) + } } - // remove all the nils (non-ready) - y = make([]*structFieldInfo, n) + // remove all the nils + y = make([]*structFieldInfo, len(x)-n) n = 0 - var sslen int - for i := range x { - if !x[i].ready() { + for _, v := range x { + if v == nil { continue } - if !anyOmitEmpty && x[i].omitEmpty() { + if !anyOmitEmpty && v.omitEmpty { anyOmitEmpty = true } - if sharingArray { - w[n] = x[i] - y[n] = &w[n] - } else { - y[n] = &x[i] - } - sslen = sslen + len(x[i].encName) + 4 + y[n] = v n++ } - if n != len(y) { - panicv.errorf("failure reading struct %v - expecting %d of %d valid fields, got %d", - rt, len(y), len(x), n) - } z = make([]*structFieldInfo, len(y)) copy(z, y) sort.Sort(sfiSortedByEncName(z)) - - sharingArray = len(sa) <= typeInfoLoadArraySfiidxLen - if sharingArray { - ss = make([]byte, 0, sslen) - } else { - ss = sa[:0] // reuse the newly made sa array if necessary - } - for i := range z { - xn = z[i].encName - sep = tiSep(xn) - ui = uint16(i) - ss = append(ss, sep) - ss = append(ss, xn...) - ss = append(ss, 0xff, byte(ui>>8), byte(ui)) - } return } -func implIntf(rt, iTyp reflect.Type) (base bool, indir bool) { - return rt.Implements(iTyp), reflect.PtrTo(rt).Implements(iTyp) +func xprintf(format string, a ...interface{}) { + if xDebug { + fmt.Fprintf(os.Stderr, format, a...) + } } -// isEmptyStruct is only called from isEmptyValue, and checks if a struct is empty: -// - does it implement IsZero() bool -// - is it comparable, and can i compare directly using == -// - if checkStruct, then walk through the encodable fields -// and check if they are empty or not. -func isEmptyStruct(v reflect.Value, tinfos *TypeInfos, deref, checkStruct bool) bool { - // v is a struct kind - no need to check again. - // We only check isZero on a struct kind, to reduce the amount of times - // that we lookup the rtid and typeInfo for each type as we walk the tree. - - vt := v.Type() - rtid := rt2id(vt) - if tinfos == nil { - tinfos = defTypeInfos - } - ti := tinfos.get(rtid, vt) - if ti.rtid == timeTypId { - return rv2i(v).(time.Time).IsZero() - } - if ti.isFlag(typeInfoFlagIsZeroerPtr) && v.CanAddr() { - return rv2i(v.Addr()).(isZeroer).IsZero() - } - if ti.isFlag(typeInfoFlagIsZeroer) { - return rv2i(v).(isZeroer).IsZero() - } - if ti.isFlag(typeInfoFlagComparable) { - return rv2i(v) == rv2i(reflect.Zero(vt)) - } - if !checkStruct { - return false - } - // We only care about what we can encode/decode, - // so that is what we use to check omitEmpty. - for _, si := range ti.sfiSrc { - sfv, valid := si.field(v, false) - if valid && !isEmptyValue(sfv, tinfos, deref, checkStruct) { - return false +func panicToErr(err *error) { + if recoverPanicToErr { + if x := recover(); x != nil { + // if false && xDebug { + // fmt.Printf("panic'ing with: %v\n", x) + // debug.PrintStack() + // } + panicValToErr(x, err) } } - return true } -// func roundFloat(x float64) float64 { -// t := math.Trunc(x) -// if math.Abs(x-t) >= 0.5 { -// return t + math.Copysign(1, x) -// } -// return t +func panicToErrs2(err1, err2 *error) { + if recoverPanicToErr { + if x := recover(); x != nil { + panicValToErr(x, err1) + panicValToErr(x, err2) + } + } +} + +// func doPanic(tag string, format string, params ...interface{}) { +// params2 := make([]interface{}, len(params)+1) +// params2[0] = tag +// copy(params2[1:], params) +// panic(fmt.Errorf("%s: "+format, params2...)) // } -func panicToErr(h errstrDecorator, err *error) { - if recoverPanicToErr { - if x := recover(); x != nil { - // fmt.Printf("panic'ing with: %v\n", x) - // debug.PrintStack() - panicValToErr(h, x, err) - } - } -} - -func panicToErrs2(h errstrDecorator, err1, err2 *error) { - if recoverPanicToErr { - if x := recover(); x != nil { - panicValToErr(h, x, err1) - panicValToErr(h, x, err2) - } - } -} - -func panicValToErr(h errstrDecorator, v interface{}, err *error) { - switch xerr := v.(type) { - case nil: - case error: - switch xerr { - case nil: - case io.EOF, io.ErrUnexpectedEOF, errEncoderNotInitialized, errDecoderNotInitialized: - // treat as special (bubble up) - *err = xerr - default: - h.wrapErrstr(xerr.Error(), err) - } - case string: - if xerr != "" { - h.wrapErrstr(xerr, err) - } - case fmt.Stringer: - if xerr != nil { - h.wrapErrstr(xerr.String(), err) - } - default: - h.wrapErrstr(v, err) - } -} - func isImmutableKind(k reflect.Kind) (v bool) { return immutableKindsSet[k] + // return false || + // k == reflect.Int || + // k == reflect.Int8 || + // k == reflect.Int16 || + // k == reflect.Int32 || + // k == reflect.Int64 || + // k == reflect.Uint || + // k == reflect.Uint8 || + // k == reflect.Uint16 || + // k == reflect.Uint32 || + // k == reflect.Uint64 || + // k == reflect.Uintptr || + // k == reflect.Float32 || + // k == reflect.Float64 || + // k == reflect.Bool || + // k == reflect.String } // ---- @@ -1593,10 +1402,7 @@ type codecFnInfo struct { xfFn Ext xfTag uint64 seq seqType - addrD bool - addrF bool // if addrD, this says whether decode function can take a value or a ptr - addrE bool - ready bool // ready to use + addr bool } // codecFn encapsulates the captured variables and the encode function. @@ -1607,139 +1413,113 @@ type codecFn struct { i codecFnInfo fe func(*Encoder, *codecFnInfo, reflect.Value) fd func(*Decoder, *codecFnInfo, reflect.Value) - _ [1]uint64 // padding } type codecRtidFn struct { rtid uintptr - fn *codecFn + fn codecFn } type codecFner struct { - // hh Handle + hh Handle h *BasicHandle - s []codecRtidFn + cs [arrayCacheLen]*[arrayCacheLen]codecRtidFn + s []*[arrayCacheLen]codecRtidFn + sn uint32 be bool js bool - _ [6]byte // padding - _ [3]uint64 // padding + cf [arrayCacheLen]codecRtidFn } func (c *codecFner) reset(hh Handle) { - bh := hh.getBasicHandle() - // only reset iff extensions changed or *TypeInfos changed - var hhSame = true && - c.h == bh && c.h.TypeInfos == bh.TypeInfos && - len(c.h.extHandle) == len(bh.extHandle) && - (len(c.h.extHandle) == 0 || &c.h.extHandle[0] == &bh.extHandle[0]) - if !hhSame { - // c.hh = hh - c.h, bh = bh, c.h // swap both - _, c.js = hh.(*JsonHandle) - c.be = hh.isBinary() - for i := range c.s { - c.s[i].fn.i.ready = false - } - } + c.hh = hh + c.h = hh.getBasicHandle() + _, c.js = hh.(*JsonHandle) + c.be = hh.isBinary() } func (c *codecFner) get(rt reflect.Type, checkFastpath, checkCodecSelfer bool) (fn *codecFn) { rtid := rt2id(rt) - - for _, x := range c.s { - if x.rtid == rtid { - // if rtid exists, then there's a *codenFn attached (non-nil) - fn = x.fn - if fn.i.ready { - return - } - break - } - } - var ti *typeInfo - if fn == nil { - fn = new(codecFn) - if c.s == nil { - c.s = make([]codecRtidFn, 0, 8) - } - c.s = append(c.s, codecRtidFn{rtid, fn}) + var j uint32 + var sn uint32 = c.sn + if sn == 0 { + c.s = c.cs[:1] + c.s[0] = &c.cf + c.cf[0].rtid = rtid + fn = &(c.cf[0].fn) + c.sn = 1 } else { - ti = fn.i.ti - *fn = codecFn{} - fn.i.ti = ti - // fn.fe, fn.fd = nil, nil + LOOP1: + for _, x := range c.s { + for i := range x { + if j == sn { + break LOOP1 + } + if x[i].rtid == rtid { + fn = &(x[i].fn) + return + } + j++ + } + } + sx, sy := sn/arrayCacheLen, sn%arrayCacheLen + if sy == 0 { + c.s = append(c.s, &[arrayCacheLen]codecRtidFn{}) + } + c.s[sx][sy].rtid = rtid + fn = &(c.s[sx][sy].fn) + c.sn++ } + + ti := c.h.getTypeInfo(rtid, rt) fi := &(fn.i) - fi.ready = true - if ti == nil { - ti = c.h.getTypeInfo(rtid, rt) - fi.ti = ti - } + fi.ti = ti - rk := reflect.Kind(ti.kind) - - if checkCodecSelfer && (ti.cs || ti.csp) { + if checkCodecSelfer && ti.cs { fn.fe = (*Encoder).selferMarshal fn.fd = (*Decoder).selferUnmarshal - fi.addrF = true - fi.addrD = ti.csp - fi.addrE = ti.csp - } else if rtid == timeTypId { - fn.fe = (*Encoder).kTime - fn.fd = (*Decoder).kTime } else if rtid == rawTypId { fn.fe = (*Encoder).raw fn.fd = (*Decoder).raw } else if rtid == rawExtTypId { fn.fe = (*Encoder).rawExt fn.fd = (*Decoder).rawExt - fi.addrF = true - fi.addrD = true - fi.addrE = true + fn.i.addr = true + } else if c.hh.IsBuiltinType(rtid) { + fn.fe = (*Encoder).builtin + fn.fd = (*Decoder).builtin + fn.i.addr = true } else if xfFn := c.h.getExt(rtid); xfFn != nil { fi.xfTag, fi.xfFn = xfFn.tag, xfFn.ext fn.fe = (*Encoder).ext fn.fd = (*Decoder).ext - fi.addrF = true - fi.addrD = true - if rk == reflect.Struct || rk == reflect.Array { - fi.addrE = true - } - } else if supportMarshalInterfaces && c.be && (ti.bm || ti.bmp) && (ti.bu || ti.bup) { + fn.i.addr = true + } else if supportMarshalInterfaces && c.be && ti.bm { 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.be && c.js && ti.jm { //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.be && ti.tm { fn.fe = (*Encoder).textMarshal fn.fd = (*Decoder).textUnmarshal - fi.addrF = true - fi.addrD = ti.tup - fi.addrE = ti.tmp } else { + rk := rt.Kind() if fastpathEnabled && checkFastpath && (rk == reflect.Map || rk == reflect.Slice) { - if ti.pkgpath == "" { // un-named slice or map + if rt.PkgPath() == "" { // un-named slice or map if idx := fastpathAV.index(rtid); idx != -1 { fn.fe = fastpathAV[idx].encfn fn.fd = fastpathAV[idx].decfn - fi.addrD = true - fi.addrF = false + fn.i.addr = true } } else { // use mapping for underlying type if there var rtu reflect.Type if rk == reflect.Map { - rtu = reflect.MapOf(ti.key, ti.elem) + rtu = reflect.MapOf(rt.Key(), rt.Elem()) } else { - rtu = reflect.SliceOf(ti.elem) + rtu = reflect.SliceOf(rt.Elem()) } rtuid := rt2id(rtu) if idx := fastpathAV.index(rtuid); idx != -1 { @@ -1748,15 +1528,10 @@ func (c *codecFner) get(rt reflect.Type, checkFastpath, checkCodecSelfer bool) ( fn.fe = func(e *Encoder, xf *codecFnInfo, xrv reflect.Value) { xfnf(e, xf, xrv.Convert(xrt)) } - fi.addrD = true - fi.addrF = false // meaning it can be an address(ptr) or a value + fn.i.addr = true xfnf2 := fastpathAV[idx].decfn fn.fd = func(d *Decoder, xf *codecFnInfo, xrv reflect.Value) { - if xrv.Kind() == reflect.Ptr { - xfnf2(d, xf, xrv.Convert(reflect.PtrTo(xrt))) - } else { - xfnf2(d, xf, xrv.Convert(xrt)) - } + xfnf2(d, xf, xrv.Convert(reflect.PtrTo(xrt))) } } } @@ -1773,34 +1548,36 @@ func (c *codecFner) get(rt reflect.Type, checkFastpath, checkCodecSelfer bool) ( fn.fd = (*Decoder).kInt fn.fe = (*Encoder).kInt case reflect.Int8: - fn.fe = (*Encoder).kInt8 + fn.fe = (*Encoder).kInt fn.fd = (*Decoder).kInt8 case reflect.Int16: - fn.fe = (*Encoder).kInt16 + fn.fe = (*Encoder).kInt fn.fd = (*Decoder).kInt16 case reflect.Int32: - fn.fe = (*Encoder).kInt32 + fn.fe = (*Encoder).kInt fn.fd = (*Decoder).kInt32 case reflect.Int64: - fn.fe = (*Encoder).kInt64 + fn.fe = (*Encoder).kInt fn.fd = (*Decoder).kInt64 case reflect.Uint: fn.fd = (*Decoder).kUint fn.fe = (*Encoder).kUint case reflect.Uint8: - fn.fe = (*Encoder).kUint8 + fn.fe = (*Encoder).kUint fn.fd = (*Decoder).kUint8 case reflect.Uint16: - fn.fe = (*Encoder).kUint16 + fn.fe = (*Encoder).kUint fn.fd = (*Decoder).kUint16 case reflect.Uint32: - fn.fe = (*Encoder).kUint32 + fn.fe = (*Encoder).kUint fn.fd = (*Decoder).kUint32 case reflect.Uint64: - fn.fe = (*Encoder).kUint64 + fn.fe = (*Encoder).kUint fn.fd = (*Decoder).kUint64 + // case reflect.Ptr: + // fn.fd = (*Decoder).kPtr case reflect.Uintptr: - fn.fe = (*Encoder).kUintptr + fn.fe = (*Encoder).kUint fn.fd = (*Decoder).kUintptr case reflect.Float32: fn.fe = (*Encoder).kFloat32 @@ -1810,7 +1587,6 @@ func (c *codecFner) get(rt reflect.Type, checkFastpath, checkCodecSelfer bool) ( fn.fd = (*Decoder).kFloat64 case reflect.Invalid: fn.fe = (*Encoder).kInvalid - fn.fd = (*Decoder).kErr case reflect.Chan: fi.seq = seqTypeChan fn.fe = (*Encoder).kSlice @@ -1822,11 +1598,12 @@ func (c *codecFner) get(rt reflect.Type, checkFastpath, checkCodecSelfer bool) ( case reflect.Array: fi.seq = seqTypeArray fn.fe = (*Encoder).kSlice - fi.addrF = false - fi.addrD = false - rt2 := reflect.SliceOf(ti.elem) + fi.addr = false + rt2 := reflect.SliceOf(rt.Elem()) fn.fd = func(d *Decoder, xf *codecFnInfo, xrv reflect.Value) { - d.cfer().get(rt2, true, false).fd(d, xf, xrv.Slice(0, xrv.Len())) + // println(">>>>>> decoding an array ... ") + d.cf.get(rt2, true, false).fd(d, xf, xrv.Slice(0, xrv.Len())) + // println(">>>>>> decoding an array ... DONE") } // fn.fd = (*Decoder).kArray case reflect.Struct: @@ -1836,70 +1613,40 @@ func (c *codecFner) get(rt reflect.Type, checkFastpath, checkCodecSelfer bool) ( fn.fe = (*Encoder).kStructNoOmitempty } fn.fd = (*Decoder).kStruct + // reflect.Ptr and reflect.Interface are handled already by preEncodeValue + // case reflect.Ptr: + // fn.fe = (*Encoder).kPtr + // case reflect.Interface: + // fn.fe = (*Encoder).kInterface case reflect.Map: fn.fe = (*Encoder).kMap fn.fd = (*Decoder).kMap case reflect.Interface: // encode: reflect.Interface are handled already by preEncodeValue fn.fd = (*Decoder).kInterface - fn.fe = (*Encoder).kErr default: - // reflect.Ptr and reflect.Interface are handled already by preEncodeValue fn.fe = (*Encoder).kErr fn.fd = (*Decoder).kErr } } } + return } -type codecFnPooler struct { - cf *codecFner - cfp *sync.Pool - hh Handle -} - -func (d *codecFnPooler) cfer() *codecFner { - if d.cf == nil { - var v interface{} - d.cfp, v = pool.codecFner() - d.cf = v.(*codecFner) - d.cf.reset(d.hh) - } - return d.cf -} - -func (d *codecFnPooler) alwaysAtEnd() { - if d.cf != nil { - d.cfp.Put(d.cf) - d.cf, d.cfp = nil, nil - } -} - // ---- -// these "checkOverflow" functions must be inlinable, and not call anybody. -// Overflow means that the value cannot be represented without wrapping/overflow. -// Overflow=false does not mean that the value can be represented without losing precision -// (especially for floating point). - +// these functions must be inlinable, and not call anybody type checkOverflow struct{} -// func (checkOverflow) Float16(f float64) (overflow bool) { -// panicv.errorf("unimplemented") -// if f < 0 { -// f = -f -// } -// return math.MaxFloat32 < f && f <= math.MaxFloat64 -// } +func (_ checkOverflow) Float32(f float64) (overflow bool) { + if f < 0 { + f = -f + } + return math.MaxFloat32 < f && f <= math.MaxFloat64 +} -func (checkOverflow) Float32(v float64) (overflow bool) { - if v < 0 { - v = -v - } - return math.MaxFloat32 < v && v <= math.MaxFloat64 -} -func (checkOverflow) Uint(v uint64, bitsize uint8) (overflow bool) { +func (_ checkOverflow) Uint(v uint64, bitsize uint8) (overflow bool) { if bitsize == 0 || bitsize >= 64 || v == 0 { return } @@ -1908,7 +1655,8 @@ func (checkOverflow) Uint(v uint64, bitsize uint8) (overflow bool) { } return } -func (checkOverflow) Int(v int64, bitsize uint8) (overflow bool) { + +func (_ checkOverflow) Int(v int64, bitsize uint8) (overflow bool) { if bitsize == 0 || bitsize >= 64 || v == 0 { return } @@ -1917,76 +1665,39 @@ func (checkOverflow) Int(v int64, bitsize uint8) (overflow bool) { } return } -func (checkOverflow) SignedInt(v uint64) (overflow bool) { + +func (_ checkOverflow) SignedInt(v uint64) (i int64, overflow bool) { //e.g. -127 to 128 for int8 pos := (v >> 63) == 0 ui2 := v & 0x7fffffffffffffff if pos { if ui2 > math.MaxInt64 { overflow = true + return } } else { if ui2 > math.MaxInt64-1 { overflow = true + return } } + i = int64(v) return } -func (x checkOverflow) Float32V(v float64) float64 { - if x.Float32(v) { - panicv.errorf("float32 overflow: %v", v) - } - return v -} -func (x checkOverflow) UintV(v uint64, bitsize uint8) uint64 { - if x.Uint(v, bitsize) { - panicv.errorf("uint64 overflow: %v", v) - } - return v -} -func (x checkOverflow) IntV(v int64, bitsize uint8) int64 { - if x.Int(v, bitsize) { - panicv.errorf("int64 overflow: %v", v) - } - return v -} -func (x checkOverflow) SignedIntV(v uint64) int64 { - if x.SignedInt(v) { - panicv.errorf("uint64 to int64 overflow: %v", v) - } - return int64(v) -} - // ------------------ SORT ----------------- func isNaN(f float64) bool { return f != f } // ----------------------- -type ioFlusher interface { - Flush() error -} - -type ioPeeker interface { - Peek(int) ([]byte, error) -} - -type ioBuffered interface { - Buffered() int -} - -// ----------------------- - type intSlice []int64 type uintSlice []uint64 - -// type uintptrSlice []uintptr +type uintptrSlice []uintptr type floatSlice []float64 type boolSlice []bool type stringSlice []string - -// type bytesSlice [][]byte +type bytesSlice [][]byte func (p intSlice) Len() int { return len(p) } func (p intSlice) Less(i, j int) bool { return p[i] < p[j] } @@ -1996,9 +1707,9 @@ func (p uintSlice) Len() int { return len(p) } func (p uintSlice) Less(i, j int) bool { return p[i] < p[j] } func (p uintSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } -// func (p uintptrSlice) Len() int { return len(p) } -// func (p uintptrSlice) Less(i, j int) bool { return p[i] < p[j] } -// func (p uintptrSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } +func (p uintptrSlice) Len() int { return len(p) } +func (p uintptrSlice) Less(i, j int) bool { return p[i] < p[j] } +func (p uintptrSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } func (p floatSlice) Len() int { return len(p) } func (p floatSlice) Less(i, j int) bool { @@ -2010,9 +1721,9 @@ func (p stringSlice) Len() int { return len(p) } func (p stringSlice) Less(i, j int) bool { return p[i] < p[j] } func (p stringSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } -// func (p bytesSlice) Len() int { return len(p) } -// func (p bytesSlice) Less(i, j int) bool { return bytes.Compare(p[i], p[j]) == -1 } -// func (p bytesSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } +func (p bytesSlice) Len() int { return len(p) } +func (p bytesSlice) Less(i, j int) bool { return bytes.Compare(p[i], p[j]) == -1 } +func (p bytesSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } func (p boolSlice) Len() int { return len(p) } func (p boolSlice) Less(i, j int) bool { return !p[i] && p[j] } @@ -2050,11 +1761,6 @@ type bytesRv struct { 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[i].v < p[j].v } @@ -2082,10 +1788,6 @@ func (p boolRvSlice) Len() int { return len(p) } func (p boolRvSlice) Less(i, j int) bool { return !p[i].v && p[j].v } func (p boolRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } -func (p timeRvSlice) Len() int { return len(p) } -func (p timeRvSlice) Less(i, j int) bool { return p[i].v.Before(p[j].v) } -func (p timeRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - // ----------------- type bytesI struct { @@ -2177,69 +1879,36 @@ func (s *set) remove(v uintptr) (exists bool) { type bitset256 [32]byte -func (x *bitset256) isset(pos byte) bool { - return x[pos>>3]&(1<<(pos&7)) != 0 -} -func (x *bitset256) issetv(pos byte) byte { - return x[pos>>3] & (1 << (pos & 7)) -} func (x *bitset256) set(pos byte) { x[pos>>3] |= (1 << (pos & 7)) } - -// func (x *bitset256) unset(pos byte) { -// x[pos>>3] &^= (1 << (pos & 7)) -// } +func (x *bitset256) unset(pos byte) { + x[pos>>3] &^= (1 << (pos & 7)) +} +func (x *bitset256) isset(pos byte) bool { + return x[pos>>3]&(1<<(pos&7)) != 0 +} type bitset128 [16]byte -func (x *bitset128) isset(pos byte) bool { - return x[pos>>3]&(1<<(pos&7)) != 0 -} func (x *bitset128) set(pos byte) { x[pos>>3] |= (1 << (pos & 7)) } - -// func (x *bitset128) unset(pos byte) { -// x[pos>>3] &^= (1 << (pos & 7)) -// } - -type bitset32 [4]byte - -func (x *bitset32) isset(pos byte) bool { +func (x *bitset128) unset(pos byte) { + x[pos>>3] &^= (1 << (pos & 7)) +} +func (x *bitset128) isset(pos byte) bool { return x[pos>>3]&(1<<(pos&7)) != 0 } -func (x *bitset32) set(pos byte) { - x[pos>>3] |= (1 << (pos & 7)) -} - -// func (x *bitset32) unset(pos byte) { -// x[pos>>3] &^= (1 << (pos & 7)) -// } - -// type bit2set256 [64]byte - -// func (x *bit2set256) set(pos byte, v1, v2 bool) { -// var pos2 uint8 = (pos & 3) << 1 // returning 0, 2, 4 or 6 -// if v1 { -// x[pos>>2] |= 1 << (pos2 + 1) -// } -// if v2 { -// x[pos>>2] |= 1 << pos2 -// } -// } -// func (x *bit2set256) get(pos byte) uint8 { -// var pos2 uint8 = (pos & 3) << 1 // returning 0, 2, 4 or 6 -// return x[pos>>2] << (6 - pos2) >> 6 // 11000000 -> 00000011 -// } // ------------ type pooler struct { - dn sync.Pool // for decNaked - cfn sync.Pool // for codecFner - tiload sync.Pool - strRv8, strRv16, strRv32, strRv64, strRv128 sync.Pool // for stringRV + // for stringRV + strRv8, strRv16, strRv32, strRv64, strRv128 sync.Pool + // for the decNaked + dn sync.Pool + tiload sync.Pool } func (p *pooler) init() { @@ -2250,7 +1919,6 @@ func (p *pooler) init() { p.strRv128.New = func() interface{} { return new([128]stringRv) } p.dn.New = func() interface{} { x := new(decNaked); x.init(); return x } p.tiload.New = func() interface{} { return new(typeInfoLoadArray) } - p.cfn.New = func() interface{} { return new(codecFner) } } func (p *pooler) stringRv8() (sp *sync.Pool, v interface{}) { @@ -2271,143 +1939,6 @@ func (p *pooler) stringRv128() (sp *sync.Pool, v interface{}) { func (p *pooler) decNaked() (sp *sync.Pool, v interface{}) { return &p.dn, p.dn.Get() } -func (p *pooler) codecFner() (sp *sync.Pool, v interface{}) { - return &p.cfn, p.cfn.Get() -} func (p *pooler) tiLoad() (sp *sync.Pool, v interface{}) { return &p.tiload, p.tiload.Get() } - -// func (p *pooler) decNaked() (v *decNaked, f func(*decNaked) ) { -// sp := &(p.dn) -// vv := sp.Get() -// return vv.(*decNaked), func(x *decNaked) { sp.Put(vv) } -// } -// func (p *pooler) decNakedGet() (v interface{}) { -// return p.dn.Get() -// } -// func (p *pooler) codecFnerGet() (v interface{}) { -// return p.cfn.Get() -// } -// func (p *pooler) tiLoadGet() (v interface{}) { -// return p.tiload.Get() -// } -// func (p *pooler) decNakedPut(v interface{}) { -// p.dn.Put(v) -// } -// func (p *pooler) codecFnerPut(v interface{}) { -// p.cfn.Put(v) -// } -// func (p *pooler) tiLoadPut(v interface{}) { -// p.tiload.Put(v) -// } - -type panicHdl struct{} - -func (panicHdl) errorv(err error) { - if err != nil { - panic(err) - } -} - -func (panicHdl) errorstr(message string) { - if message != "" { - panic(message) - } -} - -func (panicHdl) errorf(format string, params ...interface{}) { - if format != "" { - if len(params) == 0 { - panic(format) - } else { - panic(fmt.Sprintf(format, params...)) - } - } -} - -type errstrDecorator interface { - wrapErrstr(interface{}, *error) -} - -type errstrDecoratorDef struct{} - -func (errstrDecoratorDef) wrapErrstr(v interface{}, e *error) { *e = fmt.Errorf("%v", v) } - -type must struct{} - -func (must) String(s string, err error) string { - if err != nil { - panicv.errorv(err) - } - return s -} -func (must) Int(s int64, err error) int64 { - if err != nil { - panicv.errorv(err) - } - return s -} -func (must) Uint(s uint64, err error) uint64 { - if err != nil { - panicv.errorv(err) - } - return s -} -func (must) Float(s float64, err error) float64 { - if err != nil { - panicv.errorv(err) - } - return s -} - -// xdebugf prints 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 - if len(pattern) > 0 && pattern[len(pattern)-1] != '\n' { - delim = "\n" - } - fmt.Printf("\033[1;31m"+pattern+delim+"\033[0m", args...) -} - -// func isImmutableKind(k reflect.Kind) (v bool) { -// return false || -// k == reflect.Int || -// k == reflect.Int8 || -// k == reflect.Int16 || -// k == reflect.Int32 || -// k == reflect.Int64 || -// k == reflect.Uint || -// k == reflect.Uint8 || -// k == reflect.Uint16 || -// k == reflect.Uint32 || -// k == reflect.Uint64 || -// k == reflect.Uintptr || -// k == reflect.Float32 || -// k == reflect.Float64 || -// k == reflect.Bool || -// k == reflect.String -// } - -// func timeLocUTCName(tzint int16) string { -// if tzint == 0 { -// 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. -// //tzhr, tzmin := tz/60, tz%60 //faster if u convert to int first -// var tzhr, tzmin int16 -// if tzint < 0 { -// tzname[3] = '-' // (TODO: verify. this works here) -// tzhr, tzmin = -tzint/60, (-tzint)%60 -// } else { -// tzhr, tzmin = tzint/60, tzint%60 -// } -// tzname[4] = timeDigits[tzhr/10] -// tzname[5] = timeDigits[tzhr%10] -// tzname[7] = timeDigits[tzmin/10] -// tzname[8] = timeDigits[tzmin%10] -// return string(tzname) -// //return time.FixedZone(string(tzname), int(tzint)*60) -// } diff --git a/vendor/github.com/ugorji/go/codec/helper_internal.go b/vendor/github.com/ugorji/go/codec/helper_internal.go index 0cbd665e..eb18e2cc 100644 --- a/vendor/github.com/ugorji/go/codec/helper_internal.go +++ b/vendor/github.com/ugorji/go/codec/helper_internal.go @@ -6,6 +6,74 @@ package codec // All non-std package dependencies live in this file, // so porting to different environment is easy (just update functions). +import ( + "errors" + "fmt" + "math" + "reflect" +) + +func panicValToErr(panicVal interface{}, err *error) { + if panicVal == nil { + return + } + // case nil + switch xerr := panicVal.(type) { + case error: + *err = xerr + case string: + *err = errors.New(xerr) + default: + *err = fmt.Errorf("%v", panicVal) + } + return +} + +func hIsEmptyValue(v reflect.Value, deref, checkStruct bool) bool { + switch v.Kind() { + case reflect.Invalid: + return true + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + if deref { + if v.IsNil() { + return true + } + return hIsEmptyValue(v.Elem(), deref, checkStruct) + } else { + return v.IsNil() + } + case reflect.Struct: + if !checkStruct { + return false + } + // return true if all fields are empty. else return false. + // we cannot use equality check, because some fields may be maps/slices/etc + // and consequently the structs are not comparable. + // return v.Interface() == reflect.Zero(v.Type()).Interface() + for i, n := 0, v.NumField(); i < n; i++ { + if !hIsEmptyValue(v.Field(i), deref, checkStruct) { + return false + } + } + return true + } + return false +} + +func isEmptyValue(v reflect.Value, deref, checkStruct bool) bool { + return hIsEmptyValue(v, deref, checkStruct) +} + func pruneSignExt(v []byte, pos bool) (n int) { if len(v) < 2 { } else if pos && v[0] == 0 { @@ -18,6 +86,37 @@ func pruneSignExt(v []byte, pos bool) (n int) { return } +func implementsIntf(typ, iTyp reflect.Type) (success bool, indir int8) { + if typ == nil { + return + } + rt := typ + // The type might be a pointer and we need to keep + // dereferencing to the base type until we find an implementation. + for { + if rt.Implements(iTyp) { + return true, indir + } + if p := rt; p.Kind() == reflect.Ptr { + indir++ + if indir >= math.MaxInt8 { // insane number of indirections + return false, 0 + } + rt = p.Elem() + continue + } + break + } + // No luck yet, but if this is a base type (non-pointer), the pointer might satisfy. + if typ.Kind() != reflect.Ptr { + // Not a pointer, but does the pointer work? + if reflect.PtrTo(typ).Implements(iTyp) { + return true, -1 + } + } + return false, 0 +} + // validate that this function is correct ... // culled from OGRE (Object-Oriented Graphics Rendering Engine) // function: halfToFloatI (http://stderr.org/doc/ogre-doc/api/OgreBitwise_8h-source.html) @@ -30,20 +129,21 @@ func halfFloatToFloatBits(yy uint16) (d uint32) { if e == 0 { if m == 0 { // plu or minus 0 return s << 31 + } else { // Denormalized number -- renormalize it + for (m & 0x00000400) == 0 { + m <<= 1 + e -= 1 + } + e += 1 + const zz uint32 = 0x0400 + m &= ^zz } - // Denormalized number -- renormalize it - for (m & 0x00000400) == 0 { - m <<= 1 - e -= 1 - } - e += 1 - const zz uint32 = 0x0400 - m &= ^zz } else if e == 31 { if m == 0 { // Inf return (s << 31) | 0x7f800000 + } else { // NaN + return (s << 31) | 0x7f800000 | (m << 13) } - return (s << 31) | 0x7f800000 | (m << 13) // NaN } e = e + (127 - 15) m = m << 13 diff --git a/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go b/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go index 0c5e1bfd..9d9d048e 100644 --- a/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go +++ b/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go @@ -1,6 +1,6 @@ // +build !go1.7 safe appengine -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -8,11 +8,8 @@ package codec import ( "reflect" "sync/atomic" - "time" ) -const safeMode = true - // stringView returns a view of the []byte as a string. // In unsafe mode, it doesn't incur allocation and copying caused by conversion. // In regular safe mode, it is an allocation and copy. @@ -34,11 +31,28 @@ func bytesView(v string) []byte { } func definitelyNil(v interface{}) bool { - // this is a best-effort option. - // We just return false, so we don't unnecessarily incur the cost of reflection this early. return false + // rv := reflect.ValueOf(v) + // switch rv.Kind() { + // case reflect.Invalid: + // return true + // case reflect.Ptr, reflect.Interface, reflect.Chan, reflect.Slice, reflect.Map, reflect.Func: + // return rv.IsNil() + // default: + // return false + // } } +// // keepAlive4BytesView maintains a reference to the input parameter for bytesView. +// // +// // Usage: call this at point where done with the bytes view. +// func keepAlive4BytesView(v string) {} + +// // keepAlive4BytesView maintains a reference to the input parameter for stringView. +// // +// // Usage: call this at point where done with the string view. +// func keepAlive4StringView(v []byte) {} + func rv2i(rv reflect.Value) interface{} { return rv.Interface() } @@ -51,50 +65,16 @@ func rv2rtid(rv reflect.Value) uintptr { return reflect.ValueOf(rv.Type()).Pointer() } -func i2rtid(i interface{}) uintptr { - return reflect.ValueOf(reflect.TypeOf(i)).Pointer() -} - -// -------------------------- - -func isEmptyValue(v reflect.Value, tinfos *TypeInfos, deref, checkStruct bool) bool { - switch v.Kind() { - case reflect.Invalid: - return true - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Interface, reflect.Ptr: - if deref { - if v.IsNil() { - return true - } - return isEmptyValue(v.Elem(), tinfos, deref, checkStruct) - } - return v.IsNil() - case reflect.Struct: - return isEmptyStruct(v, tinfos, deref, checkStruct) - } - return false -} - // -------------------------- // type ptrToRvMap struct{} -// func (*ptrToRvMap) init() {} -// func (*ptrToRvMap) get(i interface{}) reflect.Value { +// func (_ *ptrToRvMap) init() {} +// func (_ *ptrToRvMap) get(i interface{}) reflect.Value { // return reflect.ValueOf(i).Elem() // } // -------------------------- -type atomicTypeInfoSlice struct { // expected to be 2 words +type atomicTypeInfoSlice struct { v atomic.Value } @@ -123,150 +103,54 @@ func (d *Decoder) kBool(f *codecFnInfo, rv reflect.Value) { rv.SetBool(d.d.DecodeBool()) } -func (d *Decoder) kTime(f *codecFnInfo, rv reflect.Value) { - rv.Set(reflect.ValueOf(d.d.DecodeTime())) -} - 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.d.DecodeFloat(true)) } func (d *Decoder) kFloat64(f *codecFnInfo, rv reflect.Value) { - rv.SetFloat(d.d.DecodeFloat64()) + rv.SetFloat(d.d.DecodeFloat(false)) } func (d *Decoder) kInt(f *codecFnInfo, rv reflect.Value) { - rv.SetInt(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + rv.SetInt(d.d.DecodeInt(intBitsize)) } func (d *Decoder) kInt8(f *codecFnInfo, rv reflect.Value) { - rv.SetInt(chkOvf.IntV(d.d.DecodeInt64(), 8)) + rv.SetInt(d.d.DecodeInt(8)) } func (d *Decoder) kInt16(f *codecFnInfo, rv reflect.Value) { - rv.SetInt(chkOvf.IntV(d.d.DecodeInt64(), 16)) + rv.SetInt(d.d.DecodeInt(16)) } func (d *Decoder) kInt32(f *codecFnInfo, rv reflect.Value) { - rv.SetInt(chkOvf.IntV(d.d.DecodeInt64(), 32)) + rv.SetInt(d.d.DecodeInt(32)) } func (d *Decoder) kInt64(f *codecFnInfo, rv reflect.Value) { - rv.SetInt(d.d.DecodeInt64()) + rv.SetInt(d.d.DecodeInt(64)) } func (d *Decoder) kUint(f *codecFnInfo, rv reflect.Value) { - rv.SetUint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + rv.SetUint(d.d.DecodeUint(uintBitsize)) } func (d *Decoder) kUintptr(f *codecFnInfo, rv reflect.Value) { - rv.SetUint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + rv.SetUint(d.d.DecodeUint(uintBitsize)) } func (d *Decoder) kUint8(f *codecFnInfo, rv reflect.Value) { - rv.SetUint(chkOvf.UintV(d.d.DecodeUint64(), 8)) + rv.SetUint(d.d.DecodeUint(8)) } func (d *Decoder) kUint16(f *codecFnInfo, rv reflect.Value) { - rv.SetUint(chkOvf.UintV(d.d.DecodeUint64(), 16)) + rv.SetUint(d.d.DecodeUint(16)) } func (d *Decoder) kUint32(f *codecFnInfo, rv reflect.Value) { - rv.SetUint(chkOvf.UintV(d.d.DecodeUint64(), 32)) + rv.SetUint(d.d.DecodeUint(32)) } func (d *Decoder) kUint64(f *codecFnInfo, rv reflect.Value) { - rv.SetUint(d.d.DecodeUint64()) + rv.SetUint(d.d.DecodeUint(64)) } - -// ---------------- - -func (e *Encoder) kBool(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeBool(rv.Bool()) -} - -func (e *Encoder) kTime(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeTime(rv2i(rv).(time.Time)) -} - -func (e *Encoder) kString(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeString(cUTF8, rv.String()) -} - -func (e *Encoder) kFloat64(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeFloat64(rv.Float()) -} - -func (e *Encoder) kFloat32(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeFloat32(float32(rv.Float())) -} - -func (e *Encoder) kInt(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeInt(rv.Int()) -} - -func (e *Encoder) kInt8(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeInt(rv.Int()) -} - -func (e *Encoder) kInt16(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeInt(rv.Int()) -} - -func (e *Encoder) kInt32(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeInt(rv.Int()) -} - -func (e *Encoder) kInt64(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeInt(rv.Int()) -} - -func (e *Encoder) kUint(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeUint(rv.Uint()) -} - -func (e *Encoder) kUint8(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeUint(rv.Uint()) -} - -func (e *Encoder) kUint16(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeUint(rv.Uint()) -} - -func (e *Encoder) kUint32(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeUint(rv.Uint()) -} - -func (e *Encoder) kUint64(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeUint(rv.Uint()) -} - -func (e *Encoder) kUintptr(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeUint(rv.Uint()) -} - -// // keepAlive4BytesView maintains a reference to the input parameter for bytesView. -// // -// // Usage: call this at point where done with the bytes view. -// func keepAlive4BytesView(v string) {} - -// // keepAlive4BytesView maintains a reference to the input parameter for stringView. -// // -// // Usage: call this at point where done with the string view. -// func keepAlive4StringView(v []byte) {} - -// func definitelyNil(v interface{}) bool { -// rv := reflect.ValueOf(v) -// switch rv.Kind() { -// case reflect.Invalid: -// return true -// case reflect.Ptr, reflect.Interface, reflect.Chan, reflect.Slice, reflect.Map, reflect.Func: -// return rv.IsNil() -// default: -// return false -// } -// } diff --git a/vendor/github.com/ugorji/go/codec/helper_unsafe.go b/vendor/github.com/ugorji/go/codec/helper_unsafe.go index 5e9a33ae..c7c01b81 100644 --- a/vendor/github.com/ugorji/go/codec/helper_unsafe.go +++ b/vendor/github.com/ugorji/go/codec/helper_unsafe.go @@ -2,7 +2,7 @@ // +build !appengine // +build go1.7 -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -10,7 +10,6 @@ package codec import ( "reflect" "sync/atomic" - "time" "unsafe" ) @@ -19,7 +18,6 @@ import ( // var zeroRTv [4]uintptr -const safeMode = false const unsafeFlagIndir = 1 << 7 // keep in sync with GO_ROOT/src/reflect/value.go type unsafeString struct { @@ -48,49 +46,50 @@ func stringView(v []byte) string { if len(v) == 0 { return "" } + bx := (*unsafeSlice)(unsafe.Pointer(&v)) - return *(*string)(unsafe.Pointer(&unsafeString{bx.Data, bx.Len})) + sx := unsafeString{bx.Data, bx.Len} + return *(*string)(unsafe.Pointer(&sx)) } func bytesView(v string) []byte { if len(v) == 0 { return zeroByteSlice } + sx := (*unsafeString)(unsafe.Pointer(&v)) - return *(*[]byte)(unsafe.Pointer(&unsafeSlice{sx.Data, sx.Len, sx.Len})) + bx := unsafeSlice{sx.Data, sx.Len, sx.Len} + return *(*[]byte)(unsafe.Pointer(&bx)) } func definitelyNil(v interface{}) bool { - // There is no global way of checking if an interface is nil. - // For true references (map, ptr, func, chan), you can just look - // at the word of the interface. However, for slices, you have to dereference - // the word, and get a pointer to the 3-word interface value. - // - // However, the following are cheap calls - // - TypeOf(interface): cheap 2-line call. - // - ValueOf(interface{}): expensive - // - type.Kind: cheap call through an interface - // - Value.Type(): cheap call - // except it's a method value (e.g. r.Read, which implies that it is a Func) - - return ((*unsafeIntf)(unsafe.Pointer(&v))).word == nil + return (*unsafeIntf)(unsafe.Pointer(&v)).word == nil } -func rv2i(rv reflect.Value) interface{} { - // TODO: consider a more generally-known optimization for reflect.Value ==> Interface - // - // Currently, we use this fragile method that taps into implememtation details from - // the source go stdlib reflect/value.go, and trims the implementation. +// func keepAlive4BytesView(v string) { +// runtime.KeepAlive(v) +// } - urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - // true references (map, func, chan, ptr - NOT slice) may be double-referenced as flagIndir - var ptr unsafe.Pointer - if refBitset.isset(byte(urv.flag&(1<<5-1))) && urv.flag&unsafeFlagIndir != 0 { - ptr = *(*unsafe.Pointer)(urv.ptr) - } else { - ptr = urv.ptr +// func keepAlive4StringView(v []byte) { +// runtime.KeepAlive(v) +// } + +// TODO: consider a more generally-known optimization for reflect.Value ==> Interface +// +// Currently, we use this fragile method that taps into implememtation details from +// the source go stdlib reflect/value.go, +// and trims the implementation. +func rv2i(rv reflect.Value) interface{} { + if false { + return rv.Interface() } - return *(*interface{})(unsafe.Pointer(&unsafeIntf{typ: urv.typ, word: ptr})) + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + // references that are single-words (map, ptr) may be double-referenced as flagIndir + kk := urv.flag & (1<<5 - 1) + if (kk == uintptr(reflect.Map) || kk == uintptr(reflect.Ptr)) && urv.flag&unsafeFlagIndir != 0 { + return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: *(*unsafe.Pointer)(urv.ptr), typ: urv.typ})) + } + return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: urv.ptr, typ: urv.typ})) } func rt2id(rt reflect.Type) uintptr { @@ -101,83 +100,16 @@ func rv2rtid(rv reflect.Value) uintptr { return uintptr((*unsafeReflectValue)(unsafe.Pointer(&rv)).typ) } -func i2rtid(i interface{}) uintptr { - return uintptr(((*unsafeIntf)(unsafe.Pointer(&i))).typ) -} +// func rv0t(rt reflect.Type) reflect.Value { +// ut := (*unsafeIntf)(unsafe.Pointer(&rt)) +// // we need to determine whether ifaceIndir, and then whether to just pass 0 as the ptr +// uv := unsafeReflectValue{ut.word, &zeroRTv, flag(rt.Kind())} +// return *(*reflect.Value)(unsafe.Pointer(&uv}) +// } // -------------------------- - -func isEmptyValue(v reflect.Value, tinfos *TypeInfos, deref, checkStruct bool) bool { - urv := (*unsafeReflectValue)(unsafe.Pointer(&v)) - if urv.flag == 0 { - return true - } - switch v.Kind() { - case reflect.Invalid: - return true - case reflect.String: - return (*unsafeString)(urv.ptr).Len == 0 - case reflect.Slice: - return (*unsafeSlice)(urv.ptr).Len == 0 - case reflect.Bool: - return !*(*bool)(urv.ptr) - case reflect.Int: - return *(*int)(urv.ptr) == 0 - case reflect.Int8: - return *(*int8)(urv.ptr) == 0 - case reflect.Int16: - return *(*int16)(urv.ptr) == 0 - case reflect.Int32: - return *(*int32)(urv.ptr) == 0 - case reflect.Int64: - return *(*int64)(urv.ptr) == 0 - case reflect.Uint: - return *(*uint)(urv.ptr) == 0 - case reflect.Uint8: - return *(*uint8)(urv.ptr) == 0 - case reflect.Uint16: - return *(*uint16)(urv.ptr) == 0 - case reflect.Uint32: - return *(*uint32)(urv.ptr) == 0 - case reflect.Uint64: - return *(*uint64)(urv.ptr) == 0 - case reflect.Uintptr: - return *(*uintptr)(urv.ptr) == 0 - case reflect.Float32: - return *(*float32)(urv.ptr) == 0 - case reflect.Float64: - return *(*float64)(urv.ptr) == 0 - case reflect.Interface: - isnil := urv.ptr == nil || *(*unsafe.Pointer)(urv.ptr) == nil - if deref { - if isnil { - return true - } - return isEmptyValue(v.Elem(), tinfos, deref, checkStruct) - } - return isnil - case reflect.Ptr: - isnil := urv.ptr == nil - if deref { - if isnil { - return true - } - return isEmptyValue(v.Elem(), tinfos, deref, checkStruct) - } - return isnil - case reflect.Struct: - return isEmptyStruct(v, tinfos, deref, checkStruct) - case reflect.Map, reflect.Array, reflect.Chan: - return v.Len() == 0 - } - return false -} - -// -------------------------- - -type atomicTypeInfoSlice struct { // expected to be 2 words +type atomicTypeInfoSlice struct { v unsafe.Pointer - _ [8]byte // padding } func (x *atomicTypeInfoSlice) load() *[]rtid2ti { @@ -191,6 +123,9 @@ func (x *atomicTypeInfoSlice) store(p *[]rtid2ti) { // -------------------------- func (d *Decoder) raw(f *codecFnInfo, rv reflect.Value) { urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + // if urv.flag&unsafeFlagIndir != 0 { + // urv.ptr = *(*unsafe.Pointer)(urv.ptr) + // } *(*[]byte)(urv.ptr) = d.rawBytes() } @@ -204,214 +139,73 @@ func (d *Decoder) kBool(f *codecFnInfo, rv reflect.Value) { *(*bool)(urv.ptr) = d.d.DecodeBool() } -func (d *Decoder) kTime(f *codecFnInfo, rv reflect.Value) { - urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*time.Time)(urv.ptr) = d.d.DecodeTime() -} - 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.d.DecodeFloat(true)) } func (d *Decoder) kFloat64(f *codecFnInfo, rv reflect.Value) { urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*float64)(urv.ptr) = d.d.DecodeFloat64() + *(*float64)(urv.ptr) = d.d.DecodeFloat(false) } func (d *Decoder) kInt(f *codecFnInfo, rv reflect.Value) { urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*int)(urv.ptr) = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) + *(*int)(urv.ptr) = int(d.d.DecodeInt(intBitsize)) } func (d *Decoder) kInt8(f *codecFnInfo, rv reflect.Value) { urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*int8)(urv.ptr) = int8(chkOvf.IntV(d.d.DecodeInt64(), 8)) + *(*int8)(urv.ptr) = int8(d.d.DecodeInt(8)) } func (d *Decoder) kInt16(f *codecFnInfo, rv reflect.Value) { urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*int16)(urv.ptr) = int16(chkOvf.IntV(d.d.DecodeInt64(), 16)) + *(*int16)(urv.ptr) = int16(d.d.DecodeInt(16)) } func (d *Decoder) kInt32(f *codecFnInfo, rv reflect.Value) { urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*int32)(urv.ptr) = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) + *(*int32)(urv.ptr) = int32(d.d.DecodeInt(32)) } func (d *Decoder) kInt64(f *codecFnInfo, rv reflect.Value) { urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*int64)(urv.ptr) = d.d.DecodeInt64() + *(*int64)(urv.ptr) = d.d.DecodeInt(64) } func (d *Decoder) kUint(f *codecFnInfo, rv reflect.Value) { urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*uint)(urv.ptr) = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + *(*uint)(urv.ptr) = uint(d.d.DecodeUint(uintBitsize)) } func (d *Decoder) kUintptr(f *codecFnInfo, rv reflect.Value) { urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*uintptr)(urv.ptr) = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) + *(*uintptr)(urv.ptr) = uintptr(d.d.DecodeUint(uintBitsize)) } func (d *Decoder) kUint8(f *codecFnInfo, rv reflect.Value) { urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*uint8)(urv.ptr) = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) + *(*uint8)(urv.ptr) = uint8(d.d.DecodeUint(8)) } func (d *Decoder) kUint16(f *codecFnInfo, rv reflect.Value) { urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*uint16)(urv.ptr) = uint16(chkOvf.UintV(d.d.DecodeUint64(), 16)) + *(*uint16)(urv.ptr) = uint16(d.d.DecodeUint(16)) } func (d *Decoder) kUint32(f *codecFnInfo, rv reflect.Value) { urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*uint32)(urv.ptr) = uint32(chkOvf.UintV(d.d.DecodeUint64(), 32)) + *(*uint32)(urv.ptr) = uint32(d.d.DecodeUint(32)) } func (d *Decoder) kUint64(f *codecFnInfo, rv reflect.Value) { urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - *(*uint64)(urv.ptr) = d.d.DecodeUint64() + *(*uint64)(urv.ptr) = d.d.DecodeUint(64) } // ------------ -func (e *Encoder) kBool(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeBool(*(*bool)(v.ptr)) -} - -func (e *Encoder) kTime(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeTime(*(*time.Time)(v.ptr)) -} - -func (e *Encoder) kString(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeString(cUTF8, *(*string)(v.ptr)) -} - -func (e *Encoder) kFloat64(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeFloat64(*(*float64)(v.ptr)) -} - -func (e *Encoder) kFloat32(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeFloat32(*(*float32)(v.ptr)) -} - -func (e *Encoder) kInt(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeInt(int64(*(*int)(v.ptr))) -} - -func (e *Encoder) kInt8(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeInt(int64(*(*int8)(v.ptr))) -} - -func (e *Encoder) kInt16(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeInt(int64(*(*int16)(v.ptr))) -} - -func (e *Encoder) kInt32(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeInt(int64(*(*int32)(v.ptr))) -} - -func (e *Encoder) kInt64(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeInt(int64(*(*int64)(v.ptr))) -} - -func (e *Encoder) kUint(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeUint(uint64(*(*uint)(v.ptr))) -} - -func (e *Encoder) kUint8(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeUint(uint64(*(*uint8)(v.ptr))) -} - -func (e *Encoder) kUint16(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeUint(uint64(*(*uint16)(v.ptr))) -} - -func (e *Encoder) kUint32(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeUint(uint64(*(*uint32)(v.ptr))) -} - -func (e *Encoder) kUint64(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeUint(uint64(*(*uint64)(v.ptr))) -} - -func (e *Encoder) kUintptr(f *codecFnInfo, rv reflect.Value) { - v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) - e.e.EncodeUint(uint64(*(*uintptr)(v.ptr))) -} - -// ------------ - -// func (d *Decoder) raw(f *codecFnInfo, rv reflect.Value) { -// urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) -// // if urv.flag&unsafeFlagIndir != 0 { -// // urv.ptr = *(*unsafe.Pointer)(urv.ptr) -// // } -// *(*[]byte)(urv.ptr) = d.rawBytes() -// } - -// func rv0t(rt reflect.Type) reflect.Value { -// ut := (*unsafeIntf)(unsafe.Pointer(&rt)) -// // we need to determine whether ifaceIndir, and then whether to just pass 0 as the ptr -// uv := unsafeReflectValue{ut.word, &zeroRTv, flag(rt.Kind())} -// return *(*reflect.Value)(unsafe.Pointer(&uv}) -// } - -// func rv2i(rv reflect.Value) interface{} { -// urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) -// // true references (map, func, chan, ptr - NOT slice) may be double-referenced as flagIndir -// var ptr unsafe.Pointer -// // kk := reflect.Kind(urv.flag & (1<<5 - 1)) -// // if (kk == reflect.Map || kk == reflect.Ptr || kk == reflect.Chan || kk == reflect.Func) && urv.flag&unsafeFlagIndir != 0 { -// if refBitset.isset(byte(urv.flag&(1<<5-1))) && urv.flag&unsafeFlagIndir != 0 { -// ptr = *(*unsafe.Pointer)(urv.ptr) -// } else { -// ptr = urv.ptr -// } -// return *(*interface{})(unsafe.Pointer(&unsafeIntf{typ: urv.typ, word: ptr})) -// // return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: *(*unsafe.Pointer)(urv.ptr), typ: urv.typ})) -// // return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: urv.ptr, typ: urv.typ})) -// } - -// func definitelyNil(v interface{}) bool { -// var ui *unsafeIntf = (*unsafeIntf)(unsafe.Pointer(&v)) -// if ui.word == nil { -// return true -// } -// var tk = reflect.TypeOf(v).Kind() -// return (tk == reflect.Interface || tk == reflect.Slice) && *(*unsafe.Pointer)(ui.word) == nil -// fmt.Printf(">>>> definitely nil: isnil: %v, TYPE: \t%T, word: %v, *word: %v, type: %v, nil: %v\n", -// v == nil, v, word, *((*unsafe.Pointer)(word)), ui.typ, nil) -// } - -// func keepAlive4BytesView(v string) { -// runtime.KeepAlive(v) -// } - -// func keepAlive4StringView(v []byte) { -// runtime.KeepAlive(v) -// } - // func rt2id(rt reflect.Type) uintptr { // return uintptr(((*unsafeIntf)(unsafe.Pointer(&rt))).word) // // var i interface{} = rt diff --git a/vendor/github.com/ugorji/go/codec/json.go b/vendor/github.com/ugorji/go/codec/json.go index ec7b0d65..a6af2c80 100644 --- a/vendor/github.com/ugorji/go/codec/json.go +++ b/vendor/github.com/ugorji/go/codec/json.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -17,6 +17,16 @@ package codec // Note: // - we cannot use strconv.Quote and strconv.Unquote because json quotes/unquotes differently. // We implement it here. +// - Also, strconv.ParseXXX for floats and integers +// - only works on strings resulting in unnecessary allocation and []byte-string conversion. +// - it does a lot of redundant checks, because json numbers are simpler that what it supports. +// - We parse numbers (floats and integers) directly here. +// We only delegate parsing floats if it is a hairy float which could cause a loss of precision. +// In that case, we delegate to strconv.ParseFloat. +// +// Note: +// - encode does not beautify. There is no whitespace when encoding. +// - rpc calls which take single integer arguments or write single numeric arguments will need care. // Top-level methods of json(End|Dec)Driver (which are implementations of (en|de)cDriver // MUST not call one-another. @@ -24,41 +34,49 @@ package codec import ( "bytes" "encoding/base64" - "math" "reflect" "strconv" - "time" - "unicode" "unicode/utf16" "unicode/utf8" ) //-------------------------------- -var jsonLiterals = [...]byte{ - '"', 't', 'r', 'u', 'e', '"', - '"', 'f', 'a', 'l', 's', 'e', '"', - '"', 'n', 'u', 'l', 'l', '"', -} +var ( + // jsonLiterals = [...]byte{'t', 'r', 'u', 'e', 'f', 'a', 'l', 's', 'e', 'n', 'u', 'l', 'l'} -const ( - jsonLitTrueQ = 0 - jsonLitTrue = 1 - jsonLitFalseQ = 6 - jsonLitFalse = 7 - jsonLitNullQ = 13 - jsonLitNull = 14 + // jsonFloat64Pow10 = [...]float64{ + // 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, + // 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, + // 1e20, 1e21, 1e22, + // } + + // jsonUint64Pow10 = [...]uint64{ + // 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, + // 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, + // } + + // jsonTabs and jsonSpaces are used as caches for indents + jsonTabs, jsonSpaces string + + jsonCharHtmlSafeSet bitset128 + jsonCharSafeSet bitset128 + jsonCharWhitespaceSet bitset256 + jsonNumSet bitset256 + // jsonIsFloatSet bitset256 + + jsonU4Set [256]byte ) const ( - jsonU4Chk2 = '0' - jsonU4Chk1 = 'a' - 10 - jsonU4Chk0 = 'A' - 10 + // jsonUnreadAfterDecNum controls whether we unread after decoding a number. + // + // instead of unreading, just update d.tok (iff it's not a whitespace char) + // However, doing this means that we may HOLD onto some data which belongs to another stream. + // Thus, it is safest to unread the data when done. + // keep behind a constant flag for now. + jsonUnreadAfterDecNum = true - jsonScratchArrayLen = 64 -) - -const ( // If !jsonValidateSymbols, decoding will be faster, by skipping some checks: // - If we see first character of null, false or true, // do not validate subsequent characters. @@ -69,24 +87,20 @@ const ( jsonSpacesOrTabsLen = 128 - jsonAlwaysReturnInternString = false -) - -var ( - // jsonTabs and jsonSpaces are used as caches for indents - jsonTabs, jsonSpaces [jsonSpacesOrTabsLen]byte - - jsonCharHtmlSafeSet bitset128 - jsonCharSafeSet bitset128 - jsonCharWhitespaceSet bitset256 - jsonNumSet bitset256 + jsonU4SetErrVal = 128 ) func init() { + var bs [jsonSpacesOrTabsLen]byte for i := 0; i < jsonSpacesOrTabsLen; i++ { - jsonSpaces[i] = ' ' - jsonTabs[i] = '\t' + bs[i] = ' ' } + jsonSpaces = string(bs[:]) + + for i := 0; i < jsonSpacesOrTabsLen; i++ { + bs[i] = '\t' + } + jsonTabs = string(bs[:]) // populate the safe values as true: note: ASCII control characters are (0-31) // jsonCharSafeSet: all true except (0-31) " \ @@ -110,113 +124,38 @@ func init() { jsonNumSet.set(i) } } + for j := range jsonU4Set { + switch i = byte(j); i { + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + jsonU4Set[i] = i - '0' + case 'a', 'b', 'c', 'd', 'e', 'f': + jsonU4Set[i] = i - 'a' + 10 + case 'A', 'B', 'C', 'D', 'E', 'F': + jsonU4Set[i] = i - 'A' + 10 + default: + jsonU4Set[i] = jsonU4SetErrVal + } + // switch i = byte(j); i { + // case 'e', 'E', '.': + // jsonIsFloatSet.set(i) + // } + } + // jsonU4Set[255] = jsonU4SetErrVal } -// ---------------- - -type jsonEncDriverTypical struct { - w encWriter - // w *encWriterSwitch - b *[jsonScratchArrayLen]byte - tw bool // term white space +type jsonEncDriver struct { + e *Encoder + w encWriter + h *JsonHandle + b [64]byte // scratch + bs []byte // scratch + se setExtWrapper + ds string // indent string + dl uint16 // indent level + dt bool // indent using tabs + d bool // indent c containerState -} - -func (e *jsonEncDriverTypical) typical() {} - -func (e *jsonEncDriverTypical) reset(ee *jsonEncDriver) { - e.w = ee.ew - // e.w = &ee.e.encWriterSwitch - e.b = &ee.b - e.tw = ee.h.TermWhitespace - e.c = 0 -} - -func (e *jsonEncDriverTypical) WriteArrayStart(length int) { - e.w.writen1('[') - e.c = containerArrayStart -} - -func (e *jsonEncDriverTypical) WriteArrayElem() { - if 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 { - 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) { - if b { - e.w.writeb(jsonLiterals[jsonLitTrue : jsonLitTrue+4]) - } else { - e.w.writeb(jsonLiterals[jsonLitFalse : jsonLitFalse+5]) - } -} - -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)) -} - -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) atEndOfEncode() { - if e.tw { - e.w.writen1(' ') - } -} - -// ---------------- - -type jsonEncDriverGeneric struct { - w encWriter // encWriter // *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 + noBuiltInTypes } // indent is done as below: @@ -224,26 +163,7 @@ 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 { - 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.ks = h.MapKeyAsString - e.is = h.IntegerAsString -} - -func (e *jsonEncDriverGeneric) WriteArrayStart(length int) { +func (e *jsonEncDriver) WriteArrayStart(length int) { if e.d { e.dl++ } @@ -251,7 +171,7 @@ func (e *jsonEncDriverGeneric) WriteArrayStart(length int) { e.c = containerArrayStart } -func (e *jsonEncDriverGeneric) WriteArrayElem() { +func (e *jsonEncDriver) WriteArrayElem() { if e.c != containerArrayStart { e.w.writen1(',') } @@ -261,7 +181,7 @@ func (e *jsonEncDriverGeneric) WriteArrayElem() { e.c = containerArrayElem } -func (e *jsonEncDriverGeneric) WriteArrayEnd() { +func (e *jsonEncDriver) WriteArrayEnd() { if e.d { e.dl-- if e.c != containerArrayStart { @@ -272,7 +192,7 @@ func (e *jsonEncDriverGeneric) WriteArrayEnd() { e.c = containerArrayEnd } -func (e *jsonEncDriverGeneric) WriteMapStart(length int) { +func (e *jsonEncDriver) WriteMapStart(length int) { if e.d { e.dl++ } @@ -280,7 +200,7 @@ func (e *jsonEncDriverGeneric) WriteMapStart(length int) { e.c = containerMapStart } -func (e *jsonEncDriverGeneric) WriteMapElemKey() { +func (e *jsonEncDriver) WriteMapElemKey() { if e.c != containerMapStart { e.w.writen1(',') } @@ -290,7 +210,7 @@ func (e *jsonEncDriverGeneric) WriteMapElemKey() { e.c = containerMapKey } -func (e *jsonEncDriverGeneric) WriteMapElemValue() { +func (e *jsonEncDriver) WriteMapElemValue() { if e.d { e.w.writen2(':', ' ') } else { @@ -299,7 +219,7 @@ func (e *jsonEncDriverGeneric) WriteMapElemValue() { e.c = containerMapValue } -func (e *jsonEncDriverGeneric) WriteMapEnd() { +func (e *jsonEncDriver) WriteMapEnd() { if e.d { e.dl-- if e.c != containerMapStart { @@ -310,141 +230,116 @@ func (e *jsonEncDriverGeneric) WriteMapEnd() { e.c = containerMapEnd } -func (e *jsonEncDriverGeneric) writeIndent() { +// func (e *jsonEncDriver) sendContainerState(c containerState) { +// // determine whether to output separators +// switch c { +// case containerMapKey: +// if e.c != containerMapStart { +// e.w.writen1(',') +// } +// if e.d { +// e.writeIndent() +// } +// case containerMapValue: +// if e.d { +// e.w.writen2(':', ' ') +// } else { +// e.w.writen1(':') +// } +// case containerMapEnd: +// if e.d { +// e.dl-- +// if e.c != containerMapStart { +// e.writeIndent() +// } +// } +// e.w.writen1('}') +// case containerArrayElem: +// if e.c != containerArrayStart { +// e.w.writen1(',') +// } +// if e.d { +// e.writeIndent() +// } +// case containerArrayEnd: +// if e.d { +// e.dl-- +// if e.c != containerArrayStart { +// e.writeIndent() +// } +// } +// e.w.writen1(']') +// } +// e.c = c +// } + +func (e *jsonEncDriver) 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 b { - e.w.writeb(jsonLiterals[jsonLitTrueQ : jsonLitTrueQ+6]) + if x := len(e.ds) * int(e.dl); x <= jsonSpacesOrTabsLen { + if e.dt { + e.w.writestr(jsonTabs[:x]) } else { - e.w.writeb(jsonLiterals[jsonLitFalseQ : jsonLitFalseQ+7]) + e.w.writestr(jsonSpaces[:x]) } } else { - if b { - e.w.writeb(jsonLiterals[jsonLitTrue : jsonLitTrue+4]) - } else { - e.w.writeb(jsonLiterals[jsonLitFalse : jsonLitFalse+5]) + for i := uint16(0); i < e.dl; i++ { + e.w.writestr(e.ds) } } } -func (e *jsonEncDriverGeneric) EncodeFloat64(f float64) { - // instead of using 'g', specify whether to use 'e' or 'f' - fmt, prec := jsonFloatStrconvFmtPrec(f) - - var blen int - if e.ks && e.c == containerMapKey { - blen = 2 + len(strconv.AppendFloat(e.b[1:1], f, fmt, prec, 64)) - e.b[0] = '"' - e.b[blen-1] = '"' - } else { - blen = len(strconv.AppendFloat(e.b[:0], f, fmt, prec, 64)) - } - e.w.writeb(e.b[:blen]) +func (e *jsonEncDriver) EncodeNil() { + e.w.writen4('n', 'u', 'l', 'l') // e.w.writeb(jsonLiterals[9:13]) // null } -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) { - blen := 2 + len(strconv.AppendInt(e.b[1:1], v, 10)) - e.b[0] = '"' - e.b[blen-1] = '"' - e.w.writeb(e.b[:blen]) +func (e *jsonEncDriver) EncodeBool(b bool) { + if b { + e.w.writen4('t', 'r', 'u', 'e') // e.w.writeb(jsonLiterals[0:4]) // true + } else { + e.w.writen5('f', 'a', 'l', 's', 'e') // e.w.writeb(jsonLiterals[4:9]) // false + } +} + +func (e *jsonEncDriver) EncodeFloat32(f float32) { + e.encodeFloat(float64(f), 32) +} + +func (e *jsonEncDriver) EncodeFloat64(f float64) { + e.encodeFloat(f, 64) +} + +func (e *jsonEncDriver) encodeFloat(f float64, numbits int) { + x := strconv.AppendFloat(e.b[:0], f, 'G', -1, numbits) + // if bytes.IndexByte(x, 'E') == -1 && bytes.IndexByte(x, '.') == -1 { + if !jsonIsFloatBytesB2(x) { + x = append(x, '.', '0') + } + e.w.writeb(x) +} + +func (e *jsonEncDriver) EncodeInt(v int64) { + if x := e.h.IntegerAsString; x == 'A' || x == 'L' && (v > 1<<53 || v < -(1<<53)) { + e.w.writen1('"') + e.w.writeb(strconv.AppendInt(e.b[:0], v, 10)) + e.w.writen1('"') return } e.w.writeb(strconv.AppendInt(e.b[:0], v, 10)) } -func (e *jsonEncDriverGeneric) EncodeUint(v uint64) { - x := e.is - if x == 'A' || x == 'L' && v > 1<<53 || (e.ks && e.c == containerMapKey) { - blen := 2 + len(strconv.AppendUint(e.b[1:1], v, 10)) - e.b[0] = '"' - e.b[blen-1] = '"' - e.w.writeb(e.b[:blen]) +func (e *jsonEncDriver) EncodeUint(v uint64) { + if x := e.h.IntegerAsString; x == 'A' || x == 'L' && v > 1<<53 { + e.w.writen1('"') + e.w.writeb(strconv.AppendUint(e.b[:0], v, 10)) + e.w.writen1('"') return } 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) atEndOfEncode() { - if e.tw { - if e.d { - e.w.writen1('\n') - } else { - e.w.writen1(' ') - } - } -} - -// -------------------- - -type jsonEncDriver struct { - noBuiltInTypes - e *Encoder - h *JsonHandle - ew encWriter // encWriter // *encWriterSwitch - se extWrapper - // ---- cpu cache line boundary? - bs []byte // scratch - // ---- cpu cache line boundary? - b [jsonScratchArrayLen]byte // scratch (encode time, -} - -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]) - - // if e.h.MapKeyAsString && e.c == containerMapKey { - // e.ew.writeb(jsonLiterals[jsonLitNullQ : jsonLitNullQ+6]) - // } else { - // e.ew.writeb(jsonLiterals[jsonLitNull : jsonLitNull+4]) - // } -} - -func (e *jsonEncDriver) EncodeTime(t time.Time) { - // Do NOT use MarshalJSON, as it allocates internally. - // instead, we call AppendFormat directly, using our scratch buffer (e.b) - if t.IsZero() { - e.EncodeNil() - } else { - 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]) - } - // v, err := t.MarshalJSON(); if err != nil { e.e.error(err) } e.ew.writeb(v) -} - func (e *jsonEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Encoder) { if v := ext.ConvertExt(rv); v == nil { - e.EncodeNil() + e.w.writen4('n', 'u', 'l', 'l') // e.w.writeb(jsonLiterals[9:13]) // null // e.EncodeNil() } else { en.encode(v) } @@ -453,7 +348,7 @@ func (e *jsonEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Enco func (e *jsonEncDriver) EncodeRawExt(re *RawExt, en *Encoder) { // only encodes re.Value (never re.Data) if re.Value == nil { - e.EncodeNil() + e.w.writen4('n', 'u', 'l', 'l') // e.w.writeb(jsonLiterals[9:13]) // null // e.EncodeNil() } else { en.encode(re.Value) } @@ -463,42 +358,40 @@ func (e *jsonEncDriver) EncodeString(c charEncoding, v string) { e.quoteStr(v) } +func (e *jsonEncDriver) EncodeSymbol(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() + if c == c_RAW && e.se.i != nil { + e.EncodeExt(v, 0, &e.se, e.e) return } - if c == cRAW { - if e.se.InterfaceExt != nil { - e.EncodeExt(v, 0, &e.se, e.e) - return - } - + if c == c_RAW { slen := base64.StdEncoding.EncodedLen(len(v)) - if cap(e.bs) >= slen+2 { - e.bs = e.bs[:slen+2] + if cap(e.bs) >= slen { + e.bs = e.bs[:slen] } else { - e.bs = make([]byte, slen+2) + e.bs = make([]byte, slen) } - e.bs[0] = '"' - base64.StdEncoding.Encode(e.bs[1:], v) - e.bs[slen+1] = '"' - e.ew.writeb(e.bs) + base64.StdEncoding.Encode(e.bs, v) + e.w.writen1('"') + e.w.writeb(e.bs) + e.w.writen1('"') } else { e.quoteStr(stringView(v)) } } 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; { @@ -506,8 +399,7 @@ func (e *jsonEncDriver) quoteStr(s string) { // also encode < > & to prevent security holes when served to some browsers. 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)) { + if jsonCharHtmlSafeSet.isset(b) || (e.h.HTMLCharsAsIs && jsonCharSafeSet.isset(b)) { i++ continue } @@ -565,33 +457,42 @@ func (e *jsonEncDriver) quoteStr(s string) { w.writen1('"') } +func (e *jsonEncDriver) atEndOfEncode() { + if e.h.TermWhitespace { + if e.d { + e.w.writen1('\n') + } else { + e.w.writen1(' ') + } + } +} + type jsonDecDriver struct { noBuiltInTypes - d *Decoder - h *JsonHandle - r decReader // *decReaderSwitch // decReader - se extWrapper - - // ---- writable fields during execution --- *try* to keep in sep cache line + d *Decoder + h *JsonHandle + r decReader 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 + tok uint8 + + fnull bool // found null from appendStringAsBytes + + bstr [8]byte // scratch used for string \UXXX parsing + b [64]byte // scratch, used for parsing strings or numbers + b2 [64]byte // scratch, used only for decodeBytes (after base64) + bs []byte // scratch. Initialized from b. Used for parsing strings or numbers. + + se setExtWrapper - _ [3]uint64 // padding // n jsonNum } -// func jsonIsWS(b byte) bool { -// // return b == ' ' || b == '\t' || b == '\r' || b == '\n' -// return jsonCharWhitespaceSet.isset(b) -// } +func jsonIsWS(b byte) bool { + // return b == ' ' || b == '\t' || b == '\r' || b == '\n' + return jsonCharWhitespaceSet.isset(b) +} func (d *jsonDecDriver) uncacheRead() { if d.tok != 0 { @@ -604,9 +505,8 @@ func (d *jsonDecDriver) ReadMapStart() int { if d.tok == 0 { d.tok = d.r.skip(&jsonCharWhitespaceSet) } - const xc uint8 = '{' - if d.tok != xc { - d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) + if d.tok != '{' { + d.d.errorf("json: expect char '%c' but got char '%c'", '{', d.tok) } d.tok = 0 d.c = containerMapStart @@ -617,9 +517,8 @@ func (d *jsonDecDriver) ReadArrayStart() int { if d.tok == 0 { d.tok = d.r.skip(&jsonCharWhitespaceSet) } - const xc uint8 = '[' - if d.tok != xc { - d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) + if d.tok != '[' { + d.d.errorf("json: expect char '%c' but got char '%c'", '[', d.tok) } d.tok = 0 d.c = containerArrayStart @@ -633,23 +532,14 @@ func (d *jsonDecDriver) CheckBreak() bool { return d.tok == '}' || d.tok == ']' } -// 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) -// -// However, until mid-stack inlining (go 1.10?) comes, supporting inlining of -// oneliners, we explicitly write them all 5 out to elide the extra func call. -// TODO: For Go 1.10, if inlined, consider consolidating these. - func (d *jsonDecDriver) ReadArrayElem() { - const xc uint8 = ',' if d.tok == 0 { d.tok = d.r.skip(&jsonCharWhitespaceSet) } if d.c != containerArrayStart { + const xc uint8 = ',' if d.tok != xc { - d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) + d.d.errorf("json: expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 } @@ -657,25 +547,25 @@ func (d *jsonDecDriver) ReadArrayElem() { } func (d *jsonDecDriver) ReadArrayEnd() { - const xc uint8 = ']' if d.tok == 0 { d.tok = d.r.skip(&jsonCharWhitespaceSet) } + const xc uint8 = ']' if d.tok != xc { - d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) + d.d.errorf("json: expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 d.c = containerArrayEnd } func (d *jsonDecDriver) ReadMapElemKey() { - const xc uint8 = ',' if d.tok == 0 { d.tok = d.r.skip(&jsonCharWhitespaceSet) } if d.c != containerMapStart { + const xc uint8 = ',' if d.tok != xc { - d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) + d.d.errorf("json: expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 } @@ -683,34 +573,95 @@ func (d *jsonDecDriver) ReadMapElemKey() { } func (d *jsonDecDriver) ReadMapElemValue() { - const xc uint8 = ':' if d.tok == 0 { d.tok = d.r.skip(&jsonCharWhitespaceSet) } + const xc uint8 = ':' if d.tok != xc { - d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) + d.d.errorf("json: expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 d.c = containerMapValue } func (d *jsonDecDriver) ReadMapEnd() { - const xc uint8 = '}' if d.tok == 0 { d.tok = d.r.skip(&jsonCharWhitespaceSet) } + const xc uint8 = '}' if d.tok != xc { - d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) + d.d.errorf("json: expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 d.c = containerMapEnd } -func (d *jsonDecDriver) readLit(length, fromIdx uint8) { - bs := d.r.readx(int(length)) +// func (d *jsonDecDriver) readContainerState(c containerState, xc uint8, check bool) { +// if d.tok == 0 { +// d.tok = d.r.skip(&jsonCharWhitespaceSet) +// } +// if check { +// if d.tok != xc { +// d.d.errorf("json: expect char '%c' but got char '%c'", xc, d.tok) +// } +// d.tok = 0 +// } +// d.c = c +// } + +// func (d *jsonDecDriver) sendContainerState(c containerState) { +// if d.tok == 0 { +// d.tok = d.r.skip(&jsonCharWhitespaceSet) +// } +// var xc uint8 // char expected +// switch c { +// case containerMapKey: +// if d.c != containerMapStart { +// xc = ',' +// } +// case containerMapValue: +// xc = ':' +// case containerMapEnd: +// xc = '}' +// case containerArrayElem: +// if d.c != containerArrayStart { +// xc = ',' +// } +// case containerArrayEnd: +// xc = ']' +// } +// if xc != 0 { +// if d.tok != xc { +// d.d.errorf("json: expect char '%c' but got char '%c'", xc, d.tok) +// } +// d.tok = 0 +// } +// d.c = c +// } + +// func (d *jsonDecDriver) readLiteralIdx(fromIdx, toIdx uint8) { +// bs := d.r.readx(int(toIdx - fromIdx)) +// d.tok = 0 +// if jsonValidateSymbols && !bytes.Equal(bs, jsonLiterals[fromIdx:toIdx]) { +// d.d.errorf("json: expecting %s: got %s", jsonLiterals[fromIdx:toIdx], bs) +// return +// } +// } + +func (d *jsonDecDriver) readSymbol3(v1, v2, v3 uint8) { + b1, b2, b3 := d.r.readn3() d.tok = 0 - if jsonValidateSymbols && !bytes.Equal(bs, jsonLiterals[fromIdx:fromIdx+length]) { - d.d.errorf("expecting %s: got %s", jsonLiterals[fromIdx:fromIdx+length], bs) + if jsonValidateSymbols && (b1 != v1 || b2 != v2 || b3 != v3) { + d.d.errorf("json: expecting %c, %c, %c: got %c, %c, %c", b1, b2, b3, v1, v2, v3) + return + } +} + +func (d *jsonDecDriver) readSymbol4(v1, v2, v3, v4 uint8) { + b1, b2, b3, b4 := d.r.readn4() + d.tok = 0 + if jsonValidateSymbols && (b1 != v1 || b2 != v2 || b3 != v3 || b4 != v4) { + d.d.errorf("json: expecting %c, %c, %c, %c: got %c, %c, %c, %c", b1, b2, b3, b4, v1, v2, v3, v4) return } } @@ -719,51 +670,27 @@ func (d *jsonDecDriver) TryDecodeAsNil() bool { if d.tok == 0 { d.tok = d.r.skip(&jsonCharWhitespaceSet) } - // we shouldn't try to see if "null" was here, right? - // only the plain string: `null` denotes a nil (ie not quotes) if d.tok == 'n' { - d.readLit(3, jsonLitNull+1) // (n)ull + d.readSymbol3('u', 'l', 'l') // d.readLiteralIdx(10, 13) // ull return true } return false } -func (d *jsonDecDriver) DecodeBool() (v bool) { +func (d *jsonDecDriver) DecodeBool() bool { if d.tok == 0 { d.tok = d.r.skip(&jsonCharWhitespaceSet) } - fquot := d.c == containerMapKey && d.tok == '"' - if fquot { - d.tok = d.r.readn1() + if d.tok == 'f' { + d.readSymbol4('a', 'l', 's', 'e') // d.readLiteralIdx(5, 9) // alse + return false } - switch d.tok { - case 'f': - d.readLit(4, jsonLitFalse+1) // (f)alse - // v = false - case 't': - d.readLit(3, jsonLitTrue+1) // (t)rue - v = true - default: - d.d.errorf("decode bool: got first char %c", d.tok) - // v = false // "unreachable" + if d.tok == 't' { + d.readSymbol3('r', 'u', 'e') // d.readLiteralIdx(1, 4) // rue + return true } - if fquot { - d.r.readn1() - } - return -} - -func (d *jsonDecDriver) DecodeTime() (t time.Time) { - // read string, and pass the string into json.unmarshal - d.appendStringAsBytes() - if d.fnull { - return - } - t, err := time.Parse(time.RFC3339, stringView(d.bs)) - if err != nil { - d.d.errorv(err) - } - return + d.d.errorf("json: decode bool: got first char %c", d.tok) + return false // "unreachable" } func (d *jsonDecDriver) ContainerType() (vt valueType) { @@ -771,12 +698,6 @@ func (d *jsonDecDriver) ContainerType() (vt valueType) { if d.tok == 0 { d.tok = d.r.skip(&jsonCharWhitespaceSet) } - - // optimize this, so we don't do 4 checks but do one computation. - // return jsonContainerSet[d.tok] - - // ContainerType is mostly called for Map and Array, - // so this conditional is good enough (max 2 checks typically) if b := d.tok; b == '{' { return valueTypeMap } else if b == '[' { @@ -787,6 +708,8 @@ func (d *jsonDecDriver) ContainerType() (vt valueType) { return valueTypeString } return valueTypeUnset + // d.d.errorf("isContainerType: unsupported parameter: %v", vt) + // return false // "unreachable" } func (d *jsonDecDriver) decNumBytes() (bs []byte) { @@ -805,69 +728,36 @@ func (d *jsonDecDriver) decNumBytes() (bs []byte) { return bs } -func (d *jsonDecDriver) DecodeUint64() (u uint64) { +func (d *jsonDecDriver) DecodeUint(bitsize uint8) (u uint64) { bs := d.decNumBytes() - n, neg, badsyntax, overflow := jsonParseInteger(bs) - if overflow { - d.d.errorf("overflow parsing unsigned integer: %s", bs) - } else if neg { - d.d.errorf("minus found parsing unsigned integer: %s", bs) - } else if badsyntax { - // fallback: try to decode as float, and cast - n = d.decUint64ViaFloat(stringView(bs)) - } - return n -} - -func (d *jsonDecDriver) DecodeInt64() (i int64) { - const cutoff = uint64(1 << uint(64-1)) - bs := d.decNumBytes() - n, neg, badsyntax, overflow := jsonParseInteger(bs) - if overflow { - d.d.errorf("overflow parsing integer: %s", bs) - } else if badsyntax { - // d.d.errorf("invalid syntax for integer: %s", bs) - // fallback: try to decode as float, and cast - if neg { - n = d.decUint64ViaFloat(stringView(bs[1:])) - } else { - n = d.decUint64ViaFloat(stringView(bs)) - } - } - if neg { - if n > cutoff { - d.d.errorf("overflow parsing integer: %s", bs) - } - i = -(int64(n)) - } else { - if n >= cutoff { - d.d.errorf("overflow parsing integer: %s", bs) - } - i = int64(n) + u, err := strconv.ParseUint(stringView(bs), 10, int(bitsize)) + if err != nil { + d.d.errorf("json: decode uint from %s: %v", bs, err) + return } return } -func (d *jsonDecDriver) decUint64ViaFloat(s string) (u uint64) { - f, err := strconv.ParseFloat(s, 64) +func (d *jsonDecDriver) DecodeInt(bitsize uint8) (i int64) { + bs := d.decNumBytes() + i, err := strconv.ParseInt(stringView(bs), 10, int(bitsize)) if err != nil { - d.d.errorf("invalid syntax for integer: %s", s) - // d.d.errorv(err) + d.d.errorf("json: decode int from %s: %v", bs, err) + return } - fi, ff := math.Modf(f) - if ff > 0 { - d.d.errorf("fractional part found parsing integer: %s", s) - } else if fi > float64(math.MaxUint64) { - d.d.errorf("overflow parsing integer: %s", s) - } - return uint64(fi) + return } -func (d *jsonDecDriver) DecodeFloat64() (f float64) { +func (d *jsonDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { bs := d.decNumBytes() - f, err := strconv.ParseFloat(stringView(bs), 64) + bitsize := 64 + if chkOverflow32 { + bitsize = 32 + } + f, err := strconv.ParseFloat(stringView(bs), bitsize) if err != nil { - d.d.errorv(err) + d.d.errorf("json: decode float from %s: %v", bs, err) + return } return } @@ -887,19 +777,11 @@ func (d *jsonDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxta func (d *jsonDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { // if decoding into raw bytes, and the RawBytesExt is configured, use it to decode. - if d.se.InterfaceExt != nil { + if d.se.i != nil { bsOut = bs d.DecodeExt(&bsOut, 0, &d.se) return } - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) - } - // check if an "array" of uint8's (see ContainerType for how to infer if an array) - if d.tok == '[' { - bsOut, _ = fastpathTV.DecSliceUint8V(bs, true, d.d) - return - } d.appendStringAsBytes() // base64 encodes []byte{} as "", and we encode nil []byte as null. // Consequently, base64 should decode null as a nil []byte, and "" as an empty []byte{}. @@ -922,7 +804,7 @@ func (d *jsonDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { } slen2, err := base64.StdEncoding.Decode(bsOut, bs0) if err != nil { - d.d.errorf("error decoding base64 binary '%s': %v", bs0, err) + d.d.errorf("json: error decoding base64 binary '%s': %v", bs0, err) return nil } if slen != slen2 { @@ -931,9 +813,15 @@ func (d *jsonDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { return } +const jsonAlwaysReturnInternString = false + func (d *jsonDecDriver) DecodeString() (s string) { d.appendStringAsBytes() - return d.bsToString() + // if x := d.s.sc; x != nil && x.so && x.st == '}' { // map key + if jsonAlwaysReturnInternString || d.c == containerMapKey { + return d.d.string(d.bs) + } + return string(d.bs) } func (d *jsonDecDriver) DecodeStringAsBytes() (s []byte) { @@ -948,29 +836,25 @@ func (d *jsonDecDriver) appendStringAsBytes() { d.fnull = false if d.tok != '"' { - // d.d.errorf("expect char '%c' but got char '%c'", '"', d.tok) + // d.d.errorf("json: expect char '%c' but got char '%c'", '"', d.tok) // handle non-string scalar: null, true, false or a number switch d.tok { case 'n': - d.readLit(3, jsonLitNull+1) // (n)ull + d.readSymbol3('u', 'l', 'l') // d.readLiteralIdx(10, 13) // ull d.bs = d.bs[:0] d.fnull = true case 'f': - d.readLit(4, jsonLitFalse+1) // (f)alse + d.readSymbol4('a', 'l', 's', 'e') // d.readLiteralIdx(5, 9) // alse d.bs = d.bs[:5] copy(d.bs, "false") case 't': - d.readLit(3, jsonLitTrue+1) // (t)rue + d.readSymbol3('r', 'u', 'e') // d.readLiteralIdx(1, 4) // rue d.bs = d.bs[:4] copy(d.bs, "true") default: // try to parse a valid number bs := d.decNumBytes() - if len(bs) <= cap(d.bs) { - d.bs = d.bs[:len(bs)] - } else { - d.bs = make([]byte, len(bs)) - } + d.bs = d.bs[:len(bs)] copy(d.bs, bs) } return @@ -1023,59 +907,38 @@ func (d *jsonDecDriver) appendStringAsBytes() { case 'u': var r rune var rr uint32 - if len(cs) < i+4 { // may help reduce bounds-checking - d.d.errorf("need at least 4 more bytes for unicode sequence") - } - // c = cs[i+4] // may help reduce bounds-checking + c = cs[i+4] // may help reduce bounds-checking for j := 1; j < 5; j++ { - // best to use explicit if-else - // - not a table, etc which involve memory loads, array lookup with bounds checks, etc - c = cs[i+j] - if c >= '0' && c <= '9' { - rr = rr*16 + uint32(c-jsonU4Chk2) - } else if c >= 'a' && c <= 'f' { - rr = rr*16 + uint32(c-jsonU4Chk1) - } else if c >= 'A' && c <= 'F' { - rr = rr*16 + uint32(c-jsonU4Chk0) - } else { - r = unicode.ReplacementChar - i += 4 - goto encode_rune + c = jsonU4Set[cs[i+j]] + if c == jsonU4SetErrVal { + d.d.errorf(`json: unquoteStr: invalid hex char in \u unicode sequence: %q`, c) } + rr = rr*16 + uint32(c) } r = rune(rr) i += 4 if utf16.IsSurrogate(r) { - if len(cs) >= i+6 && cs[i+2] == 'u' && cs[i+1] == '\\' { - i += 2 - // c = cs[i+4] // may help reduce bounds-checking - var rr1 uint32 - for j := 1; j < 5; j++ { - c = cs[i+j] - if c >= '0' && c <= '9' { - rr = rr*16 + uint32(c-jsonU4Chk2) - } else if c >= 'a' && c <= 'f' { - rr = rr*16 + uint32(c-jsonU4Chk1) - } else if c >= 'A' && c <= 'F' { - rr = rr*16 + uint32(c-jsonU4Chk0) - } else { - r = unicode.ReplacementChar - i += 4 - goto encode_rune - } - } - r = utf16.DecodeRune(r, rune(rr1)) - i += 4 - } else { - r = unicode.ReplacementChar - goto encode_rune + if !(cs[i+2] == 'u' && cs[i+i] == '\\') { + d.d.errorf(`json: unquoteStr: invalid unicode sequence. Expecting \u`) + return } + i += 2 + c = cs[i+4] // may help reduce bounds-checking + var rr1 uint32 + for j := 1; j < 5; j++ { + c = jsonU4Set[cs[i+j]] + if c == jsonU4SetErrVal { + d.d.errorf(`json: unquoteStr: invalid hex char in \u unicode sequence: %q`, c) + } + rr1 = rr1*16 + uint32(c) + } + r = utf16.DecodeRune(r, rune(rr1)) + i += 4 } - encode_rune: w2 := utf8.EncodeRune(d.bstr[:], r) v = append(v, d.bstr[:w2]...) default: - d.d.errorf("unsupported escaped value: %c", c) + d.d.errorf("json: unsupported escaped value: %c", c) } i++ cursor = i @@ -1083,48 +946,24 @@ func (d *jsonDecDriver) appendStringAsBytes() { d.bs = v } -func (d *jsonDecDriver) nakedNum(z *decNaked, bs []byte) (err error) { - const cutoff = uint64(1 << uint(64-1)) - var n uint64 - var neg, badsyntax, overflow bool - - if d.h.PreferFloat { - goto F - } - n, neg, badsyntax, overflow = jsonParseInteger(bs) - if badsyntax || overflow { - goto F - } - if neg { - if n > cutoff { - goto F - } - z.v = valueTypeInt - z.i = -(int64(n)) - } else if d.h.SignedInteger { - if n >= cutoff { - goto F - } - z.v = valueTypeInt - z.i = int64(n) - } else { - z.v = valueTypeUint - z.u = n - } - return -F: - z.v = valueTypeFloat - z.f, err = strconv.ParseFloat(stringView(bs), 64) - return -} - -func (d *jsonDecDriver) bsToString() string { - // if x := d.s.sc; x != nil && x.so && x.st == '}' { // map key - if jsonAlwaysReturnInternString || d.c == containerMapKey { - return d.d.string(d.bs) - } - return string(d.bs) -} +// func (d *jsonDecDriver) jsonU4Arr(bs [4]byte) (r rune) { +// // u, _ := strconv.ParseUint(string(d.bstr[:4]), 16, 64) +// var u uint32 +// for _, v := range bs { +// if '0' <= v && v <= '9' { +// v = v - '0' +// } else if 'a' <= v && v <= 'f' { +// v = v - 'a' + 10 +// } else if 'A' <= v && v <= 'f' { +// v = v - 'A' + 10 +// } else { +// // d.d.errorf(`json: unquoteStr: invalid hex char in \u unicode sequence: %q`, v) +// return utf8.RuneError +// } +// u = u*16 + uint32(v) +// } +// return rune(u) +// } func (d *jsonDecDriver) DecodeNaked() { z := d.d.n @@ -1135,14 +974,14 @@ func (d *jsonDecDriver) DecodeNaked() { } switch d.tok { case 'n': - d.readLit(3, jsonLitNull+1) // (n)ull + d.readSymbol3('u', 'l', 'l') // d.readLiteralIdx(10, 13) // ull z.v = valueTypeNil case 'f': - d.readLit(4, jsonLitFalse+1) // (f)alse + d.readSymbol4('a', 'l', 's', 'e') // d.readLiteralIdx(5, 9) // alse z.v = valueTypeBool z.b = false case 't': - d.readLit(3, jsonLitTrue+1) // (t)rue + d.readSymbol3('r', 'u', 'e') // d.readLiteralIdx(1, 4) // rue z.v = valueTypeBool z.b = true case '{': @@ -1150,38 +989,36 @@ func (d *jsonDecDriver) DecodeNaked() { case '[': z.v = valueTypeArray // don't consume. kInterfaceNaked will call ReadArrayStart 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 { - switch stringView(d.bs) { - case "null": - z.v = valueTypeNil - case "true": - z.v = valueTypeBool - z.b = true - case "false": - z.v = valueTypeBool - z.b = false - default: - // check if a number: float, int or uint - if err := d.nakedNum(z, d.bs); err != nil { - z.v = valueTypeString - z.s = d.bsToString() - } - } - } else { - z.v = valueTypeString - z.s = d.bsToString() - } + z.v = valueTypeString + z.s = d.DecodeString() default: // number bs := d.decNumBytes() + var err error if len(bs) == 0 { - d.d.errorf("decode number from empty string") + d.d.errorf("json: decode number from empty string") return + } else if d.h.PreferFloat || jsonIsFloatBytesB3(bs) { // bytes.IndexByte(bs, '.') != -1 ||... + // } else if d.h.PreferFloat || bytes.ContainsAny(bs, ".eE") { + z.v = valueTypeFloat + z.f, err = strconv.ParseFloat(stringView(bs), 64) + } else if d.h.SignedInteger || bs[0] == '-' { + z.v = valueTypeInt + z.i, err = strconv.ParseInt(stringView(bs), 10, 64) + } else { + z.v = valueTypeUint + z.u, err = strconv.ParseUint(stringView(bs), 10, 64) } - if err := d.nakedNum(z, bs); err != nil { - d.d.errorf("decode number from %s: %v", bs, err) - return + if err != nil { + if z.v == valueTypeInt || z.v == valueTypeUint { + if v, ok := err.(*strconv.NumError); ok && (v.Err == strconv.ErrRange || v.Err == strconv.ErrSyntax) { + z.v = valueTypeFloat + z.f, err = strconv.ParseFloat(stringView(bs), 64) + } + } + if err != nil { + d.d.errorf("json: decode number from %s: %v", bs, err) + return + } } } // if decodeFurther { @@ -1196,27 +1033,26 @@ func (d *jsonDecDriver) DecodeNaked() { // // Json is comprehensively supported: // - decodes numbers into interface{} as int, uint or float64 -// based on how the number looks and some config parameters e.g. PreferFloat, SignedInt, etc. -// - decode integers from float formatted numbers e.g. 1.27e+8 -// - decode any json value (numbers, bool, etc) from quoted strings // - configurable way to encode/decode []byte . // by default, encodes and decodes []byte using base64 Std Encoding // - UTF-8 support for encoding and decoding // // It has better performance than the json library in the standard library, -// by leveraging the performance improvements of the codec library. +// by leveraging the performance improvements of the codec library and +// minimizing allocations. // // In addition, it doesn't read more bytes than necessary during a decode, which allows // reading multiple values from a stream containing json and non-json content. // For example, a user can read a json value, then a cbor value, then a msgpack value, // all from the same stream in sequence. -// -// Note that, when decoding quoted strings, invalid UTF-8 or invalid UTF-16 surrogate pairs are -// not treated as an error. Instead, they are replaced by the Unicode replacement character U+FFFD. type JsonHandle struct { textEncodingType BasicHandle + // 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 + // Indent indicates how a value is encoded. // - If positive, indent by that number of spaces. // - If negative, indent by that number of tabs. @@ -1233,7 +1069,7 @@ type JsonHandle struct { // - if 'A', then encode all integers as a json string // containing the exact integer representation as a decimal. // - else encode all integers as a json number (default) - IntegerAsString byte + IntegerAsString uint8 // HTMLCharsAsIs controls how to encode some special characters to html: < > & // @@ -1252,103 +1088,52 @@ type JsonHandle struct { // The whitespace is important, especially if using numbers in a context // where multiple items are written to a stream. TermWhitespace bool - - // MapKeyAsString says to encode all map keys as strings. - // - // Use this to enforce strict json output. - // The only caveat is that nil value is ALWAYS written as null (never as "null") - MapKeyAsString bool - - // _ [2]byte // padding - - // Note: below, we store hardly-used items e.g. RawBytesExt is 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 - - _ [3]uint64 // padding } -// Name returns the name of the handle: json -func (h *JsonHandle) Name() string { return "json" } func (h *JsonHandle) hasElemSeparators() bool { return true } -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) - 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}) + return h.SetExt(rt, tag, &setExtWrapper{i: ext}) } -type jsonEncDriverTypicalImpl struct { - jsonEncDriver - jsonEncDriverTypical - _ [1]uint64 // padding -} +func (h *JsonHandle) newEncDriver(e *Encoder) encDriver { + hd := jsonEncDriver{e: e, h: h} + hd.bs = hd.b[:0] -func (x *jsonEncDriverTypicalImpl) reset() { - x.jsonEncDriver.reset() - x.jsonEncDriverTypical.reset(&x.jsonEncDriver) -} + hd.reset() -type jsonEncDriverGenericImpl struct { - jsonEncDriver - jsonEncDriverGeneric -} - -func (x *jsonEncDriverGenericImpl) reset() { - x.jsonEncDriver.reset() - x.jsonEncDriverGeneric.reset(&x.jsonEncDriver) -} - -func (h *JsonHandle) newEncDriver(e *Encoder) (ee encDriver) { - var hd *jsonEncDriver - if h.typical() { - var v jsonEncDriverTypicalImpl - ee = &v - hd = &v.jsonEncDriver - } else { - var v jsonEncDriverGenericImpl - ee = &v - hd = &v.jsonEncDriver - } - hd.e, hd.h, hd.bs = e, h, hd.b[:0] - hd.se.BytesExt = bytesExtFailer{} - ee.reset() - return + return &hd } 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.e.w // &e.e.encWriterSwitch - e.se.InterfaceExt = e.h.RawBytesExt + e.w = e.e.w + e.se.i = e.h.RawBytesExt if e.bs != nil { e.bs = e.bs[:0] } + e.d, e.dt, e.dl, e.ds = false, false, 0, "" + e.c = 0 + if e.h.Indent > 0 { + e.d = true + e.ds = jsonSpaces[:e.h.Indent] + } else if e.h.Indent < 0 { + e.d = true + e.dt = true + e.ds = jsonTabs[:-(e.h.Indent)] + } } func (d *jsonDecDriver) reset() { - d.r = d.d.r // &d.d.decReaderSwitch // d.d.r - d.se.InterfaceExt = d.h.RawBytesExt + d.r = d.d.r + d.se.i = d.h.RawBytesExt if d.bs != nil { d.bs = d.bs[:0] } @@ -1356,67 +1141,32 @@ func (d *jsonDecDriver) reset() { // d.n.reset() } -func jsonFloatStrconvFmtPrec(f float64) (fmt byte, prec int) { - prec = -1 - var abs = math.Abs(f) - if abs != 0 && (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 - } - } - return +// func jsonIsFloatBytes(bs []byte) bool { +// for _, v := range bs { +// // if v == '.' || v == 'e' || v == 'E' { +// if jsonIsFloatSet.isset(v) { +// return true +// } +// } +// return false +// } + +func jsonIsFloatBytesB2(bs []byte) bool { + return bytes.IndexByte(bs, '.') != -1 || + bytes.IndexByte(bs, 'E') != -1 } -// custom-fitted version of strconv.Parse(Ui|I)nt. -// Also ensures we don't have to search for .eE to determine if a float or not. -func jsonParseInteger(s []byte) (n uint64, neg, badSyntax, overflow bool) { - const maxUint64 = (1<<64 - 1) - const cutoff = maxUint64/10 + 1 - - if len(s) == 0 { - badSyntax = true - return - } - switch s[0] { - case '+': - s = s[1:] - case '-': - s = s[1:] - neg = true - } - for _, c := range s { - if c < '0' || c > '9' { - badSyntax = true - return - } - // unsigned integers don't overflow well on multiplication, so check cutoff here - // e.g. (maxUint64-5)*10 doesn't overflow well ... - if n >= cutoff { - overflow = true - return - } - n *= 10 - n1 := n + uint64(c-'0') - if n1 < n || n1 > maxUint64 { - overflow = true - return - } - n = n1 - } - return +func jsonIsFloatBytesB3(bs []byte) bool { + return bytes.IndexByte(bs, '.') != -1 || + bytes.IndexByte(bs, 'E') != -1 || + bytes.IndexByte(bs, 'e') != -1 } +// var jsonEncodeTerminate = []byte{' '} + +// func (h *JsonHandle) rpcEncodeTerminate() []byte { +// return jsonEncodeTerminate +// } + var _ decDriver = (*jsonDecDriver)(nil) -var _ encDriver = (*jsonEncDriverGenericImpl)(nil) -var _ encDriver = (*jsonEncDriverTypicalImpl)(nil) -var _ jsonTypical = (*jsonEncDriverTypical)(nil) +var _ encDriver = (*jsonEncDriver)(nil) diff --git a/vendor/github.com/ugorji/go/codec/mammoth-test.go.tmpl b/vendor/github.com/ugorji/go/codec/mammoth-test.go.tmpl index 90d758ce..6d716972 100644 --- a/vendor/github.com/ugorji/go/codec/mammoth-test.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/mammoth-test.go.tmpl @@ -1,21 +1,18 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. -// Code generated from mammoth-test.go.tmpl - DO NOT EDIT. +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED from mammoth-test.go.tmpl +// ************************************************************ package codec -import "testing" -import "fmt" -import "reflect" - // TestMammoth has all the different paths optimized in fast-path // It has all the primitives, slices and maps. // // For each of those types, it has a pointer and a non-pointer field. -func init() { _ = fmt.Printf } // so we can include fmt as needed - type TestMammoth struct { {{range .Values }}{{if .Primitive }}{{/* @@ -34,121 +31,3 @@ type TestMammoth struct { {{end}}{{end}}{{end}} } - -{{range .Values }}{{if not .Primitive }}{{if not .MapKey }}{{/* -*/}} type {{ .MethodNamePfx "typMbs" false }} []{{ .Elem }} -func (_ {{ .MethodNamePfx "typMbs" false }}) MapBySlice() { } -{{end}}{{end}}{{end}} - -{{range .Values }}{{if not .Primitive }}{{if .MapKey }}{{/* -*/}} type {{ .MethodNamePfx "typMap" false }} map[{{ .MapKey }}]{{ .Elem }} -{{end}}{{end}}{{end}} - -func doTestMammothSlices(t *testing.T, h Handle) { -{{range $i, $e := .Values }}{{if not .Primitive }}{{if not .MapKey }}{{/* -*/}} - var v{{$i}}va [8]{{ .Elem }} - for _, v := range [][]{{ .Elem }}{ nil, {}, { {{ nonzerocmd .Elem }}, {{ zerocmd .Elem }}, {{ zerocmd .Elem }}, {{ nonzerocmd .Elem }} } } { {{/* - // fmt.Printf(">>>> running mammoth slice v{{$i}}: %v\n", v) - // - encode value to some []byte - // - decode into a length-wise-equal []byte - // - check if equal to initial slice - // - encode ptr to the value - // - check if encode bytes are same - // - decode into ptrs to: nil, then 1-elem slice, equal-length, then large len slice - // - decode into non-addressable slice of equal length, then larger len - // - for each decode, compare elem-by-elem to the original slice - // - - // - rinse and repeat for a MapBySlice version - // - - */}} - var v{{$i}}v1, v{{$i}}v2 []{{ .Elem }} - v{{$i}}v1 = v - bs{{$i}} := testMarshalErr(v{{$i}}v1, h, t, "enc-slice-v{{$i}}") - if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make([]{{ .Elem }}, len(v)) } - testUnmarshalErr(v{{$i}}v2, bs{{$i}}, h, t, "dec-slice-v{{$i}}") - testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}") - if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make([]{{ .Elem }}, len(v)) } - testUnmarshalErr(reflect.ValueOf(v{{$i}}v2), bs{{$i}}, h, t, "dec-slice-v{{$i}}-noaddr") // non-addressable value - testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}-noaddr") - // ... - bs{{$i}} = testMarshalErr(&v{{$i}}v1, h, t, "enc-slice-v{{$i}}-p") - v{{$i}}v2 = nil - testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-slice-v{{$i}}-p") - testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}-p") - v{{$i}}va = [8]{{ .Elem }}{} // clear the array - v{{$i}}v2 = v{{$i}}va[:1:1] - testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-slice-v{{$i}}-p-1") - testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}-p-1") - v{{$i}}va = [8]{{ .Elem }}{} // clear the array - v{{$i}}v2 = v{{$i}}va[:len(v{{$i}}v1):len(v{{$i}}v1)] - testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-slice-v{{$i}}-p-len") - testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}-p-len") - v{{$i}}va = [8]{{ .Elem }}{} // clear the array - v{{$i}}v2 = v{{$i}}va[:] - testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-slice-v{{$i}}-p-cap") - testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}-p-cap") - if len(v{{$i}}v1) > 1 { - v{{$i}}va = [8]{{ .Elem }}{} // clear the array - testUnmarshalErr((&v{{$i}}va)[:len(v{{$i}}v1)], bs{{$i}}, h, t, "dec-slice-v{{$i}}-p-len-noaddr") - testDeepEqualErr(v{{$i}}v1, v{{$i}}va[:len(v{{$i}}v1)], t, "equal-slice-v{{$i}}-p-len-noaddr") - v{{$i}}va = [8]{{ .Elem }}{} // clear the array - testUnmarshalErr((&v{{$i}}va)[:], bs{{$i}}, h, t, "dec-slice-v{{$i}}-p-cap-noaddr") - testDeepEqualErr(v{{$i}}v1, v{{$i}}va[:len(v{{$i}}v1)], t, "equal-slice-v{{$i}}-p-cap-noaddr") - } - // ... - var v{{$i}}v3, v{{$i}}v4 {{ .MethodNamePfx "typMbs" false }} - v{{$i}}v2 = nil - if v != nil { v{{$i}}v2 = make([]{{ .Elem }}, len(v)) } - v{{$i}}v3 = {{ .MethodNamePfx "typMbs" false }}(v{{$i}}v1) - v{{$i}}v4 = {{ .MethodNamePfx "typMbs" false }}(v{{$i}}v2) - bs{{$i}} = testMarshalErr(v{{$i}}v3, h, t, "enc-slice-v{{$i}}-custom") - testUnmarshalErr(v{{$i}}v4, bs{{$i}}, h, t, "dec-slice-v{{$i}}-custom") - testDeepEqualErr(v{{$i}}v3, v{{$i}}v4, t, "equal-slice-v{{$i}}-custom") - bs{{$i}} = testMarshalErr(&v{{$i}}v3, h, t, "enc-slice-v{{$i}}-custom-p") - v{{$i}}v2 = nil - v{{$i}}v4 = {{ .MethodNamePfx "typMbs" false }}(v{{$i}}v2) - testUnmarshalErr(&v{{$i}}v4, bs{{$i}}, h, t, "dec-slice-v{{$i}}-custom-p") - testDeepEqualErr(v{{$i}}v3, v{{$i}}v4, t, "equal-slice-v{{$i}}-custom-p") - } -{{end}}{{end}}{{end}} -} - -func doTestMammothMaps(t *testing.T, h Handle) { -{{range $i, $e := .Values }}{{if not .Primitive }}{{if .MapKey }}{{/* -*/}} - for _, v := range []map[{{ .MapKey }}]{{ .Elem }}{ nil, {}, { {{ nonzerocmd .MapKey }}:{{ zerocmd .Elem }} {{if ne "bool" .MapKey}}, {{ nonzerocmd .MapKey }}:{{ nonzerocmd .Elem }} {{end}} } } { - // fmt.Printf(">>>> running mammoth map v{{$i}}: %v\n", v) - var v{{$i}}v1, v{{$i}}v2 map[{{ .MapKey }}]{{ .Elem }} - v{{$i}}v1 = v - bs{{$i}} := testMarshalErr(v{{$i}}v1, h, t, "enc-map-v{{$i}}") - if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make(map[{{ .MapKey }}]{{ .Elem }}, len(v)) } // reset map - testUnmarshalErr(v{{$i}}v2, bs{{$i}}, h, t, "dec-map-v{{$i}}") - testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-map-v{{$i}}") - if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make(map[{{ .MapKey }}]{{ .Elem }}, len(v)) } // reset map - testUnmarshalErr(reflect.ValueOf(v{{$i}}v2), bs{{$i}}, h, t, "dec-map-v{{$i}}-noaddr") // decode into non-addressable map value - testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-map-v{{$i}}-noaddr") - if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make(map[{{ .MapKey }}]{{ .Elem }}, len(v)) } // reset map - testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-map-v{{$i}}-p-len") - testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-map-v{{$i}}-p-len") - bs{{$i}} = testMarshalErr(&v{{$i}}v1, h, t, "enc-map-v{{$i}}-p") - v{{$i}}v2 = nil - testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-map-v{{$i}}-p-nil") - testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-map-v{{$i}}-p-nil") - // ... - if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make(map[{{ .MapKey }}]{{ .Elem }}, len(v)) } // reset map - var v{{$i}}v3, v{{$i}}v4 {{ .MethodNamePfx "typMap" false }} - v{{$i}}v3 = {{ .MethodNamePfx "typMap" false }}(v{{$i}}v1) - v{{$i}}v4 = {{ .MethodNamePfx "typMap" false }}(v{{$i}}v2) - bs{{$i}} = testMarshalErr(v{{$i}}v3, h, t, "enc-map-v{{$i}}-custom") - testUnmarshalErr(v{{$i}}v4, bs{{$i}}, h, t, "dec-map-v{{$i}}-p-len") - testDeepEqualErr(v{{$i}}v3, v{{$i}}v4, t, "equal-map-v{{$i}}-p-len") - } -{{end}}{{end}}{{end}} - -} - -func doTestMammothMapsAndSlices(t *testing.T, h Handle) { - doTestMammothSlices(t, h) - doTestMammothMaps(t, h) -} diff --git a/vendor/github.com/ugorji/go/codec/mammoth2-test.go.tmpl b/vendor/github.com/ugorji/go/codec/mammoth2-test.go.tmpl deleted file mode 100644 index 7cdf8f5d..00000000 --- a/vendor/github.com/ugorji/go/codec/mammoth2-test.go.tmpl +++ /dev/null @@ -1,94 +0,0 @@ -// +build !notfastpath - -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a MIT license found in the LICENSE file. - -// Code generated from mammoth2-test.go.tmpl - DO NOT EDIT. - -package codec - -// Increase codecoverage by covering all the codecgen paths, in fast-path and gen-helper.go.... -// -// Add: -// - test file for creating a mammoth generated file as _mammoth_generated.go -// - generate a second mammoth files in a different file: mammoth2_generated_test.go -// - mammoth-test.go.tmpl will do this -// - run codecgen on it, into mammoth2_codecgen_generated_test.go (no build tags) -// - as part of TestMammoth, run it also -// - this will cover all the codecgen, gen-helper, etc in one full run -// - check in mammoth* files into github also -// - then -// -// Now, add some types: -// - some that implement BinaryMarshal, TextMarshal, JSONMarshal, and one that implements none of it -// - create a wrapper type that includes TestMammoth2, with it in slices, and maps, and the custom types -// - this wrapper object is what we work encode/decode (so that the codecgen methods are called) - - -// import "encoding/binary" -import "fmt" - -type TestMammoth2 struct { - -{{range .Values }}{{if .Primitive }}{{/* -*/}}{{ .MethodNamePfx "F" true }} {{ .Primitive }} -{{ .MethodNamePfx "Fptr" true }} *{{ .Primitive }} -{{end}}{{end}} - -{{range .Values }}{{if not .Primitive }}{{if not .MapKey }}{{/* -*/}}{{ .MethodNamePfx "F" false }} []{{ .Elem }} -{{ .MethodNamePfx "Fptr" false }} *[]{{ .Elem }} -{{end}}{{end}}{{end}} - -{{range .Values }}{{if not .Primitive }}{{if .MapKey }}{{/* -*/}}{{ .MethodNamePfx "F" false }} map[{{ .MapKey }}]{{ .Elem }} -{{ .MethodNamePfx "Fptr" false }} *map[{{ .MapKey }}]{{ .Elem }} -{{end}}{{end}}{{end}} - -} - -// ----------- - -type testMammoth2Binary uint64 -func (x testMammoth2Binary) MarshalBinary() (data []byte, err error) { -data = make([]byte, 8) -bigen.PutUint64(data, uint64(x)) -return -} -func (x *testMammoth2Binary) UnmarshalBinary(data []byte) (err error) { -*x = testMammoth2Binary(bigen.Uint64(data)) -return -} - -type testMammoth2Text uint64 -func (x testMammoth2Text) MarshalText() (data []byte, err error) { -data = []byte(fmt.Sprintf("%b", uint64(x))) -return -} -func (x *testMammoth2Text) UnmarshalText(data []byte) (err error) { -_, err = fmt.Sscanf(string(data), "%b", (*uint64)(x)) -return -} - -type testMammoth2Json uint64 -func (x testMammoth2Json) MarshalJSON() (data []byte, err error) { -data = []byte(fmt.Sprintf("%v", uint64(x))) -return -} -func (x *testMammoth2Json) UnmarshalJSON(data []byte) (err error) { -_, err = fmt.Sscanf(string(data), "%v", (*uint64)(x)) -return -} - -type testMammoth2Basic [4]uint64 - -type TestMammoth2Wrapper struct { - V TestMammoth2 - T testMammoth2Text - B testMammoth2Binary - J testMammoth2Json - C testMammoth2Basic - M map[testMammoth2Basic]TestMammoth2 - L []TestMammoth2 - A [4]int64 -} diff --git a/vendor/github.com/ugorji/go/codec/msgpack.go b/vendor/github.com/ugorji/go/codec/msgpack.go index 31265cc6..fcc3177a 100644 --- a/vendor/github.com/ugorji/go/codec/msgpack.go +++ b/vendor/github.com/ugorji/go/codec/msgpack.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. /* @@ -15,8 +15,8 @@ For compatibility with behaviour of msgpack-c reference implementation: - Go intX (<0) IS ENCODED AS msgpack -ve fixnum, signed -*/ +*/ package codec import ( @@ -25,7 +25,6 @@ import ( "math" "net/rpc" "reflect" - "time" ) const ( @@ -79,9 +78,6 @@ const ( mpNegFixNumMax = 0xff ) -var mpTimeExtTag int8 = -1 -var mpTimeExtTagU = uint8(mpTimeExtTag) - // MsgpackSpecRpcMultiArgs is a special type which signifies to the MsgpackSpecRpcCodec // that the backend RPC service takes multiple arguments, which have been arranged // in sequence in the slice. @@ -98,18 +94,10 @@ type msgpackContainerType struct { } var ( - msgpackContainerStr = msgpackContainerType{ - 32, mpFixStrMin, mpStr8, mpStr16, mpStr32, true, true, false, - } - msgpackContainerBin = msgpackContainerType{ - 0, 0, mpBin8, mpBin16, mpBin32, false, true, true, - } - msgpackContainerList = msgpackContainerType{ - 16, mpFixArrayMin, 0, mpArray16, mpArray32, true, false, false, - } - msgpackContainerMap = msgpackContainerType{ - 16, mpFixMapMin, 0, mpMap16, mpMap32, true, false, false, - } + msgpackContainerStr = msgpackContainerType{32, mpFixStrMin, mpStr8, mpStr16, mpStr32, true, true, false} + msgpackContainerBin = msgpackContainerType{0, 0, mpBin8, mpBin16, mpBin32, false, true, true} + msgpackContainerList = msgpackContainerType{16, mpFixArrayMin, 0, mpArray16, mpArray32, true, false, false} + msgpackContainerMap = msgpackContainerType{16, mpFixMapMin, 0, mpMap16, mpMap32, true, false, false} ) //--------------------------------------------- @@ -122,7 +110,6 @@ type msgpackEncDriver struct { w encWriter h *MsgpackHandle x [8]byte - _ [3]uint64 // padding } func (e *msgpackEncDriver) EncodeNil() { @@ -130,26 +117,10 @@ func (e *msgpackEncDriver) EncodeNil() { } func (e *msgpackEncDriver) EncodeInt(i int64) { - // if i >= 0 { - // e.EncodeUint(uint64(i)) - // } else if false && - if i > math.MaxInt8 { - if i <= math.MaxInt16 { - e.w.writen1(mpInt16) - bigenHelper{e.x[:2], e.w}.writeUint16(uint16(i)) - } else if i <= math.MaxInt32 { - e.w.writen1(mpInt32) - bigenHelper{e.x[:4], e.w}.writeUint32(uint32(i)) - } else { - e.w.writen1(mpInt64) - bigenHelper{e.x[:8], e.w}.writeUint64(uint64(i)) - } + if i >= 0 { + e.EncodeUint(uint64(i)) } else if i >= -32 { - if e.h.NoFixedNum { - e.w.writen2(mpInt8, byte(i)) - } else { - e.w.writen1(byte(i)) - } + e.w.writen1(byte(i)) } else if i >= math.MinInt8 { e.w.writen2(mpInt8, byte(i)) } else if i >= math.MinInt16 { @@ -166,11 +137,7 @@ func (e *msgpackEncDriver) EncodeInt(i int64) { func (e *msgpackEncDriver) EncodeUint(i uint64) { if i <= math.MaxInt8 { - if e.h.NoFixedNum { - e.w.writen2(mpUint8, byte(i)) - } else { - e.w.writen1(byte(i)) - } + e.w.writen1(byte(i)) } else if i <= math.MaxUint8 { e.w.writen2(mpUint8, byte(i)) } else if i <= math.MaxUint16 { @@ -203,39 +170,6 @@ func (e *msgpackEncDriver) EncodeFloat64(f float64) { bigenHelper{e.x[:8], e.w}.writeUint64(math.Float64bits(f)) } -func (e *msgpackEncDriver) EncodeTime(t time.Time) { - if t.IsZero() { - e.EncodeNil() - return - } - t = t.UTC() - sec, nsec := t.Unix(), uint64(t.Nanosecond()) - var data64 uint64 - var l = 4 - if sec >= 0 && sec>>34 == 0 { - data64 = (nsec << 34) | uint64(sec) - if data64&0xffffffff00000000 != 0 { - l = 8 - } - } else { - l = 12 - } - if e.h.WriteExt { - e.encodeExtPreamble(mpTimeExtTagU, l) - } else { - e.writeContainerLen(msgpackContainerStr, l) - } - switch l { - case 4: - bigenHelper{e.x[:4], e.w}.writeUint32(uint32(data64)) - case 8: - bigenHelper{e.x[:8], e.w}.writeUint64(data64) - case 12: - bigenHelper{e.x[:4], e.w}.writeUint32(uint32(nsec)) - bigenHelper{e.x[:8], e.w}.writeUint64(uint64(sec)) - } -} - func (e *msgpackEncDriver) EncodeExt(v interface{}, xtag uint64, ext Ext, _ *Encoder) { bs := ext.WriteExt(v) if bs == nil { @@ -246,7 +180,7 @@ func (e *msgpackEncDriver) EncodeExt(v interface{}, xtag uint64, ext Ext, _ *Enc e.encodeExtPreamble(uint8(xtag), len(bs)) e.w.writeb(bs) } else { - e.EncodeStringBytes(cRAW, bs) + e.EncodeStringBytes(c_RAW, bs) } } @@ -290,7 +224,7 @@ func (e *msgpackEncDriver) WriteMapStart(length int) { func (e *msgpackEncDriver) EncodeString(c charEncoding, s string) { slen := len(s) - if c == cRAW && e.h.WriteExt { + if c == c_RAW && e.h.WriteExt { e.writeContainerLen(msgpackContainerBin, slen) } else { e.writeContainerLen(msgpackContainerStr, slen) @@ -300,13 +234,13 @@ func (e *msgpackEncDriver) EncodeString(c charEncoding, s string) { } } +func (e *msgpackEncDriver) EncodeSymbol(v string) { + e.EncodeString(c_UTF8, v) +} + func (e *msgpackEncDriver) EncodeStringBytes(c charEncoding, bs []byte) { - if bs == nil { - e.EncodeNil() - return - } slen := len(bs) - if c == cRAW && e.h.WriteExt { + if c == c_RAW && e.h.WriteExt { e.writeContainerLen(msgpackContainerBin, slen) } else { e.writeContainerLen(msgpackContainerStr, slen) @@ -333,10 +267,10 @@ func (e *msgpackEncDriver) writeContainerLen(ct msgpackContainerType, l int) { //--------------------------------------------- type msgpackDecDriver struct { - d *Decoder - r decReader // *Decoder decReader decReaderT - h *MsgpackHandle - // b [scratchByteArrayLen]byte + d *Decoder + r decReader // *Decoder decReader decReaderT + h *MsgpackHandle + b [scratchByteArrayLen]byte bd byte bdRead bool br bool // bytes reader @@ -344,7 +278,6 @@ type msgpackDecDriver struct { // noStreamingCodec // decNoSeparator decDriverNoopContainerReader - _ [3]uint64 // padding } // Note: This returns either a primitive (int, bool, etc) for non-containers, @@ -435,12 +368,7 @@ func (d *msgpackDecDriver) DecodeNaked() { n.v = valueTypeExt clen := d.readExtLen() n.u = uint64(d.r.readn1()) - if n.u == uint64(mpTimeExtTagU) { - n.v = valueTypeTime - n.t = d.decodeTime(clen) - } else { - n.l = d.r.readx(clen) - } + n.l = d.r.readx(clen) default: d.d.errorf("Nil-Deciphered DecodeValue: %s: hex: %x, dec: %d", msgBadDesc, bd, bd) } @@ -456,7 +384,7 @@ func (d *msgpackDecDriver) DecodeNaked() { } // int can be decoded from msgpack type: intXXX or uintXXX -func (d *msgpackDecDriver) DecodeInt64() (i int64) { +func (d *msgpackDecDriver) DecodeInt(bitsize uint8) (i int64) { if !d.bdRead { d.readNextBd() } @@ -488,12 +416,19 @@ func (d *msgpackDecDriver) DecodeInt64() (i int64) { return } } + // check overflow (logic adapted from std pkg reflect/value.go OverflowUint() + if bitsize > 0 { + if trunc := (i << (64 - bitsize)) >> (64 - bitsize); i != trunc { + d.d.errorf("Overflow int value: %v", i) + return + } + } d.bdRead = false return } // uint can be decoded from msgpack type: intXXX or uintXXX -func (d *msgpackDecDriver) DecodeUint64() (ui uint64) { +func (d *msgpackDecDriver) DecodeUint(bitsize uint8) (ui uint64) { if !d.bdRead { d.readNextBd() } @@ -546,12 +481,19 @@ func (d *msgpackDecDriver) DecodeUint64() (ui uint64) { return } } + // check overflow (logic adapted from std pkg reflect/value.go OverflowUint() + if bitsize > 0 { + if trunc := (ui << (64 - bitsize)) >> (64 - bitsize); ui != trunc { + d.d.errorf("Overflow uint value: %v", ui) + return + } + } d.bdRead = false return } // float can either be decoded from msgpack type: float, double or intX -func (d *msgpackDecDriver) DecodeFloat64() (f float64) { +func (d *msgpackDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { if !d.bdRead { d.readNextBd() } @@ -560,7 +502,11 @@ func (d *msgpackDecDriver) DecodeFloat64() (f float64) { } else if d.bd == mpDouble { f = math.Float64frombits(bigen.Uint64(d.r.readx(8))) } else { - f = float64(d.DecodeInt64()) + f = float64(d.DecodeInt(0)) + } + if chkOverflow32 && chkOvf.Float32(f) { + d.d.errorf("msgpack: float32 overflow: %v", f) + return } d.bdRead = false return @@ -588,15 +534,13 @@ func (d *msgpackDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) d.readNextBd() } - // check if an "array" of uint8's (see ContainerType for how to infer if an array) - bd := d.bd // DecodeBytes could be from: bin str fixstr fixarray array ... var clen int vt := d.ContainerType() switch vt { case valueTypeBytes: // valueTypeBytes may be a mpBin or an mpStr container - if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { + if bd := d.bd; bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { clen = d.readContainerLen(msgpackContainerBin) } else { clen = d.readContainerLen(msgpackContainerStr) @@ -604,17 +548,28 @@ func (d *msgpackDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) case valueTypeString: clen = d.readContainerLen(msgpackContainerStr) case valueTypeArray: - if zerocopy && len(bs) == 0 { - bs = d.d.b[:] + clen = d.readContainerLen(msgpackContainerList) + // ensure everything after is one byte each + for i := 0; i < clen; i++ { + d.readNextBd() + if d.bd == mpNil { + bs = append(bs, 0) + } else if d.bd == mpUint8 { + bs = append(bs, d.r.readn1()) + } else { + d.d.errorf("cannot read non-byte into a byte array") + return + } } - bsOut, _ = fastpathTV.DecSliceUint8V(bs, true, d.d) - return + d.bdRead = false + return bs default: - d.d.errorf("invalid container type: expecting bin|str|array, got: 0x%x", uint8(vt)) + d.d.errorf("invalid container type: expecting bin|str|array") return } // these are (bin|str)(8|16|32) + // println("DecodeBytes: clen: ", clen) d.bdRead = false // bytes may be nil, so handle it. if nil, clen=-1. if clen < 0 { @@ -624,18 +579,18 @@ func (d *msgpackDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) if d.br { return d.r.readx(clen) } else if len(bs) == 0 { - bs = d.d.b[:] + bs = d.b[:] } } - return decByteSlice(d.r, clen, d.h.MaxInitLen, bs) + return decByteSlice(d.r, clen, d.d.h.MaxInitLen, bs) } func (d *msgpackDecDriver) DecodeString() (s string) { - return string(d.DecodeBytes(d.d.b[:], true)) + return string(d.DecodeBytes(d.b[:], true)) } func (d *msgpackDecDriver) DecodeStringAsBytes() (s []byte) { - return d.DecodeBytes(d.d.b[:], true) + return d.DecodeBytes(d.b[:], true) } func (d *msgpackDecDriver) readNextBd() { @@ -668,10 +623,9 @@ func (d *msgpackDecDriver) ContainerType() (vt valueType) { return valueTypeArray } else if bd == mpMap16 || bd == mpMap32 || (bd >= mpFixMapMin && bd <= mpFixMapMax) { return valueTypeMap + } else { + // d.d.errorf("isContainerType: unsupported parameter: %v", vt) } - // else { - // d.d.errorf("isContainerType: unsupported parameter: %v", vt) - // } return valueTypeUnset } @@ -681,7 +635,7 @@ func (d *msgpackDecDriver) TryDecodeAsNil() (v bool) { } if d.bd == mpNil { d.bdRead = false - return true + v = true } return } @@ -747,57 +701,6 @@ func (d *msgpackDecDriver) readExtLen() (clen int) { return } -func (d *msgpackDecDriver) DecodeTime() (t time.Time) { - // decode time from string bytes or ext - if !d.bdRead { - d.readNextBd() - } - if d.bd == mpNil { - d.bdRead = false - return - } - var clen int - switch d.ContainerType() { - case valueTypeBytes, valueTypeString: - clen = d.readContainerLen(msgpackContainerStr) - default: - // expect to see mpFixExt4,-1 OR mpFixExt8,-1 OR mpExt8,12,-1 - d.bdRead = false - b2 := d.r.readn1() - if d.bd == mpFixExt4 && b2 == mpTimeExtTagU { - clen = 4 - } else if d.bd == mpFixExt8 && b2 == mpTimeExtTagU { - clen = 8 - } else if d.bd == mpExt8 && b2 == 12 && d.r.readn1() == mpTimeExtTagU { - clen = 12 - } else { - d.d.errorf("invalid bytes for decoding time as extension: got 0x%x, 0x%x", d.bd, b2) - return - } - } - return d.decodeTime(clen) -} - -func (d *msgpackDecDriver) decodeTime(clen int) (t time.Time) { - // bs = d.r.readx(clen) - d.bdRead = false - switch clen { - case 4: - t = time.Unix(int64(bigen.Uint32(d.r.readx(4))), 0).UTC() - case 8: - tv := bigen.Uint64(d.r.readx(8)) - t = time.Unix(int64(tv&0x00000003ffffffff), int64(tv>>34)).UTC() - case 12: - nsec := bigen.Uint32(d.r.readx(4)) - sec := bigen.Uint64(d.r.readx(8)) - t = time.Unix(int64(sec), int64(nsec)).UTC() - default: - d.d.errorf("invalid length of bytes for decoding time - expecting 4 or 8 or 12, got %d", clen) - return - } - return -} - func (d *msgpackDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) { if xtag > 0xff { d.d.errorf("decodeExt: tag must be <= 0xff; got: %v", xtag) @@ -847,9 +750,6 @@ type MsgpackHandle struct { // RawToString controls how raw bytes are decoded into a nil interface{}. RawToString bool - // NoFixedNum says to output all signed integers as 2-bytes, never as 1-byte fixednum. - NoFixedNum bool - // WriteExt flag supports encoding configured extensions with extension tags. // It also controls whether other elements of the new spec are encoded (ie Str8). // @@ -861,19 +761,12 @@ type MsgpackHandle struct { // type is provided (e.g. decoding into a nil interface{}), you get back // a []byte or string based on the setting of RawToString. WriteExt bool - binaryEncodingType noElemSeparators - - _ [1]uint64 // padding } -// Name returns the name of the handle: msgpack -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, &setExtWrapper{b: ext}) } func (h *MsgpackHandle) newEncDriver(e *Encoder) encDriver { @@ -911,7 +804,7 @@ func (c *msgpackSpecRpcCodec) WriteRequest(r *rpc.Request, body interface{}) err bodyArr = []interface{}{body} } r2 := []interface{}{0, uint32(r.Seq), r.ServiceMethod, bodyArr} - return c.write(r2, nil, false) + return c.write(r2, nil, false, true) } func (c *msgpackSpecRpcCodec) WriteResponse(r *rpc.Response, body interface{}) error { @@ -923,7 +816,7 @@ func (c *msgpackSpecRpcCodec) WriteResponse(r *rpc.Response, body interface{}) e body = nil } r2 := []interface{}{1, uint32(r.Seq), moe, body} - return c.write(r2, nil, false) + return c.write(r2, nil, false, true) } func (c *msgpackSpecRpcCodec) ReadResponseHeader(r *rpc.Response) error { @@ -943,6 +836,7 @@ func (c *msgpackSpecRpcCodec) ReadRequestBody(body interface{}) error { } func (c *msgpackSpecRpcCodec) parseCustomHeader(expectTypeByte byte, msgid *uint64, methodOrError *string) (err error) { + if c.isClosed() { return io.EOF } @@ -956,34 +850,28 @@ func (c *msgpackSpecRpcCodec) parseCustomHeader(expectTypeByte byte, msgid *uint // err = fmt.Errorf("Unexpected value for array descriptor: Expecting %v. Received %v", fia, bs1) // return // } - var ba [1]byte - var n int - for { - n, err = c.r.Read(ba[:]) - if err != nil { - return - } - if n == 1 { - break - } + var b byte + b, err = c.br.ReadByte() + if err != nil { + return } - - var b = ba[0] if b != fia { err = fmt.Errorf("Unexpected value for array descriptor: Expecting %v. Received %v", fia, b) - } else { - err = c.read(&b) - if err == nil { - if b != expectTypeByte { - err = fmt.Errorf("Unexpected byte descriptor. Expecting %v; Received %v", - expectTypeByte, b) - } else { - err = c.read(msgid) - if err == nil { - err = c.read(methodOrError) - } - } - } + return + } + + if err = c.read(&b); err != nil { + return + } + if b != expectTypeByte { + err = fmt.Errorf("Unexpected byte descriptor in header. Expecting %v. Received %v", expectTypeByte, b) + return + } + if err = c.read(msgid); err != nil { + return + } + if err = c.read(methodOrError); err != nil { + return } return } @@ -996,8 +884,7 @@ type msgpackSpecRpc struct{} // MsgpackSpecRpc implements Rpc using the communication protocol defined in // the msgpack spec at https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md . -// -// See GoRpc documentation, for information on buffering for better performance. +// Its methods (ServerCodec and ClientCodec) return values that implement RpcCodecBuffered. var MsgpackSpecRpc msgpackSpecRpc func (x msgpackSpecRpc) ServerCodec(conn io.ReadWriteCloser, h Handle) rpc.ServerCodec { diff --git a/vendor/github.com/ugorji/go/codec/noop.go b/vendor/github.com/ugorji/go/codec/noop.go index 424bd49d..015af581 100644 --- a/vendor/github.com/ugorji/go/codec/noop.go +++ b/vendor/github.com/ugorji/go/codec/noop.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build ignore @@ -91,9 +91,8 @@ func (h *noopDrv) EncodeArrayStart(length int) { h.start(true) } func (h *noopDrv) EncodeMapStart(length int) { h.start(false) } func (h *noopDrv) EncodeEnd() { h.end() } -func (h *noopDrv) EncodeString(c charEncoding, v string) {} - -// func (h *noopDrv) EncodeSymbol(v string) {} +func (h *noopDrv) EncodeString(c charEncoding, v string) {} +func (h *noopDrv) EncodeSymbol(v string) {} func (h *noopDrv) EncodeStringBytes(c charEncoding, v []byte) {} func (h *noopDrv) EncodeExt(rv interface{}, xtag uint64, ext Ext, e *Encoder) {} @@ -120,12 +119,9 @@ func (h *noopDrv) ReadArrayStart() int { h.start(false); return h.m(10) } func (h *noopDrv) ContainerType() (vt valueType) { // return h.m(2) == 0 - // handle kStruct, which will bomb is it calls this and - // doesn't get back a map or array. - // consequently, if the return value is not map or array, - // reset it to one of them based on h.m(7) % 2 - // for kstruct: at least one out of every 2 times, - // return one of valueTypeMap or Array (else kstruct bombs) + // handle kStruct, which will bomb is it calls this and doesn't get back a map or array. + // consequently, if the return value is not map or array, reset it to one of them based on h.m(7) % 2 + // for kstruct: at least one out of every 2 times, return one of valueTypeMap or Array (else kstruct bombs) // however, every 10th time it is called, we just return something else. var vals = [...]valueType{valueTypeArray, valueTypeMap} // ------------ TAKE ------------ @@ -154,8 +150,7 @@ func (h *noopDrv) ContainerType() (vt valueType) { // } // return valueTypeUnset // TODO: may need to tweak this so it works. - // if h.ct == valueTypeMap && vt == valueTypeArray || - // h.ct == valueTypeArray && vt == valueTypeMap { + // if h.ct == valueTypeMap && vt == valueTypeArray || h.ct == valueTypeArray && vt == valueTypeMap { // h.cb = !h.cb // h.ct = vt // return h.cb diff --git a/vendor/github.com/ugorji/go/codec/rpc.go b/vendor/github.com/ugorji/go/codec/rpc.go index dc8c07c0..4c307804 100644 --- a/vendor/github.com/ugorji/go/codec/rpc.go +++ b/vendor/github.com/ugorji/go/codec/rpc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -11,143 +11,124 @@ import ( "sync" ) +// // rpcEncodeTerminator allows a handler specify a []byte terminator to send after each Encode. +// // +// // Some codecs like json need to put a space after each encoded value, to serve as a +// // delimiter for things like numbers (else json codec will continue reading till EOF). +// type rpcEncodeTerminator interface { +// rpcEncodeTerminate() []byte +// } + // Rpc provides a rpc Server or Client Codec for rpc communication. type Rpc interface { ServerCodec(conn io.ReadWriteCloser, h Handle) rpc.ServerCodec ClientCodec(conn io.ReadWriteCloser, h Handle) rpc.ClientCodec } -// RPCOptions holds options specific to rpc functionality -type RPCOptions struct { - // RPCNoBuffer configures whether we attempt to buffer reads and writes during RPC calls. - // - // Set RPCNoBuffer=true to turn buffering off. - // Buffering can still be done if buffered connections are passed in, or - // buffering is configured on the handle. - RPCNoBuffer bool +// RpcCodecBuffered allows access to the underlying bufio.Reader/Writer +// used by the rpc connection. It accommodates use-cases where the connection +// should be used by rpc and non-rpc functions, e.g. streaming a file after +// sending an rpc response. +type RpcCodecBuffered interface { + BufferedReader() *bufio.Reader + BufferedWriter() *bufio.Writer } +// ------------------------------------- + // rpcCodec defines the struct members and common methods. type rpcCodec struct { - c io.Closer - r io.Reader - w io.Writer - f ioFlusher - + rwc io.ReadWriteCloser dec *Decoder enc *Encoder - // bw *bufio.Writer - // br *bufio.Reader - mu sync.Mutex - h Handle + bw *bufio.Writer + br *bufio.Reader + mu sync.Mutex + h Handle - cls bool - clsmu sync.RWMutex - clsErr error + cls bool + clsmu sync.RWMutex } func newRPCCodec(conn io.ReadWriteCloser, h Handle) rpcCodec { - // return newRPCCodec2(bufio.NewReader(conn), bufio.NewWriter(conn), conn, h) - return newRPCCodec2(conn, conn, conn, h) -} + bw := bufio.NewWriter(conn) + br := bufio.NewReader(conn) -func newRPCCodec2(r io.Reader, w io.Writer, c io.Closer, h Handle) rpcCodec { // defensive: ensure that jsonH has TermWhitespace turned on. if jsonH, ok := h.(*JsonHandle); ok && !jsonH.TermWhitespace { panic(errors.New("rpc requires a JsonHandle with TermWhitespace set to true")) } - // always ensure that we use a flusher, and always flush what was written to the connection. - // we lose nothing by using a buffered writer internally. - f, ok := w.(ioFlusher) - bh := h.getBasicHandle() - if !bh.RPCNoBuffer { - if bh.WriterBufferSize <= 0 { - if !ok { - bw := bufio.NewWriter(w) - f, w = bw, bw - } - } - if bh.ReaderBufferSize <= 0 { - if _, ok = w.(ioPeeker); !ok { - if _, ok = w.(ioBuffered); !ok { - br := bufio.NewReader(r) - r = br - } - } - } - } + return rpcCodec{ - c: c, - w: w, - r: r, - f: f, + rwc: conn, + bw: bw, + br: br, + enc: NewEncoder(bw, h), + dec: NewDecoder(br, h), h: h, - enc: NewEncoder(w, h), - dec: NewDecoder(r, h), } } -func (c *rpcCodec) write(obj1, obj2 interface{}, writeObj2 bool) (err error) { +func (c *rpcCodec) BufferedReader() *bufio.Reader { + return c.br +} + +func (c *rpcCodec) BufferedWriter() *bufio.Writer { + return c.bw +} + +func (c *rpcCodec) write(obj1, obj2 interface{}, writeObj2, doFlush bool) (err error) { if c.isClosed() { - return c.clsErr + return io.EOF } - err = c.enc.Encode(obj1) - if err == nil { - if writeObj2 { - err = c.enc.Encode(obj2) - } - if err == nil && c.f != nil { - err = c.f.Flush() + if err = c.enc.Encode(obj1); err != nil { + return + } + // t, tOk := c.h.(rpcEncodeTerminator) + // if tOk { + // c.bw.Write(t.rpcEncodeTerminate()) + // } + if writeObj2 { + if err = c.enc.Encode(obj2); err != nil { + return } + // if tOk { + // c.bw.Write(t.rpcEncodeTerminate()) + // } + } + if doFlush { + return c.bw.Flush() } return } -func (c *rpcCodec) swallow(err *error) { - defer panicToErr(c.dec, err) - c.dec.swallow() -} - func (c *rpcCodec) read(obj interface{}) (err error) { if c.isClosed() { - return c.clsErr + return io.EOF } - //If nil is passed in, we should read and discard + //If nil is passed in, we should still attempt to read content to nowhere. if obj == nil { - // var obj2 interface{} - // return c.dec.Decode(&obj2) - c.swallow(&err) - return + var obj2 interface{} + return c.dec.Decode(&obj2) } return c.dec.Decode(obj) } -func (c *rpcCodec) isClosed() (b bool) { - if c.c != nil { - c.clsmu.RLock() - b = c.cls - c.clsmu.RUnlock() - } - return +func (c *rpcCodec) isClosed() bool { + c.clsmu.RLock() + x := c.cls + c.clsmu.RUnlock() + return x } func (c *rpcCodec) Close() error { - if c.c == nil || c.isClosed() { - return c.clsErr + if c.isClosed() { + return io.EOF } c.clsmu.Lock() c.cls = true - var fErr error - if c.f != nil { - fErr = c.f.Flush() - } - _ = fErr - c.clsErr = c.c.Close() - if c.clsErr == nil && fErr != nil { - c.clsErr = fErr - } c.clsmu.Unlock() - return c.clsErr + return c.rwc.Close() } func (c *rpcCodec) ReadResponseBody(body interface{}) error { @@ -164,13 +145,13 @@ func (c *goRpcCodec) WriteRequest(r *rpc.Request, body interface{}) error { // Must protect for concurrent access as per API c.mu.Lock() defer c.mu.Unlock() - return c.write(r, body, true) + return c.write(r, body, true, true) } func (c *goRpcCodec) WriteResponse(r *rpc.Response, body interface{}) error { c.mu.Lock() defer c.mu.Unlock() - return c.write(r, body, true) + return c.write(r, body, true, true) } func (c *goRpcCodec) ReadResponseHeader(r *rpc.Response) error { @@ -192,36 +173,7 @@ func (c *goRpcCodec) ReadRequestBody(body interface{}) error { type goRpc struct{} // GoRpc implements Rpc using the communication protocol defined in net/rpc package. -// -// Note: network connection (from net.Dial, of type io.ReadWriteCloser) is not buffered. -// -// For performance, you should configure WriterBufferSize and ReaderBufferSize on the handle. -// This ensures we use an adequate buffer during reading and writing. -// If not configured, we will internally initialize and use a buffer during reads and writes. -// This can be turned off via the RPCNoBuffer option on the Handle. -// var handle codec.JsonHandle -// handle.RPCNoBuffer = true // turns off attempt by rpc module to initialize a buffer -// -// Example 1: one way of configuring buffering explicitly: -// var handle codec.JsonHandle // codec handle -// handle.ReaderBufferSize = 1024 -// handle.WriterBufferSize = 1024 -// var conn io.ReadWriteCloser // connection got from a socket -// var serverCodec = GoRpc.ServerCodec(conn, handle) -// var clientCodec = GoRpc.ClientCodec(conn, handle) -// -// Example 2: you can also explicitly create a buffered connection yourself, -// and not worry about configuring the buffer sizes in the Handle. -// var handle codec.Handle // codec handle -// var conn io.ReadWriteCloser // connection got from a socket -// var bufconn = struct { // bufconn here is a buffered io.ReadWriteCloser -// io.Closer -// *bufio.Reader -// *bufio.Writer -// }{conn, bufio.NewReader(conn), bufio.NewWriter(conn)} -// var serverCodec = GoRpc.ServerCodec(bufconn, handle) -// var clientCodec = GoRpc.ClientCodec(bufconn, handle) -// +// Its methods (ServerCodec and ClientCodec) return values that implement RpcCodecBuffered. var GoRpc goRpc func (x goRpc) ServerCodec(conn io.ReadWriteCloser, h Handle) rpc.ServerCodec { @@ -231,3 +183,5 @@ func (x goRpc) ServerCodec(conn io.ReadWriteCloser, h Handle) rpc.ServerCodec { func (x goRpc) ClientCodec(conn io.ReadWriteCloser, h Handle) rpc.ClientCodec { return &goRpcCodec{newRPCCodec(conn, h)} } + +var _ RpcCodecBuffered = (*rpcCodec)(nil) // ensure *rpcCodec implements RpcCodecBuffered diff --git a/vendor/github.com/ugorji/go/codec/simple.go b/vendor/github.com/ugorji/go/codec/simple.go index a839d810..b69a15e7 100644 --- a/vendor/github.com/ugorji/go/codec/simple.go +++ b/vendor/github.com/ugorji/go/codec/simple.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -6,7 +6,6 @@ package codec import ( "math" "reflect" - "time" ) const ( @@ -21,8 +20,6 @@ const ( simpleVdPosInt = 8 simpleVdNegInt = 12 - simpleVdTime = 24 - // containers: each lasts for 4 (ie n, n+1, n+2, ... n+7) simpleVdString = 216 simpleVdByteArray = 224 @@ -33,15 +30,12 @@ const ( type simpleEncDriver struct { noBuiltInTypes + encDriverNoopContainerWriter // encNoSeparator e *Encoder h *SimpleHandle w encWriter b [8]byte - // c containerState - encDriverTrackContainerWriter - // encDriverNoopContainerWriter - _ [2]uint64 // padding } func (e *simpleEncDriver) EncodeNil() { @@ -49,10 +43,6 @@ func (e *simpleEncDriver) EncodeNil() { } func (e *simpleEncDriver) EncodeBool(b bool) { - if e.h.EncZeroValuesAsNil && e.c != containerMapKey && !b { - e.EncodeNil() - return - } if b { e.w.writen1(simpleVdTrue) } else { @@ -61,19 +51,11 @@ func (e *simpleEncDriver) EncodeBool(b bool) { } func (e *simpleEncDriver) EncodeFloat32(f float32) { - if e.h.EncZeroValuesAsNil && e.c != containerMapKey && f == 0.0 { - e.EncodeNil() - return - } e.w.writen1(simpleVdFloat32) bigenHelper{e.b[:4], e.w}.writeUint32(math.Float32bits(f)) } func (e *simpleEncDriver) EncodeFloat64(f float64) { - if e.h.EncZeroValuesAsNil && e.c != containerMapKey && f == 0.0 { - e.EncodeNil() - return - } e.w.writen1(simpleVdFloat64) bigenHelper{e.b[:8], e.w}.writeUint64(math.Float64bits(f)) } @@ -91,10 +73,6 @@ func (e *simpleEncDriver) EncodeUint(v uint64) { } func (e *simpleEncDriver) encUint(v uint64, bd uint8) { - if e.h.EncZeroValuesAsNil && e.c != containerMapKey && v == 0 { - e.EncodeNil() - return - } if v <= math.MaxUint8 { e.w.writen2(bd, uint8(v)) } else if v <= math.MaxUint16 { @@ -148,51 +126,24 @@ 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) } func (e *simpleEncDriver) EncodeString(c charEncoding, v string) { - if false && e.h.EncZeroValuesAsNil && e.c != containerMapKey && v == "" { - e.EncodeNil() - return - } e.encLen(simpleVdString, len(v)) e.w.writestr(v) } -// func (e *simpleEncDriver) EncodeSymbol(v string) { -// e.EncodeString(cUTF8, v) -// } - -func (e *simpleEncDriver) EncodeStringBytes(c charEncoding, v []byte) { - // if e.h.EncZeroValuesAsNil && e.c != containerMapKey && v == nil { - if v == nil { - e.EncodeNil() - return - } - e.encLen(simpleVdByteArray, len(v)) - e.w.writeb(v) +func (e *simpleEncDriver) EncodeSymbol(v string) { + e.EncodeString(c_UTF8, v) } -func (e *simpleEncDriver) EncodeTime(t time.Time) { - // if e.h.EncZeroValuesAsNil && e.c != containerMapKey && t.IsZero() { - if t.IsZero() { - e.EncodeNil() - return - } - v, err := t.MarshalBinary() - if err != nil { - e.e.errorv(err) - return - } - // time.Time marshalbinary takes about 14 bytes. - e.w.writen2(simpleVdTime, uint8(len(v))) +func (e *simpleEncDriver) EncodeStringBytes(c charEncoding, v []byte) { + e.encLen(simpleVdByteArray, len(v)) e.w.writeb(v) } @@ -204,13 +155,11 @@ type simpleDecDriver struct { r decReader bdRead bool bd byte - br bool // a bytes reader? - c containerState - // b [scratchByteArrayLen]byte + br bool // bytes reader + b [scratchByteArrayLen]byte noBuiltInTypes // noStreamingCodec decDriverNoopContainerReader - _ [3]uint64 // padding } func (d *simpleDecDriver) readNextBd() { @@ -229,27 +178,23 @@ func (d *simpleDecDriver) ContainerType() (vt valueType) { if !d.bdRead { d.readNextBd() } - switch d.bd { - case simpleVdNil: + if d.bd == simpleVdNil { return valueTypeNil - case simpleVdByteArray, simpleVdByteArray + 1, - simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4: + } else if d.bd == simpleVdByteArray || d.bd == simpleVdByteArray+1 || + d.bd == simpleVdByteArray+2 || d.bd == simpleVdByteArray+3 || d.bd == simpleVdByteArray+4 { return valueTypeBytes - case simpleVdString, simpleVdString + 1, - simpleVdString + 2, simpleVdString + 3, simpleVdString + 4: + } else if d.bd == simpleVdString || d.bd == simpleVdString+1 || + d.bd == simpleVdString+2 || d.bd == simpleVdString+3 || d.bd == simpleVdString+4 { return valueTypeString - case simpleVdArray, simpleVdArray + 1, - simpleVdArray + 2, simpleVdArray + 3, simpleVdArray + 4: + } else if d.bd == simpleVdArray || d.bd == simpleVdArray+1 || + d.bd == simpleVdArray+2 || d.bd == simpleVdArray+3 || d.bd == simpleVdArray+4 { return valueTypeArray - case simpleVdMap, simpleVdMap + 1, - simpleVdMap + 2, simpleVdMap + 3, simpleVdMap + 4: + } else if d.bd == simpleVdMap || d.bd == simpleVdMap+1 || + d.bd == simpleVdMap+2 || d.bd == simpleVdMap+3 || d.bd == simpleVdMap+4 { return valueTypeMap - // case simpleVdTime: - // return valueTypeTime + } else { + // d.d.errorf("isContainerType: unsupported parameter: %v", vt) } - // else { - // d.d.errorf("isContainerType: unsupported parameter: %v", vt) - // } return valueTypeUnset } @@ -290,7 +235,7 @@ func (d *simpleDecDriver) decCheckInteger() (ui uint64, neg bool) { ui = uint64(bigen.Uint64(d.r.readx(8))) neg = true default: - d.d.errorf("Integer only valid from pos/neg integer1..8. Invalid descriptor: %v", d.bd) + d.d.errorf("decIntAny: Integer only valid from pos/neg integer1..8. Invalid descriptor: %v", d.bd) return } // don't do this check, because callers may only want the unsigned value. @@ -301,27 +246,39 @@ func (d *simpleDecDriver) decCheckInteger() (ui uint64, neg bool) { return } -func (d *simpleDecDriver) DecodeInt64() (i int64) { +func (d *simpleDecDriver) DecodeInt(bitsize uint8) (i int64) { ui, neg := d.decCheckInteger() - i = chkOvf.SignedIntV(ui) + i, overflow := chkOvf.SignedInt(ui) + if overflow { + d.d.errorf("simple: overflow converting %v to signed integer", ui) + return + } if neg { i = -i } - d.bdRead = false - return -} - -func (d *simpleDecDriver) DecodeUint64() (ui uint64) { - ui, neg := d.decCheckInteger() - if neg { - d.d.errorf("Assigning negative signed value to unsigned type") + if chkOvf.Int(i, bitsize) { + d.d.errorf("simple: overflow integer: %v", i) return } d.bdRead = false return } -func (d *simpleDecDriver) DecodeFloat64() (f float64) { +func (d *simpleDecDriver) DecodeUint(bitsize uint8) (ui uint64) { + ui, neg := d.decCheckInteger() + if neg { + d.d.errorf("Assigning negative signed value to unsigned type") + return + } + if chkOvf.Uint(ui, bitsize) { + d.d.errorf("simple: overflow integer: %v", ui) + return + } + d.bdRead = false + return +} + +func (d *simpleDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { if !d.bdRead { d.readNextBd() } @@ -331,12 +288,16 @@ func (d *simpleDecDriver) DecodeFloat64() (f float64) { f = math.Float64frombits(bigen.Uint64(d.r.readx(8))) } else { if d.bd >= simpleVdPosInt && d.bd <= simpleVdNegInt+3 { - f = float64(d.DecodeInt64()) + f = float64(d.DecodeInt(64)) } else { d.d.errorf("Float only valid from float32/64: Invalid descriptor: %v", d.bd) return } } + if chkOverflow32 && chkOvf.Float32(f) { + d.d.errorf("msgpack: float32 overflow: %v", f) + return + } d.bdRead = false return } @@ -362,7 +323,6 @@ func (d *simpleDecDriver) ReadMapStart() (length int) { d.readNextBd() } d.bdRead = false - d.c = containerMapStart return d.decLen() } @@ -371,30 +331,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: @@ -406,14 +345,14 @@ func (d *simpleDecDriver) decLen() int { case 3: ui := uint64(bigen.Uint32(d.r.readx(4))) if chkOvf.Uint(ui, intBitsize) { - d.d.errorf("overflow integer: %v", ui) + d.d.errorf("simple: overflow integer: %v", ui) return 0 } return int(ui) case 4: ui := bigen.Uint64(d.r.readx(8)) if chkOvf.Uint(ui, intBitsize) { - d.d.errorf("overflow integer: %v", ui) + d.d.errorf("simple: overflow integer: %v", ui) return 0 } return int(ui) @@ -423,11 +362,11 @@ func (d *simpleDecDriver) decLen() int { } func (d *simpleDecDriver) DecodeString() (s string) { - return string(d.DecodeBytes(d.d.b[:], true)) + return string(d.DecodeBytes(d.b[:], true)) } func (d *simpleDecDriver) DecodeStringAsBytes() (s []byte) { - return d.DecodeBytes(d.d.b[:], true) + return d.DecodeBytes(d.b[:], true) } func (d *simpleDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { @@ -438,48 +377,18 @@ func (d *simpleDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { d.bdRead = false return } - // check if an "array" of uint8's (see ContainerType for how to infer if an array) - if d.bd >= simpleVdArray && d.bd <= simpleVdMap+4 { - if len(bs) == 0 && zerocopy { - bs = d.d.b[:] - } - bsOut, _ = fastpathTV.DecSliceUint8V(bs, true, d.d) - return - } - clen := d.decLen() d.bdRead = false if zerocopy { if d.br { return d.r.readx(clen) } else if len(bs) == 0 { - bs = d.d.b[:] + bs = d.b[:] } } return decByteSlice(d.r, clen, d.d.h.MaxInitLen, bs) } -func (d *simpleDecDriver) DecodeTime() (t time.Time) { - if !d.bdRead { - d.readNextBd() - } - if d.bd == simpleVdNil { - d.bdRead = false - return - } - if d.bd != simpleVdTime { - d.d.errorf("invalid descriptor for time.Time - expect 0x%x, received 0x%x", simpleVdTime, d.bd) - return - } - d.bdRead = false - clen := int(d.r.readn1()) - b := d.r.readx(clen) - if err := (&t).UnmarshalBinary(b); err != nil { - d.d.errorv(err) - } - return -} - func (d *simpleDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) { if xtag > 0xff { d.d.errorf("decodeExt: tag must be <= 0xff; got: %v", xtag) @@ -510,11 +419,10 @@ func (d *simpleDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs [ return } xbs = d.r.readx(l) - case simpleVdByteArray, simpleVdByteArray + 1, - simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4: + case simpleVdByteArray, simpleVdByteArray + 1, simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4: xbs = d.DecodeBytes(nil, true) default: - d.d.errorf("Invalid descriptor - expecting extensions/bytearray, got: 0x%x", d.bd) + d.d.errorf("Invalid d.bd for extensions (Expecting extensions or byte array). Got: 0x%x", d.bd) return } d.bdRead = false @@ -541,29 +449,24 @@ func (d *simpleDecDriver) DecodeNaked() { case simpleVdPosInt, simpleVdPosInt + 1, simpleVdPosInt + 2, simpleVdPosInt + 3: if d.h.SignedInteger { n.v = valueTypeInt - n.i = d.DecodeInt64() + n.i = d.DecodeInt(64) } else { n.v = valueTypeUint - n.u = d.DecodeUint64() + n.u = d.DecodeUint(64) } case simpleVdNegInt, simpleVdNegInt + 1, simpleVdNegInt + 2, simpleVdNegInt + 3: n.v = valueTypeInt - n.i = d.DecodeInt64() + n.i = d.DecodeInt(64) case simpleVdFloat32: n.v = valueTypeFloat - n.f = d.DecodeFloat64() + n.f = d.DecodeFloat(true) case simpleVdFloat64: n.v = valueTypeFloat - n.f = d.DecodeFloat64() - case simpleVdTime: - n.v = valueTypeTime - n.t = d.DecodeTime() - case simpleVdString, simpleVdString + 1, - simpleVdString + 2, simpleVdString + 3, simpleVdString + 4: + n.f = d.DecodeFloat(false) + case simpleVdString, simpleVdString + 1, simpleVdString + 2, simpleVdString + 3, simpleVdString + 4: n.v = valueTypeString n.s = d.DecodeString() - case simpleVdByteArray, simpleVdByteArray + 1, - simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4: + case simpleVdByteArray, simpleVdByteArray + 1, simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4: n.v = valueTypeBytes n.l = d.DecodeBytes(nil, false) case simpleVdExt, simpleVdExt + 1, simpleVdExt + 2, simpleVdExt + 3, simpleVdExt + 4: @@ -571,8 +474,7 @@ func (d *simpleDecDriver) DecodeNaked() { l := d.decLen() n.u = uint64(d.r.readn1()) n.l = d.r.readx(l) - case simpleVdArray, simpleVdArray + 1, simpleVdArray + 2, - simpleVdArray + 3, simpleVdArray + 4: + case simpleVdArray, simpleVdArray + 1, simpleVdArray + 2, simpleVdArray + 3, simpleVdArray + 4: n.v = valueTypeArray decodeFurther = true case simpleVdMap, simpleVdMap + 1, simpleVdMap + 2, simpleVdMap + 3, simpleVdMap + 4: @@ -598,7 +500,7 @@ func (d *simpleDecDriver) DecodeNaked() { // - Integers (intXXX, uintXXX) are encoded in 1, 2, 4 or 8 bytes (plus a descriptor byte). // There are positive (uintXXX and intXXX >= 0) and negative (intXXX < 0) integers. // - Floats are encoded in 4 or 8 bytes (plus a descriptor byte) -// - Length of containers (strings, bytes, array, map, extensions) +// - Lenght of containers (strings, bytes, array, map, extensions) // are encoded in 0, 1, 2, 4 or 8 bytes. // Zero-length containers have no length encoded. // For others, the number of bytes is given by pow(2, bd%3) @@ -606,29 +508,18 @@ func (d *simpleDecDriver) DecodeNaked() { // - arrays are encoded as [bd] [length] [value]... // - extensions are encoded as [bd] [length] [tag] [byte]... // - strings/bytearrays are encoded as [bd] [length] [byte]... -// - time.Time are encoded as [bd] [length] [byte]... // // The full spec will be published soon. type SimpleHandle struct { BasicHandle binaryEncodingType noElemSeparators - // EncZeroValuesAsNil says to encode zero values for numbers, bool, string, etc as nil - EncZeroValuesAsNil bool - - _ [1]uint64 // padding } -// Name returns the name of the handle: simple -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, &setExtWrapper{b: ext}) } -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} } @@ -638,12 +529,10 @@ func (h *SimpleHandle) newDecDriver(d *Decoder) decDriver { } func (e *simpleEncDriver) reset() { - e.c = 0 e.w = e.e.w } func (d *simpleDecDriver) reset() { - d.c = 0 d.r, d.br = d.d.r, d.d.bytes d.bd, d.bdRead = 0, false } diff --git a/vendor/github.com/ugorji/go/codec/time.go b/vendor/github.com/ugorji/go/codec/time.go new file mode 100644 index 00000000..55841d4c --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/time.go @@ -0,0 +1,220 @@ +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +package codec + +import ( + "fmt" + "time" +) + +var timeDigits = [...]byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'} + +type timeExt struct{} + +func (x timeExt) WriteExt(v interface{}) (bs []byte) { + switch v2 := v.(type) { + case time.Time: + bs = encodeTime(v2) + case *time.Time: + bs = encodeTime(*v2) + default: + panic(fmt.Errorf("unsupported format for time conversion: expecting time.Time; got %T", v2)) + } + return +} +func (x timeExt) ReadExt(v interface{}, bs []byte) { + tt, err := decodeTime(bs) + if err != nil { + panic(err) + } + *(v.(*time.Time)) = tt +} + +func (x timeExt) ConvertExt(v interface{}) interface{} { + return x.WriteExt(v) +} +func (x timeExt) UpdateExt(v interface{}, src interface{}) { + x.ReadExt(v, src.([]byte)) +} + +// EncodeTime encodes a time.Time as a []byte, including +// information on the instant in time and UTC offset. +// +// Format Description +// +// A timestamp is composed of 3 components: +// +// - secs: signed integer representing seconds since unix epoch +// - nsces: unsigned integer representing fractional seconds as a +// nanosecond offset within secs, in the range 0 <= nsecs < 1e9 +// - tz: signed integer representing timezone offset in minutes east of UTC, +// and a dst (daylight savings time) flag +// +// When encoding a timestamp, the first byte is the descriptor, which +// defines which components are encoded and how many bytes are used to +// encode secs and nsecs components. *If secs/nsecs is 0 or tz is UTC, it +// is not encoded in the byte array explicitly*. +// +// Descriptor 8 bits are of the form `A B C DDD EE`: +// A: Is secs component encoded? 1 = true +// B: Is nsecs component encoded? 1 = true +// C: Is tz component encoded? 1 = true +// DDD: Number of extra bytes for secs (range 0-7). +// If A = 1, secs encoded in DDD+1 bytes. +// If A = 0, secs is not encoded, and is assumed to be 0. +// If A = 1, then we need at least 1 byte to encode secs. +// DDD says the number of extra bytes beyond that 1. +// E.g. if DDD=0, then secs is represented in 1 byte. +// if DDD=2, then secs is represented in 3 bytes. +// EE: Number of extra bytes for nsecs (range 0-3). +// If B = 1, nsecs encoded in EE+1 bytes (similar to secs/DDD above) +// +// Following the descriptor bytes, subsequent bytes are: +// +// secs component encoded in `DDD + 1` bytes (if A == 1) +// nsecs component encoded in `EE + 1` bytes (if B == 1) +// tz component encoded in 2 bytes (if C == 1) +// +// secs and nsecs components are integers encoded in a BigEndian +// 2-complement encoding format. +// +// tz component is encoded as 2 bytes (16 bits). Most significant bit 15 to +// Least significant bit 0 are described below: +// +// Timezone offset has a range of -12:00 to +14:00 (ie -720 to +840 minutes). +// Bit 15 = have\_dst: set to 1 if we set the dst flag. +// Bit 14 = dst\_on: set to 1 if dst is in effect at the time, or 0 if not. +// Bits 13..0 = timezone offset in minutes. It is a signed integer in Big Endian format. +// +func encodeTime(t time.Time) []byte { + //t := rv.Interface().(time.Time) + tsecs, tnsecs := t.Unix(), t.Nanosecond() + var ( + bd byte + btmp [8]byte + bs [16]byte + i int = 1 + ) + l := t.Location() + if l == time.UTC { + l = nil + } + if tsecs != 0 { + bd = bd | 0x80 + bigen.PutUint64(btmp[:], uint64(tsecs)) + f := pruneSignExt(btmp[:], tsecs >= 0) + bd = bd | (byte(7-f) << 2) + copy(bs[i:], btmp[f:]) + i = i + (8 - f) + } + if tnsecs != 0 { + bd = bd | 0x40 + bigen.PutUint32(btmp[:4], uint32(tnsecs)) + f := pruneSignExt(btmp[:4], true) + bd = bd | byte(3-f) + copy(bs[i:], btmp[f:4]) + i = i + (4 - f) + } + if l != nil { + bd = bd | 0x20 + // Note that Go Libs do not give access to dst flag. + _, zoneOffset := t.Zone() + //zoneName, zoneOffset := t.Zone() + zoneOffset /= 60 + z := uint16(zoneOffset) + bigen.PutUint16(btmp[:2], z) + // clear dst flags + bs[i] = btmp[0] & 0x3f + bs[i+1] = btmp[1] + i = i + 2 + } + bs[0] = bd + return bs[0:i] +} + +// DecodeTime decodes a []byte into a time.Time. +func decodeTime(bs []byte) (tt time.Time, err error) { + bd := bs[0] + var ( + tsec int64 + tnsec uint32 + tz uint16 + i byte = 1 + i2 byte + n byte + ) + if bd&(1<<7) != 0 { + var btmp [8]byte + n = ((bd >> 2) & 0x7) + 1 + i2 = i + n + copy(btmp[8-n:], bs[i:i2]) + //if first bit of bs[i] is set, then fill btmp[0..8-n] with 0xff (ie sign extend it) + if bs[i]&(1<<7) != 0 { + copy(btmp[0:8-n], bsAll0xff) + //for j,k := byte(0), 8-n; j < k; j++ { btmp[j] = 0xff } + } + i = i2 + tsec = int64(bigen.Uint64(btmp[:])) + } + if bd&(1<<6) != 0 { + var btmp [4]byte + n = (bd & 0x3) + 1 + i2 = i + n + copy(btmp[4-n:], bs[i:i2]) + i = i2 + tnsec = bigen.Uint32(btmp[:]) + } + if bd&(1<<5) == 0 { + tt = time.Unix(tsec, int64(tnsec)).UTC() + 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. + // Zone name is in form: UTC-08:00. + // Note that Go Libs do not give access to dst flag, so we ignore dst bits + + i2 = i + 2 + tz = bigen.Uint16(bs[i:i2]) + i = i2 + // sign extend sign bit into top 2 MSB (which were dst bits): + if tz&(1<<13) == 0 { // positive + tz = tz & 0x3fff //clear 2 MSBs: dst bits + } else { // negative + tz = tz | 0xc000 //set 2 MSBs: dst bits + //tzname[3] = '-' (TODO: verify. this works here) + } + tzint := int16(tz) + if tzint == 0 { + tt = time.Unix(tsec, int64(tnsec)).UTC() + } else { + // For Go Time, do not use a descriptive timezone. + // It's unnecessary, and makes it harder to do a reflect.DeepEqual. + // The Offset already tells what the offset should be, if not on UTC and unknown zone name. + // var zoneName = timeLocUTCName(tzint) + tt = time.Unix(tsec, int64(tnsec)).In(time.FixedZone("", int(tzint)*60)) + } + return +} + +// func timeLocUTCName(tzint int16) string { +// if tzint == 0 { +// 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. +// //tzhr, tzmin := tz/60, tz%60 //faster if u convert to int first +// var tzhr, tzmin int16 +// if tzint < 0 { +// tzname[3] = '-' // (TODO: verify. this works here) +// tzhr, tzmin = -tzint/60, (-tzint)%60 +// } else { +// tzhr, tzmin = tzint/60, tzint%60 +// } +// tzname[4] = timeDigits[tzhr/10] +// tzname[5] = timeDigits[tzhr%10] +// tzname[7] = timeDigits[tzmin/10] +// tzname[8] = timeDigits[tzmin%10] +// return string(tzname) +// //return time.FixedZone(string(tzname), int(tzint)*60) +// } diff --git a/vendor/github.com/ugorji/go/codec/xml.go b/vendor/github.com/ugorji/go/codec/xml.go index 19fc36ca..9386775d 100644 --- a/vendor/github.com/ugorji/go/codec/xml.go +++ b/vendor/github.com/ugorji/go/codec/xml.go @@ -1,6 +1,3 @@ -// 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. - // +build ignore package codec @@ -27,6 +24,7 @@ It is a replacement, based on the simplicity and performance of codec. Look at it like JAXB for Go. Challenges: + - Need to output XML preamble, with all namespaces at the right location in the output. - Each "end" block is dynamic, so we need to maintain a context-aware stack - How to decide when to use an attribute VS an element @@ -36,26 +34,24 @@ Challenges: Extend the struct tag. See representative example: type X struct { - ID uint8 `codec:"http://ugorji.net/x-namespace xid id,omitempty,toarray,attr,cdata"` - // format: [namespace-uri ][namespace-prefix ]local-name, ... + ID uint8 codec:"xid|http://ugorji.net/x-namespace id,omitempty,toarray,attr,cdata" } Based on this, we encode - - fields as elements, BUT - encode as attributes if struct tag contains ",attr" and is a scalar (bool, number or string) + - fields as elements, BUT encode as attributes if struct tag contains ",attr". - text as entity-escaped text, BUT encode as CDATA if struct tag contains ",cdata". +In this mode, we only encode as attribute if ",attr" is found, and only encode as CDATA +if ",cdata" is found in the struct tag. + To handle namespaces: - XMLHandle is denoted as being namespace-aware. Consequently, we WILL use the ns:name pair to encode and decode if defined, else use the plain name. - *Encoder and *Decoder know whether the Handle "prefers" namespaces. - add *Encoder.getEncName(*structFieldInfo). No one calls *structFieldInfo.indexForEncName directly anymore - - OR better yet: indexForEncName is namespace-aware, and helper.go is all namespace-aware - indexForEncName takes a parameter of the form namespace:local-name OR local-name - add *Decoder.getStructFieldInfo(encName string) // encName here is either like abc, or h1:nsabc - by being a method on *Decoder, or maybe a method on the Handle itself. - No one accesses .encName anymore + No one accesses .encName anymore except in - let encode.go and decode.go use these (for consistency) - only problem exists for gen.go, where we create a big switch on encName. Now, we also have to add a switch on strings.endsWith(kName, encNsName) @@ -66,14 +62,13 @@ To handle namespaces: default { switch { case !nsAware: panic(...) - case strings.endsWith(":abc"): x.abc() - case strings.endsWith(":def"): x.def() + case strings.endsWith("nsabc"): x.abc() default: panic(...) } } } -The structure below accommodates this: +The structure below accomodates this: type typeInfo struct { sfi []*structFieldInfo // sorted by encName @@ -93,10 +88,7 @@ indexForEncName is now an internal helper function that takes a sorted array (one of ti.sfins or ti.sfi). It is only used by *Encoder.getStructFieldInfo(...) There will be a separate parser from the builder. -The parser will have a method: next() xmlToken method. It has lookahead support, -so you can pop multiple tokens, make a determination, and push them back in the order popped. -This will be needed to determine whether we are "nakedly" decoding a container or not. -The stack will be implemented using a slice and push/pop happens at the [0] element. +The parser will have a method: next() xmlToken method. xmlToken has fields: - type uint8: 0 | ElementStart | ElementEnd | AttrKey | AttrVal | Text @@ -140,7 +132,7 @@ At decode time, a structure containing the following is kept - all internal entities (<>&"' and others written in the document) When decode starts, it parses XML namespace declarations and creates a map in the -xmlDecDriver. While parsing, that map continuously gets updated. +xmlDecDriver. While parsing, that map continously gets updated. The only problem happens when a namespace declaration happens on the node that it defines. e.g. To handle this, each Element must be fully parsed at a time, @@ -152,7 +144,7 @@ xmlns is a special attribute name. *We may decide later to allow user to use it e.g. you want to parse the xmlns mappings into a field.* Number, bool, null, mapKey, etc can all be decoded from any xmlToken. -This accommodates map[int]string for example. +This accomodates map[int]string for example. It should be possible to create a schema from the types, or vice versa (generate types from schema with appropriate tags). @@ -186,8 +178,8 @@ An XML document is a name, a map of attributes and a list of children. Consequently, we cannot "DecodeNaked" into a map[string]interface{} (for example). We have to "DecodeNaked" into something that resembles XML data. -To support DecodeNaked (decode into nil interface{}), we have to define some "supporting" types: - type Name struct { // Preferred. Less allocations due to conversions. +To support DecodeNaked (decode into nil interface{}) we have to define some "supporting" types: + type Name struct { // Prefered. Less allocations due to conversions. Local string Space string } @@ -198,8 +190,6 @@ To support DecodeNaked (decode into nil interface{}), we have to define some "su } Only two "supporting" types are exposed for XML: Name and Element. -// ------------------ - We considered 'type Name string' where Name is like "Space Local" (space-separated). We decided against it, because each creation of a name would lead to double allocation (first convert []byte to string, then concatenate them into a string). @@ -225,16 +215,16 @@ intelligent accessor methods to extract information and for performance. } func (x *Element) child(i) interface{} // returns string or *Element -// ------------------ - -Per XML spec and our default handling, white space is always treated as -insignificant between elements, except in a text node. The xml:space='preserve' -attribute is ignored. +Per XML spec and our default handling, white space is insignificant between elements, +specifically between parent-child or siblings. White space occuring alone between start +and end element IS significant. However, if xml:space='preserve', then we 'preserve' +all whitespace. This is more critical when doing a DecodeNaked, but MAY not be as critical +when decoding into a typed value. **Note: there is no xml: namespace. The xml: attributes were defined before namespaces.** **So treat them as just "directives" that should be interpreted to mean something**. -On encoding, we support indenting aka prettifying markup in the same way we support it for json. +On encoding, we don't add any prettifying markup (indenting, etc). A document or element can only be encoded/decoded from/to a struct. In this mode: - struct name maps to element name (or tag-info from _struct field) @@ -268,14 +258,15 @@ the struct tag signifying it should be attr, then all its fields are encoded as e.g. type X struct { - M map[string]int `codec:"m,attr"` // encode keys as attributes named + M map[string]int `codec:"m,attr"` // encode as attributes } Question: - if encoding a map, what if map keys have spaces in them??? Then they cannot be attributes or child elements. Error. -Options to consider adding later: +Misc: + - For attribute values, normalize by trimming beginning and ending white space, and converting every white space sequence to a single space. - ATTLIST restrictions are enforced. @@ -293,8 +284,6 @@ Options to consider adding later: CheckName bool } -Misc: - ROADMAP (1 weeks): - build encoder (1 day) - build decoder (based off xmlParser) (1 day) @@ -303,78 +292,7 @@ ROADMAP (1 weeks): - integrate and TEST (1 days) - write article and post it (1 day) -// ---------- MORE NOTES FROM 2017-11-30 ------------ -when parsing -- parse the attributes first -- then parse the nodes - -basically: -- if encoding a field: we use the field name for the wrapper -- if encoding a non-field, then just use the element type name - - map[string]string ==> abcval... or - val... OR - val1val2... <- PREFERED - []string ==> v1v2... - string v1 ==> v1 - bool true ==> true - float 1.0 ==> 1.0 - ... - - F1 map[string]string ==> abcval... OR - val... OR - val... <- PREFERED - F2 []string ==> v1v2... - F3 bool ==> true - ... - -- a scalar is encoded as: - (value) of type T ==> - (value) of field F ==> -- A kv-pair is encoded as: - (key,value) ==> OR - (key,value) of field F ==> OR -- A map or struct is just a list of kv-pairs -- A list is encoded as sequences of same node e.g. - - - value21 - value22 -- we may have to singularize the field name, when entering into xml, - and pluralize them when encoding. -- bi-directional encode->decode->encode is not a MUST. - even encoding/xml cannot decode correctly what was encoded: - - see https://play.golang.org/p/224V_nyhMS - func main() { - fmt.Println("Hello, playground") - v := []interface{}{"hello", 1, true, nil, time.Now()} - s, err := xml.Marshal(v) - fmt.Printf("err: %v, \ns: %s\n", err, s) - var v2 []interface{} - err = xml.Unmarshal(s, &v2) - fmt.Printf("err: %v, \nv2: %v\n", err, v2) - type T struct { - V []interface{} - } - v3 := T{V: v} - s, err = xml.Marshal(v3) - fmt.Printf("err: %v, \ns: %s\n", err, s) - var v4 T - err = xml.Unmarshal(s, &v4) - fmt.Printf("err: %v, \nv4: %v\n", err, v4) - } - Output: - err: , - s: hello1true - err: , - v2: [] - err: , - s: hello1true2009-11-10T23:00:00Z - err: , - v4: {[ ]} -- */ // ----------- PARSER ------------------- @@ -501,7 +419,7 @@ func (h *XMLHandle) newDecDriver(d *Decoder) decDriver { } func (h *XMLHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) { - return h.SetExt(rt, tag, &extWrapper{bytesExtFailer{}, ext}) + return h.SetExt(rt, tag, &setExtWrapper{i: ext}) } var _ decDriver = (*xmlDecDriver)(nil) diff --git a/vendor/github.com/ugorji/go/codec/z.go b/vendor/github.com/ugorji/go/codec/z.go new file mode 100644 index 00000000..b6ac0769 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/z.go @@ -0,0 +1,23 @@ +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +package codec + +import "sort" + +// TODO: this is brittle, as it depends on z.go's init() being called last. +// The current build tools all honor that files are passed in lexical order. +// However, we should consider using an init_channel, +// that each person doing init will write to. + +func init() { + if !useLookupRecognizedTypes { + return + } + sort.Sort(uintptrSlice(recognizedRtids)) + sort.Sort(uintptrSlice(recognizedRtidPtrs)) + recognizedRtidOrPtrs = make([]uintptr, len(recognizedRtids)+len(recognizedRtidPtrs)) + copy(recognizedRtidOrPtrs, recognizedRtids) + copy(recognizedRtidOrPtrs[len(recognizedRtids):], recognizedRtidPtrs) + sort.Sort(uintptrSlice(recognizedRtidOrPtrs)) +} diff --git a/vendor/github.com/ugorji/go/msgpack.org.md b/vendor/github.com/ugorji/go/msgpack.org.md new file mode 100644 index 00000000..d5ebe71d --- /dev/null +++ b/vendor/github.com/ugorji/go/msgpack.org.md @@ -0,0 +1,47 @@ +**MessagePack and [Binc](http://github.com/ugorji/binc) Codec for [Go](http://golang.org) Language.** + +*A High Performance, Feature-Rich, Idiomatic encode/decode and rpc library*. + +To install: + + go get github.com/ugorji/go/codec + +Source: [http://github.com/ugorji/go] +Online documentation: [http://godoc.org/github.com/ugorji/go/codec] + +Typical usage: + +```go + // create and use decoder/encoder + var ( + v interface{} // value to decode/encode into + r io.Reader + w io.Writer + b []byte + mh codec.MsgpackHandle + ) + + dec = codec.NewDecoder(r, &mh) + dec = codec.NewDecoderBytes(b, &mh) + err = dec.Decode(&v) + + enc = codec.NewEncoder(w, &mh) + enc = codec.NewEncoderBytes(&b, &mh) + 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) +```