fast-path.generated.go 156 KB

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