diff --git a/.beads/interactions.jsonl b/.beads/interactions.jsonl index 3c9fa44e8b02f428d092d0967738f6bb099a2343..911d8e66fbe94bcfebd27f25ef74c97faf7e038c 100644 --- a/.beads/interactions.jsonl +++ b/.beads/interactions.jsonl @@ -37,3 +37,4 @@ {"id":"int-a631a4f9","kind":"field_change","created_at":"2026-05-23T20:13:43.682922Z","actor":"Eugene Blikh","issue_id":"tarantool-protobuf-74c","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Phase-2 EmmyLua annotations landed. Added ---@param/---@return on public surface of codec.lua (encode_message/decode_message/encode_field/compile_writers/compile_readers/merge_message), grpc.lua (loopback/multiplex/new_stream_pair/wrap_call/wrap_server_stream/wrap_server_view), json.lua (M.encode/M.decode with new pb.JsonEncodeOpts/pb.JsonDecodeOpts shapes), and wkt.lua (register/lookup/any_pack/any_unpack). Also corrected two pre-existing _types.lua signature lies: pb.register is (desc), not (full_name, desc); pb.any.pack is (desc, t, prefix?), not (t, type_url). just test 752/752, just test-c 1043/1043."}} {"id":"int-37f11812","kind":"field_change","created_at":"2026-05-23T20:48:32.931008Z","actor":"Eugene Blikh","issue_id":"tarantool-protobuf-a6n","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Inlined 1-byte LEN fast path for string/bytes scalar + repeated fields in generated full-mode _decode; skips wire.decode_string/_bytes function call frame and inlines utf8_len. Dropped the U8CP cast-at-top idea — 24B/decode cdata allocation that LuaJIT couldn't sink, regressed small messages. Person_decode full: 10B -6.9%, 100B -7.2%, 1KB -10.7%, 10KB -12.2%, 100KB -14.0%. Zero alloc impact. Tests: 1043 pass, 37 JIT trace checks pass."}} {"id":"int-1ae608c3","kind":"field_change","created_at":"2026-05-24T04:20:10.628185Z","actor":"Eugene Blikh","issue_id":"tarantool-protobuf-bgu","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Spike (bench/c_accel/bgu_probe.lua, removed) measured ffi.string vs buf:sub for the 1-byte LEN string fast path on Tarantool 3.8.0/LuaJIT 2.1.0-beta3 / Apple M-series. Results (ns/call):\n\n size buf:sub per-call-cast amortized/26 amortized/4\n 10B 89.7 280.5 (3.1x) 224.9 (2.5x) 246.2 (2.7x)\n 32B 107.6 299.4 (2.8x) 243.8 (2.3x) 260.9 (2.4x)\n 80B 154.3 362.4 (2.3x) 300.1 (1.9x) 314.9 (2.0x)\n\nV1 (per-call ffi.cast(U8CP, buf) inside decode_string): 2.3-3.1x slower.\nV2 (cast hoisted to caller, threaded as ptr arg, amortized over 26 emails — the Person 1KB peak shape): still 1.9-2.5x slower. Cast-once-amortize-many fails because 'ptr + np - 1' mints a fresh cdata wrapper per call that the JIT cannot sink across the decode_string frame — same root cause as a6n's failed top-of-_decode cast. The amortization helps a little (V2 < V1) but does not close the gap.\n\nConclusion: bgu's premise (ffi.string lets the JIT fuse the string read with surrounding code) does not hold on the current LuaJIT fork — the cdata allocation cost dominates any reduction in dispatch. Closing as superseded by a6n-decode-inline-len-fast-path-2026-05-23. Revival criteria: a measurable cdata-sink win on a future LuaJIT (likely needs upstream allocation-sink improvements for pointer-arith cdata), OR an API redesign where the decoder works on a cdata buffer end-to-end (not a Lua string)."}} {"id":"int-9713dfd3","kind":"field_change","created_at":"2026-05-24T04:30:26.987394Z","actor":"Eugene Blikh","issue_id":"tarantool-protobuf-4ql","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Spike (bench/c_accel/ibuf_probe.lua, removed) implemented a hand-coded Person_encode_ibuf mirroring what protoc-gen-tarantool would emit: stable pre-allocated cdata scratch buffer, direct p[i] byte writes, single-pass with backpatched length for nested Address + packed lucky_numbers, ffi.copy(p+i, lua_str, n) for strings. Same-byte correctness verified across 10B/100B/1KB/10KB.\n\nBench (ns/op, Tarantool 3.8.0 / Apple M-series), Person_encode vs ibuf scratch-only:\n\n size Person_encode ibuf scratch ibuf+ffi.string speedup\n 10B 462.8 239.1 273.7 1.69x (win)\n 100B 470.1 243.1 286.3 1.64x (win)\n 1KB 3693.8 4872.6 5141.6 0.72x (loss)\n 10KB 17146 42807 43023 0.40x (loss)\n 100KB 159081 422510 432701 0.37x (loss)\n\nCrossover ~26 emails. Root cause: each email pays an ffi.copy(p+i, lua_str, n) boundary (~50 ns/call). At 26 emails = ~1.3 us pure boundary; at 2800 emails (100KB) = ~140 us pure boundary. Meanwhile Person_encode appends Lua-string refs to an out table (no FFI boundary) and pays ONE bulk table.concat memcpy at the end regardless of count. Per-field boundary work beats per-message bulk work only when field count is very small.\n\nFor 4ql's stated use case (net.box send path), typical Tarantool RPC payloads are >=1 KB — exactly the regression zone (1.4-2.7x slower). Win window (<100B) is too narrow to justify a separate API surface, especially since pb.encode is already 462-470ns at that size — saving 200ns on a sub-microsecond operation is not a meaningful net.box gain.\n\nThree abandoned attempts now (per-byte b:alloc cliff, v2 two-pass bulk reserve, this single-pass backpatch). All hit the same per-field FFI boundary tax. Closing as 'not viable on current LuaJIT'. REVIVAL CRITERIA: a future LuaJIT that can sink FFI calls into traces (so per-field ffi.copy stops paying the boundary cost), OR a use case where caller passes pre-cdata-cast strings (no per-email lua-string -> cdata copy), OR a hand-written C encoder behind the c_runtime FFI surface (different path entirely — see c0i)."}} +{"id":"int-a5091fea","kind":"field_change","created_at":"2026-05-24T05:40:24.477555Z","actor":"Eugene Blikh","issue_id":"tarantool-protobuf-kot","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}} diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index 90d75555244b781929e84b2377cfac0cef91eb26..8590808fa5d68f21befe77fe7dcb434e3351e067 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -28,7 +28,7 @@ {"_type":"issue","id":"tarantool-protobuf-ch2","title":"Encoder: JIT-friendly map\u003cK,V\u003e field iteration (avoid pairs() ISNEXT NYI)","description":"map\u003cK,V\u003e field encoding walks the user-supplied table with pairs() — runtime/pb/codec.lua:162 and every codegen-emitted map block in mode=full. pairs() over a hash compiles to bytecode ISNEXT which is NYI in the LuaJIT 2.1 fork Tarantool ships, so map-field encoders trace-abort and fall to interpreter every call. bench/jit_trace.lua already pins this as the only intentional NYI in the hot path.\n\nUnlike oneofs/extensions (which are flattened to *_list arrays at finalize-time in init.lua), map *values* are user data — there's no finalize-time hook to flatten them. The encode-time fix: collect keys into a scratch array, then iterate with ipairs/numeric-for. Pattern:\n\n local _mkeys, _mn = {}, 0\n for k in pairs(value) do _mn = _mn + 1; _mkeys[_mn] = k end\n for _i = 1, _mn do\n local k = _mkeys[_i]\n local v = value[k]\n -- emit entry as today\n end\n\nCosts one extra alloc (scratch keys table) per map field per call but lets the inner emit-loop stay on a JIT trace. For maps with \u003e3 entries the trace-stable inner loop should net out positive. For very small maps (1-2 entries) the wrapper may regress — measure and possibly emit a special-case branch for the 1-entry case.\n\nPairs naturally with x9f (deterministic map option) — when on, the scratch keys array can be sorted, giving deterministic output for free vs the current pairs()-order-undefined behavior. Also opens the door for the x9f decision since the iteration shape changes regardless.","notes":"Generated code lives in protoc-gen-tarantool. Both runtime mode (codec.lua encode_field map branch) and full mode (codegen-emitted map blocks in *_pb.lua) need updating. Bench fixture: hello.Person has 3 map fields (ages_by_nickname, nickname_by_age, addresses_by_label) but the current build_person_payload doesn't populate them — would need a map-heavy fixture in bench.lua to measure the win.","status":"open","priority":2,"issue_type":"task","owner":"bigbes@gmail.com","created_at":"2026-05-18T17:13:53Z","created_by":"Eugene Blikh","updated_at":"2026-05-18T17:13:53Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"tarantool-protobuf-cch","title":"Decoder: use local counter instead of #list at repeated-field append","description":"jit.p profile (Person 1KB): line 1021 'list[#list + 1] = val' is 6.2% of total decode time. Each #list invocation re-traverses to find the array length. Fix: emit a local counter alongside the list table at codegen time — list_n = list_n + 1; list[list_n] = val. Already done on encode side ('out, n' pattern). Tiny 1-line codegen change. Bench reference: 26-emails Person decode is dominated by this exact pattern repeating 26x.","notes":"At decode start, when initializing a repeated-field list, also init the counter: 'local emails, emails_n = result.emails, #(result.emails or {}) ' — for the first-encounter case, counter starts at 0. Need to handle the case where the same field id is encountered out-of-order (must continue the existing counter).","status":"closed","priority":2,"issue_type":"task","assignee":"Eugene Blikh","owner":"bigbes@gmail.com","created_at":"2026-05-18T16:52:38Z","created_by":"Eugene Blikh","updated_at":"2026-05-18T19:01:17Z","started_at":"2026-05-18T18:56:39Z","closed_at":"2026-05-18T19:01:17Z","close_reason":"Local counter per repeated non-map field; median-of-3 decode wins +5.0% (1KB), +5.0% (10KB), +7.1% (100KB). Profile target was 6.2%; landed wins of 5-7%. Encode flat, runtime flat. 745/745 tests, 37/37 JIT. See bench/PERF_LOG.md.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"tarantool-protobuf-a6n","title":"Decoder: ffi-cast buffer ptr once per decode; replace buf:byte/buf:sub at fast paths","description":"Decode hot path uses buf:byte(pos) and buf:sub(start, end-1) — both are method calls dispatched via the string metatable per invocation. Wire.lua already has U8CP = ffi.typeof('const uint8_t*'). The fix: at the top of each generated Type_decode, cast once (local ptr = ffi.cast(U8CP, buf)) and use ptr[pos-1] for byte reads. For string returns, keep buf:sub (or use ffi.string per bgu issue) since the result must be a Lua string. Removes one C function call dispatch per byte read in the tag decoder fast path — Person_decode has 26-element repeated string fields where this multiplies. Compatible with bgu (the ffi.string change for decode_string) — both rely on the same cast.","notes":"Caveat: ffi.cast holds the string pinned. Lua string is GC'd by reference count and the cast'd ptr keeps a stack reference, so GC behavior is correct. Watch for the case where buf is a sub-string from a parent message decode — the parent's cast must dominate the lifetime. Easy fix: each Type_decode re-casts the buf it owns.","status":"closed","priority":2,"issue_type":"task","assignee":"Eugene Blikh","owner":"bigbes@gmail.com","created_at":"2026-05-18T16:51:24Z","created_by":"Eugene Blikh","updated_at":"2026-05-23T20:48:33Z","started_at":"2026-05-23T20:34:10Z","closed_at":"2026-05-23T20:48:33Z","close_reason":"Inlined 1-byte LEN fast path for string/bytes scalar + repeated fields in generated full-mode _decode; skips wire.decode_string/_bytes function call frame and inlines utf8_len. Dropped the U8CP cast-at-top idea — 24B/decode cdata allocation that LuaJIT couldn't sink, regressed small messages. Person_decode full: 10B -6.9%, 100B -7.2%, 1KB -10.7%, 10KB -12.2%, 100KB -14.0%. Zero alloc impact. Tests: 1043 pass, 37 JIT trace checks pass.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"tarantool-protobuf-6bb","title":"Decoder: opt-in skip_utf8_validation flag for trusted sources","description":"decode_string runs utf8_len (ICU) on every decoded string. Per the proto3 spec it's required, but for internal RPC where producer and consumer share the same library, validation is duplicate work. Add an opt-in flag (per-call or per-descriptor) that swaps decode_string to the decode_bytes fast path. Use case: re-decoding our own encoded output (text/json round-trips, copy operations, internal pipelines). For string-heavy 1KB Person (26 emails), wire_bench numbers suggest utf8_len is 8-15% of decode time. Must not change the default behavior — conformance suite requires validation.","notes":"Plumbing options: pb.decode(desc, buf, {validate_utf8=false}), or a TrustedPerson_decode(buf) codegen variant, or thread-local pb.set_validate_utf8(false). Per-call is cleanest API but adds branch cost; codegen variant has zero per-call cost but doubles generated code. Per-descriptor (desc.skip_validation) is a middle ground. Decide during implementation.","status":"open","priority":2,"issue_type":"task","owner":"bigbes@gmail.com","created_at":"2026-05-18T16:51:23Z","created_by":"Eugene Blikh","updated_at":"2026-05-18T16:58:51Z","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"tarantool-protobuf-kot","title":"Codegen: localize wire.* upvalues at top of each generated message function","description":"examples/expected/full/hello/hello_pb.lua has 106 wire.* accesses — each is a hash-table lookup on the upvalue. LuaJIT hoists this when traces stay hot, but every nested-message boundary breaks the trace (see gcy notes), forcing re-lookup in the side trace / interpreter. Fix: codegen-emit at the top of each Type_encode and Type_decode function the locals it actually uses — only for the wire.* entries referenced in that function body — so the in-body calls are direct LJ_FUNCC dispatches with no table lookup. One-line codegen change; broad impact whenever traces stitch poorly. Pairs naturally with h8v and 4kj (both move more work into the same generated function bodies, magnifying the per-call lookup cost). Expected: 3-8% across the board; larger when traces break.","notes":"Codegen-side change in the Go plugin (protoc-gen-tarantool). Pre-compute the set of wire.* symbols used in each function (e.g., {encode_varint, decode_string, decode_tag}) and emit 'local encode_varint = wire.encode_varint' style preambles. Keep the existing 'local wire = pb.wire' so non-emitted entries still work. Verify with bench/jit_trace.lua that we don't increase trace size past LuaJIT inline budget on large messages (test_messages_proto3 is 4212 lines).","status":"open","priority":2,"issue_type":"task","owner":"bigbes@gmail.com","created_at":"2026-05-18T16:51:23Z","created_by":"Eugene Blikh","updated_at":"2026-05-18T16:51:23Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"tarantool-protobuf-kot","title":"Codegen: localize wire.* upvalues at top of each generated message function","description":"examples/expected/full/hello/hello_pb.lua has 106 wire.* accesses — each is a hash-table lookup on the upvalue. LuaJIT hoists this when traces stay hot, but every nested-message boundary breaks the trace (see gcy notes), forcing re-lookup in the side trace / interpreter. Fix: codegen-emit at the top of each Type_encode and Type_decode function the locals it actually uses — only for the wire.* entries referenced in that function body — so the in-body calls are direct LJ_FUNCC dispatches with no table lookup. One-line codegen change; broad impact whenever traces stitch poorly. Pairs naturally with h8v and 4kj (both move more work into the same generated function bodies, magnifying the per-call lookup cost). Expected: 3-8% across the board; larger when traces break.","notes":"Codegen-side change in the Go plugin (protoc-gen-tarantool). Pre-compute the set of wire.* symbols used in each function (e.g., {encode_varint, decode_string, decode_tag}) and emit 'local encode_varint = wire.encode_varint' style preambles. Keep the existing 'local wire = pb.wire' so non-emitted entries still work. Verify with bench/jit_trace.lua that we don't increase trace size past LuaJIT inline budget on large messages (test_messages_proto3 is 4212 lines).","status":"in_progress","priority":2,"issue_type":"task","assignee":"Eugene Blikh","owner":"bigbes@gmail.com","created_at":"2026-05-18T16:51:23Z","created_by":"Eugene Blikh","updated_at":"2026-05-24T04:41:18Z","started_at":"2026-05-24T04:41:18Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"tarantool-protobuf-lkz","title":"Encoder: single-pass two-phase (size + emit) into single buffer","description":"Eliminate the per-call out table and the per-field intermediate string allocations by emitting once into a pre-sized buffer. Two viable shapes (per drm notes):\n\n1. Two-pass: walk fields once to compute exact size, allocate one buffer, walk again to emit. Mirrors vtproto's Size()+MarshalTo() pattern — vtproto's 1-alloc encode is what gives it 13-20x throughput over us at 1KB-10KB Person.\n2. Single-pass with backpatched length varints: write tag + 1-byte placeholder for the length, recurse, fill in (memmove if final length \u003e= 128). Skips the size pass (~3 us at 1KB).\n\nImplementation can live in codegen (mode=full) — emit a _encode_to_buf per message that takes (data, ibuf, offset) and returns new_offset, then a public Person_encode that wraps it with the buffer allocation. Constraint: per-field closure count must stay \u003c= current pb.encode writers count, else the per-field dispatch cost re-emerges (drm: two prior ibuf prototypes both regressed by ~2x because of dispatch).\n\nRelates to h8v (codegen FFI direct writes) which is the per-field building block this work composes.","notes":"drm notes have the deeper analysis including why M6 ibuf path naive byte-write fails (20x interpreter dispatch overhead). The codegen approach sidesteps that by inlining all writes at codegen time so there's no runtime closure dispatch.","status":"open","priority":2,"issue_type":"task","owner":"bigbes@gmail.com","created_at":"2026-05-18T16:49:16Z","created_by":"Eugene Blikh","updated_at":"2026-05-18T16:49:16Z","dependencies":[{"issue_id":"tarantool-protobuf-lkz","depends_on_id":"tarantool-protobuf-h8v","type":"blocks","created_at":"2026-05-18T19:49:21Z","created_by":"Eugene Blikh","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"tarantool-protobuf-2sn","title":"Decoder: emit table.new(N, 0) for repeated-field lists","description":"Decode result table rehashes as nested fields populate. u39 covers table.new(0, N) for the message table itself, but per-field list tables (result.emails = {}, result.lucky_numbers = {}, ...) are also bare {} and re-hash as they grow. Worth a follow-up: emit table.new(N, 0) for repeated lists where the encoded count is recoverable from a single quick scan (count tag occurrences for non-packed, or read the LEN prefix and divide by per-element size for packed). Quick scan cost vs allocation savings is the tradeoff to measure — on the 1KB Person fixture, 26 emails + 5 packed lucky_numbers means 2 re-hash cycles per repeated list. Pairs with u39 to fully close the rehash-on-grow alloc pattern.","notes":"See bench/COMPARISON.md and bd show drm. For packed scalars where per-element size is fixed (fixed32/fixed64/float/double), count = payload_len / elem_size — O(1). For varint-packed and non-packed repeated, count requires a scan; might still be net-positive on payloads with \u003e8 elements but needs measurement.","status":"open","priority":2,"issue_type":"task","owner":"bigbes@gmail.com","created_at":"2026-05-18T16:49:15Z","created_by":"Eugene Blikh","updated_at":"2026-05-18T16:49:15Z","dependencies":[{"issue_id":"tarantool-protobuf-2sn","depends_on_id":"tarantool-protobuf-u39","type":"blocks","created_at":"2026-05-18T19:49:20Z","created_by":"Eugene Blikh","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"tarantool-protobuf-2nl","title":"Repo: unstealth Beads tracking files","description":"Make the repo-local Beads state visible to Git by removing the local .git/info/exclude rule for .beads/. Keep .beads/.gitignore in charge of excluding embedded DB/runtime files so only portable issue-tracking files are committed.","status":"closed","priority":2,"issue_type":"task","owner":"bigbes@gmail.com","created_at":"2026-05-17T18:39:50Z","created_by":"Eugene Blikh","updated_at":"2026-05-17T18:42:26Z","closed_at":"2026-05-17T18:42:26Z","close_reason":"Removed the local .git/info/exclude rule that hid .beads/ from Git. Portable .beads files now show as untracked; runtime DB/backup/export files remain ignored by .beads/.gitignore.","dependency_count":0,"dependent_count":0,"comment_count":0} diff --git a/cmd/protoc-gen-tarantool/internal/gen/gen.go b/cmd/protoc-gen-tarantool/internal/gen/gen.go index a6861eff4374f29d42808d343ad888b30e7c733a..9055f2dda8841608cdaf8f1d92f2affbff442c24 100644 --- a/cmd/protoc-gen-tarantool/internal/gen/gen.go +++ b/cmd/protoc-gen-tarantool/internal/gen/gen.go @@ -145,14 +145,37 @@ *protogen.GeneratedFile // opts re-links *Options messages so in-file extensions surface via the // generic walker — see optionsResolver in descopts.go. opts *optionsResolver + // buf, when non-nil, captures line() output instead of writing it + // straight to the GeneratedFile. captureLines sets/restores it; used by + // emitInlineEncode/Decode to scan a function body for wire.* refs and + // rewrite them to bare locals. + buf *[]string } func (w *writer) line(format string, args ...any) { + var s string if len(args) == 0 { - w.P(format) + s = format } else { - w.P(fmt.Sprintf(format, args...)) + s = fmt.Sprintf(format, args...) + } + if w.buf != nil { + *w.buf = append(*w.buf, s) + return } + w.P(s) +} + +// captureLines runs fn while diverting w.line() output to a buffer, +// returning the captured lines and restoring the previous output mode. +// Nested calls stack correctly via the saved buf pointer. +func (w *writer) captureLines(fn func()) []string { + var buf []string + prev := w.buf + w.buf = &buf + fn() + w.buf = prev + return buf } // renderOpts is the writer-bound shortcut for rendering a descriptor's diff --git a/cmd/protoc-gen-tarantool/internal/gen/inline.go b/cmd/protoc-gen-tarantool/internal/gen/inline.go index 8a0182266237309d26d1f082904a1af5d0ef5eb7..6420e7f2c86e2cecebeecd4ae6410f5296d8590f 100644 --- a/cmd/protoc-gen-tarantool/internal/gen/inline.go +++ b/cmd/protoc-gen-tarantool/internal/gen/inline.go @@ -2,12 +2,87 @@ package gen import ( "fmt" + "regexp" + "sort" "strings" "google.golang.org/protobuf/compiler/protogen" "google.golang.org/protobuf/reflect/protoreflect" ) +// wireRefRe matches `wire.` references inside generated function +// bodies. Generated code never embeds `wire.` inside a string literal, so a +// straight textual sweep is safe here. (Verified: error messages mention +// "wire type" with a space, no dot.) +var wireRefRe = regexp.MustCompile(`\bwire\.([A-Za-z_][A-Za-z0-9_]*)`) + +// localizeWireRefs scans `body` for `wire.` references and, for any +// name that appears at least `minUses` times, returns it (sorted) and +// rewrites those occurrences in `body` to the bare name. Caller is +// responsible for emitting `local = wire.` lines for the +// returned refs before flushing the body. Names that occur fewer than +// `minUses` times are left as `wire.` so we don't pay a prelude +// TGETS on every call to save a single in-body lookup. +// +// Why: each `wire.X` access is a hash lookup on the `wire` upvalue. +// LuaJIT hoists it when traces stay hot, but every nested-message +// boundary breaks the trace and re-pays the lookup in the side trace / +// interpreter. Localizing turns each in-body call into a bare local read +// with no table indirection — `kot` in bd. Measured 35-50% improvements +// on scalar-heavy / packed_int32 workloads where wire.* dominates the +// inner loop; the single-use guard prevents a regression on sparse +// small-message decode where the prelude cost outweighs the in-body +// savings. +func localizeWireRefs(body []string, minUses int) (refs []string, rewritten []string) { + count := map[string]int{} + for _, ln := range body { + for _, m := range wireRefRe.FindAllStringSubmatch(ln, -1) { + count[m[1]]++ + } + } + keep := map[string]struct{}{} + for n, c := range count { + if c >= minUses { + keep[n] = struct{}{} + } + } + if len(keep) == 0 { + return nil, body + } + refs = make([]string, 0, len(keep)) + for n := range keep { + refs = append(refs, n) + } + sort.Strings(refs) + // Only rewrite the kept names; one-shot refs stay as `wire.X` so we + // don't end up referring to a local that was never declared. + keepRe := regexp.MustCompile(`\bwire\.(` + strings.Join(refs, "|") + `)\b`) + rewritten = make([]string, len(body)) + for i, ln := range body { + rewritten[i] = keepRe.ReplaceAllString(ln, "$1") + } + return refs, rewritten +} + +// emitLocalizedFunction emits the function header, the captured body with +// frequently-used wire.* references rewritten to bare locals (and the +// corresponding `local = wire.` preamble), and the closing +// `end` line. The `minUses` threshold of 2 means a wire ref needs at +// least one repeat use to be worth the prelude allocation. +func emitLocalizedFunction(w *writer, header string, bodyFn func()) { + body := w.captureLines(bodyFn) + refs, body := localizeWireRefs(body, 2) + w.line("%s", header) + for _, name := range refs { + w.line(" local %s = wire.%s", name, name) + } + for _, ln := range body { + w.P(ln) + } + w.line("end") + w.line("") +} + // emitInlineMessage emits per-message _new / _encode / _decode functions with // no descriptor dispatch. Tag bytes are precomputed as Lua string literals; // each scalar field's encode/decode call resolves to one wire. call. @@ -32,69 +107,68 @@ } func emitInlineEncode(w *writer, name string, m *protogen.Message, file *protogen.File, selfPath string, imports map[string]string, prefix string) { emitEmmyWrapperAnnotations(w, name, emmyMessageFullName(m), wrapperEncode) - w.line("function M.%s_encode(t)", name) - // C-acceleration: when PB_ENABLE_C=1 was set at module load, dispatch - // into pb.c_runtime.encode. Plan compilation is lazy on first call — - // eager compile would chase sub-message refs that aren't filled in - // yet when finalize_message runs at module load (see init.lua). On - // the default pure-Lua build pb.c_runtime is nil and the branch is a - // single nil-compare. - w.line(" local _d = M.%s_descriptor", name) - w.line(" if pb.c_runtime ~= nil then") - w.line(" local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)") - w.line(" return pb.c_runtime.encode(_p, t)") - w.line(" end") - w.line(" if type(t) ~= 'table' then") - w.line(" error(\"expected table for %s, got \" .. type(t), 0)", m.Desc.FullName()) - w.line(" end") - w.line(" local out, n = {}, 0") - w.line(" local v") + emitLocalizedFunction(w, fmt.Sprintf("function M.%s_encode(t)", name), func() { + // C-acceleration: when PB_ENABLE_C=1 was set at module load, dispatch + // into pb.c_runtime.encode. Plan compilation is lazy on first call — + // eager compile would chase sub-message refs that aren't filled in + // yet when finalize_message runs at module load (see init.lua). On + // the default pure-Lua build pb.c_runtime is nil and the branch is a + // single nil-compare. + w.line(" local _d = M.%s_descriptor", name) + w.line(" if pb.c_runtime ~= nil then") + w.line(" local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)") + w.line(" return pb.c_runtime.encode(_p, t)") + w.line(" end") + w.line(" if type(t) ~= 'table' then") + w.line(" error(\"expected table for %s, got \" .. type(t), 0)", m.Desc.FullName()) + w.line(" end") + w.line(" local out, n = {}, 0") + w.line(" local v") - // Oneof pre-pass: pick the active branch per oneof (last-set wins). - for _, oo := range realOneofs(m) { - w.line(" local %s", oneofVar(string(oo.Desc.Name()))) - for _, f := range oo.Fields { - w.line(" if %s ~= nil then %s = %q end", - luaFieldAccess("t", string(f.Desc.Name())), - oneofVar(string(oo.Desc.Name())), - string(f.Desc.Name())) + // Oneof pre-pass: pick the active branch per oneof (last-set wins). + for _, oo := range realOneofs(m) { + w.line(" local %s", oneofVar(string(oo.Desc.Name()))) + for _, f := range oo.Fields { + w.line(" if %s ~= nil then %s = %q end", + luaFieldAccess("t", string(f.Desc.Name())), + oneofVar(string(oo.Desc.Name())), + string(f.Desc.Name())) + } } - } - for _, f := range m.Fields { - emitInlineEncodeField(w, f, file, selfPath, imports, prefix) - } - // Proto2 extensions: delegate to pb.codec.encode_field once per set - // entry. We don't inline an extension-specific writer here because - // extensions are runtime-mutable — a user can register more after the - // module loads — so the canonical iteration source is the descriptor's - // extensions_list. The walk is JIT-stable (array, not pairs over a - // hash). Skip entirely when extensions_list is nil (most proto3 messages - // and proto2 messages without `extensions` ranges) so the hot path - // pays nothing. - w.line(" local _exts = t._extensions") - w.line(" if _exts ~= nil then") - w.line(" local _elist = M.%s_descriptor.extensions_list", name) - w.line(" if _elist ~= nil then") - w.line(" for _i = 1, #_elist do") - w.line(" local _ext = _elist[_i]") - w.line(" local _ev = _exts[_ext.full_name]") - w.line(" if _ev ~= nil then") - w.line(" pb.codec.encode_field(_ext, _ev, out, true)") - w.line(" end") - w.line(" end") - // encode_field uses out[#out + 1] = … and doesn't know about our - // local `n` cursor — resync so the unknown-fields append below lands - // after the extension bytes, not on top of them. - w.line(" n = #out") - w.line(" end") - w.line(" end") - // Preserve unknown fields captured at decode time. - w.line(" local _uf = t._unknown_fields") - w.line(" if _uf ~= nil and _uf ~= '' then n = n + 1; out[n] = _uf end") - w.line(" return table.concat(out)") - w.line("end") - w.line("") + for _, f := range m.Fields { + emitInlineEncodeField(w, f, file, selfPath, imports, prefix) + } + // Proto2 extensions: delegate to pb.codec.encode_field once per set + // entry. We don't inline an extension-specific writer here because + // extensions are runtime-mutable — a user can register more after the + // module loads — so the canonical iteration source is the descriptor's + // extensions_list. The walk is JIT-stable (array, not pairs over a + // hash). Skip entirely when extensions_list is nil (most proto3 messages + // and proto2 messages without `extensions` ranges) so the hot path + // pays nothing. + w.line(" local _exts = t._extensions") + w.line(" if _exts ~= nil then") + w.line(" local _elist = M.%s_descriptor.extensions_list", name) + w.line(" if _elist ~= nil then") + w.line(" for _i = 1, #_elist do") + w.line(" local _ext = _elist[_i]") + w.line(" local _ev = _exts[_ext.full_name]") + w.line(" if _ev ~= nil then") + w.line(" pb.codec.encode_field(_ext, _ev, out, true)") + w.line(" end") + w.line(" end") + // encode_field uses out[#out + 1] = … and doesn't know about our + // local `n` cursor — resync so the unknown-fields append below lands + // after the extension bytes, not on top of them. + w.line(" n = #out") + w.line(" end") + w.line(" end") + // Preserve unknown fields captured at decode time. + w.line(" local _uf = t._unknown_fields") + w.line(" if _uf ~= nil and _uf ~= '' then n = n + 1; out[n] = _uf end") + w.line(" return table.concat(out)") + }) } // emitInlineLenPrefix emits the length-prefix append for a length-delimited @@ -374,85 +448,84 @@ } func emitInlineDecode(w *writer, name string, m *protogen.Message, file *protogen.File, selfPath string, imports map[string]string, prefix string) { emitEmmyWrapperAnnotations(w, name, emmyMessageFullName(m), wrapperDecode) - w.line("function M.%s_decode(buf)", name) - // C-acceleration: see emitInlineEncode for rationale and lazy-compile. - w.line(" local _d = M.%s_descriptor", name) - w.line(" if pb.c_runtime ~= nil then") - w.line(" local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)") - w.line(" return pb.c_runtime.decode(_p, buf)") - w.line(" end") - w.line(" if type(buf) ~= 'string' then") - w.line(" error(\"expected string for %s decode, got \" .. type(buf), 0)", m.Desc.FullName()) - w.line(" end") - w.line(" local result = {}") - w.line(" local pos, len = 1, #buf") - w.line(" local _uf") - // Per-repeated-field counters. Replace `#list + 1` (re-traverses - // the list every append) with `_n_ = _n_ + 1`. The - // counter survives across loop iterations, so out-of-order wire - // entries for the same field continue counting from the existing - // position without re-scanning. Map fields don't need a counter - // (hash keys, not array indices). - for _, f := range m.Fields { - if f.Desc.IsList() && !f.Desc.IsMap() { - w.line(" local _n_%s = 0", string(f.Desc.Name())) + emitLocalizedFunction(w, fmt.Sprintf("function M.%s_decode(buf)", name), func() { + // C-acceleration: see emitInlineEncode for rationale and lazy-compile. + w.line(" local _d = M.%s_descriptor", name) + w.line(" if pb.c_runtime ~= nil then") + w.line(" local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)") + w.line(" return pb.c_runtime.decode(_p, buf)") + w.line(" end") + w.line(" if type(buf) ~= 'string' then") + w.line(" error(\"expected string for %s decode, got \" .. type(buf), 0)", m.Desc.FullName()) + w.line(" end") + w.line(" local result = {}") + w.line(" local pos, len = 1, #buf") + w.line(" local _uf") + // Per-repeated-field counters. Replace `#list + 1` (re-traverses + // the list every append) with `_n_ = _n_ + 1`. The + // counter survives across loop iterations, so out-of-order wire + // entries for the same field continue counting from the existing + // position without re-scanning. Map fields don't need a counter + // (hash keys, not array indices). + for _, f := range m.Fields { + if f.Desc.IsList() && !f.Desc.IsMap() { + w.line(" local _n_%s = 0", string(f.Desc.Name())) + } } - } - w.line(" while pos <= len do") - w.line(" local _tag_start = pos") - w.line(" local id, wt") - // Inline the 1-byte tag fast path. The protobuf spec encodes field - // numbers 1..15 (with any wire type) in a single byte, and the - // codegen orderings + our test corpora keep nearly every dispatch - // here on the fast branch. Removes the wire.decode_tag function - // frame for the dominant case; multi-byte tags fall back to the - // generic decoder. - w.line(" local _b = string_byte(buf, pos)") - w.line(" if _b ~= nil and _b < 0x80 then") - w.line(" wt = band(_b, 7)") - w.line(" if wt >= 6 then error(\"illegal wire type \" .. wt, 0) end") - w.line(" id = rshift(_b, 3)") - w.line(" if id == 0 then error(\"illegal field number 0\", 0) end") - w.line(" pos = pos + 1") - w.line(" else") - w.line(" id, wt, pos = wire.decode_tag(buf, pos)") - w.line(" end") + w.line(" while pos <= len do") + w.line(" local _tag_start = pos") + w.line(" local id, wt") + // Inline the 1-byte tag fast path. The protobuf spec encodes field + // numbers 1..15 (with any wire type) in a single byte, and the + // codegen orderings + our test corpora keep nearly every dispatch + // here on the fast branch. Removes the wire.decode_tag function + // frame for the dominant case; multi-byte tags fall back to the + // generic decoder. + w.line(" local _b = string_byte(buf, pos)") + w.line(" if _b ~= nil and _b < 0x80 then") + w.line(" wt = band(_b, 7)") + w.line(" if wt >= 6 then error(\"illegal wire type \" .. wt, 0) end") + w.line(" id = rshift(_b, 3)") + w.line(" if id == 0 then error(\"illegal field number 0\", 0) end") + w.line(" pos = pos + 1") + w.line(" else") + w.line(" id, wt, pos = wire.decode_tag(buf, pos)") + w.line(" end") - first := true - for _, f := range m.Fields { - op := "elseif" + first := true + for _, f := range m.Fields { + op := "elseif" + if first { + op = "if" + first = false + } + w.line(" %s id == %d then", op, f.Desc.Number()) + emitInlineDecodeFieldBody(w, f, file, selfPath, imports, prefix) + } if first { - op = "if" - first = false + // No fields — every wire byte is unknown. + w.line(" if true then") } - w.line(" %s id == %d then", op, f.Desc.Number()) - emitInlineDecodeFieldBody(w, f, file, selfPath, imports, prefix) - } - if first { - // No fields — every wire byte is unknown. - w.line(" if true then") - } - w.line(" else") - // Proto2 extensions: an unknown tag may belong to a registered - // extension on this descriptor. Route through pb.codec's - // decode_extension which mirrors the in-line dispatch on field - // kind (scalar/enum/message/group, singular/repeated) and stores - // into result._extensions[full_name]. - w.line(" local _ebid = M.%s_descriptor.extensions_by_id", name) - w.line(" local _ext = _ebid and _ebid[id] or nil") - w.line(" if _ext ~= nil then") - w.line(" pos = pb.codec.decode_extension(_ext, buf, pos, wt, result)") - w.line(" else") - w.line(" pos = wire.skip_field(buf, pos, wt, id)") - w.line(" if _uf == nil then _uf = {} end") - w.line(" _uf[#_uf + 1] = buf:sub(_tag_start, pos - 1)") - w.line(" end") - w.line(" end") - w.line(" end") - w.line(" if _uf ~= nil then result._unknown_fields = table.concat(_uf) end") - w.line(" return result") - w.line("end") - w.line("") + w.line(" else") + // Proto2 extensions: an unknown tag may belong to a registered + // extension on this descriptor. Route through pb.codec's + // decode_extension which mirrors the in-line dispatch on field + // kind (scalar/enum/message/group, singular/repeated) and stores + // into result._extensions[full_name]. + w.line(" local _ebid = M.%s_descriptor.extensions_by_id", name) + w.line(" local _ext = _ebid and _ebid[id] or nil") + w.line(" if _ext ~= nil then") + w.line(" pos = pb.codec.decode_extension(_ext, buf, pos, wt, result)") + w.line(" else") + w.line(" pos = wire.skip_field(buf, pos, wt, id)") + w.line(" if _uf == nil then _uf = {} end") + w.line(" _uf[#_uf + 1] = buf:sub(_tag_start, pos - 1)") + w.line(" end") + w.line(" end") + w.line(" end") + w.line(" if _uf ~= nil then result._unknown_fields = table.concat(_uf) end") + w.line(" return result") + }) } func emitInlineDecodeFieldBody(w *writer, f *protogen.Field, file *protogen.File, selfPath string, imports map[string]string, prefix string) { diff --git a/examples/expected/full/c_repeated/c_repeated_pb.lua b/examples/expected/full/c_repeated/c_repeated_pb.lua index f3c3bc2d561083f1037e9e4da3ca376d5d03d655..f713e954563561b52b7184f3268978cbaba8fdf7 100644 --- a/examples/expected/full/c_repeated/c_repeated_pb.lua +++ b/examples/expected/full/c_repeated/c_repeated_pb.lua @@ -221,6 +221,10 @@ ---@param t c_repeated.Holder ---@return string function M.Holder_encode(t) + local encode_fixed64 = wire.encode_fixed64 + local encode_int32 = wire.encode_int32 + local encode_sint32 = wire.encode_sint32 + local encode_varint = wire.encode_varint local _d = M.Holder_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -236,7 +240,7 @@ v = t.packed_int32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_int32(v[_i]) + m = m + 1; parts[m] = encode_int32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x0a" @@ -244,7 +248,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -261,7 +265,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -270,7 +274,7 @@ v = t.packed_sint32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_sint32(v[_i]) + m = m + 1; parts[m] = encode_sint32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x1a" @@ -278,7 +282,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -295,7 +299,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -312,7 +316,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -321,7 +325,7 @@ v = t.packed_fixed64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_fixed64(v[_i]) + m = m + 1; parts[m] = encode_fixed64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x32" @@ -329,7 +333,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -346,7 +350,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -363,7 +367,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -380,7 +384,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -390,7 +394,7 @@ if v ~= nil and #v > 0 then local _tag = "\xa0\x01" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_int32(v[_i]) + n = n + 1; out[n] = encode_int32(v[_i]) end end -- field 21: unpacked_fixed64 @@ -399,7 +403,7 @@ if v ~= nil and #v > 0 then local _tag = "\xa9\x01" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_fixed64(v[_i]) + n = n + 1; out[n] = encode_fixed64(v[_i]) end end -- field 22: unpacked_sint32 @@ -408,7 +412,7 @@ if v ~= nil and #v > 0 then local _tag = "\xb0\x01" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_sint32(v[_i]) + n = n + 1; out[n] = encode_sint32(v[_i]) end end -- field 30: strings @@ -422,7 +426,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -438,7 +442,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -454,7 +458,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -481,6 +485,16 @@ ---@param b string ---@return c_repeated.Holder function M.Holder_decode(buf) + local decode_bool = wire.decode_bool + local decode_double = wire.decode_double + local decode_fixed32 = wire.decode_fixed32 + local decode_fixed64 = wire.decode_fixed64 + local decode_float = wire.decode_float + local decode_int32 = wire.decode_int32 + local decode_int64 = wire.decode_int64 + local decode_len = wire.decode_len + local decode_sint32 = wire.decode_sint32 + local decode_uint32 = wire.decode_uint32 local _d = M.Holder_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -525,16 +539,16 @@ local list = result.packed_int32 if list == nil then list = {}; result.packed_int32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_packed_int32 = _n_packed_int32 + 1; list[_n_packed_int32] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_packed_int32 = _n_packed_int32 + 1; list[_n_packed_int32] = val end elseif id == 2 then @@ -542,16 +556,16 @@ local list = result.packed_int64 if list == nil then list = {}; result.packed_int64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int64(payload, p2) + val, p2 = decode_int64(payload, p2) _n_packed_int64 = _n_packed_int64 + 1; list[_n_packed_int64] = val end else local val - val, pos = wire.decode_int64(buf, pos) + val, pos = decode_int64(buf, pos) _n_packed_int64 = _n_packed_int64 + 1; list[_n_packed_int64] = val end elseif id == 3 then @@ -559,16 +573,16 @@ local list = result.packed_sint32 if list == nil then list = {}; result.packed_sint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint32(payload, p2) + val, p2 = decode_sint32(payload, p2) _n_packed_sint32 = _n_packed_sint32 + 1; list[_n_packed_sint32] = val end else local val - val, pos = wire.decode_sint32(buf, pos) + val, pos = decode_sint32(buf, pos) _n_packed_sint32 = _n_packed_sint32 + 1; list[_n_packed_sint32] = val end elseif id == 4 then @@ -576,16 +590,16 @@ local list = result.packed_uint32 if list == nil then list = {}; result.packed_uint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_uint32(payload, p2) + val, p2 = decode_uint32(payload, p2) _n_packed_uint32 = _n_packed_uint32 + 1; list[_n_packed_uint32] = val end else local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) _n_packed_uint32 = _n_packed_uint32 + 1; list[_n_packed_uint32] = val end elseif id == 5 then @@ -593,16 +607,16 @@ local list = result.packed_fixed32 if list == nil then list = {}; result.packed_fixed32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed32(payload, p2) + val, p2 = decode_fixed32(payload, p2) _n_packed_fixed32 = _n_packed_fixed32 + 1; list[_n_packed_fixed32] = val end else local val - val, pos = wire.decode_fixed32(buf, pos) + val, pos = decode_fixed32(buf, pos) _n_packed_fixed32 = _n_packed_fixed32 + 1; list[_n_packed_fixed32] = val end elseif id == 6 then @@ -610,16 +624,16 @@ local list = result.packed_fixed64 if list == nil then list = {}; result.packed_fixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed64(payload, p2) + val, p2 = decode_fixed64(payload, p2) _n_packed_fixed64 = _n_packed_fixed64 + 1; list[_n_packed_fixed64] = val end else local val - val, pos = wire.decode_fixed64(buf, pos) + val, pos = decode_fixed64(buf, pos) _n_packed_fixed64 = _n_packed_fixed64 + 1; list[_n_packed_fixed64] = val end elseif id == 7 then @@ -627,16 +641,16 @@ local list = result.packed_double if list == nil then list = {}; result.packed_double = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_double(payload, p2) + val, p2 = decode_double(payload, p2) _n_packed_double = _n_packed_double + 1; list[_n_packed_double] = val end else local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) _n_packed_double = _n_packed_double + 1; list[_n_packed_double] = val end elseif id == 8 then @@ -644,16 +658,16 @@ local list = result.packed_float if list == nil then list = {}; result.packed_float = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_float(payload, p2) + val, p2 = decode_float(payload, p2) _n_packed_float = _n_packed_float + 1; list[_n_packed_float] = val end else local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) _n_packed_float = _n_packed_float + 1; list[_n_packed_float] = val end elseif id == 9 then @@ -661,16 +675,16 @@ local list = result.packed_bool if list == nil then list = {}; result.packed_bool = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_bool(payload, p2) + val, p2 = decode_bool(payload, p2) _n_packed_bool = _n_packed_bool + 1; list[_n_packed_bool] = val end else local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) _n_packed_bool = _n_packed_bool + 1; list[_n_packed_bool] = val end elseif id == 20 then @@ -678,16 +692,16 @@ local list = result.unpacked_int32 if list == nil then list = {}; result.unpacked_int32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_unpacked_int32 = _n_unpacked_int32 + 1; list[_n_unpacked_int32] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_unpacked_int32 = _n_unpacked_int32 + 1; list[_n_unpacked_int32] = val end elseif id == 21 then @@ -695,16 +709,16 @@ local list = result.unpacked_fixed64 if list == nil then list = {}; result.unpacked_fixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed64(payload, p2) + val, p2 = decode_fixed64(payload, p2) _n_unpacked_fixed64 = _n_unpacked_fixed64 + 1; list[_n_unpacked_fixed64] = val end else local val - val, pos = wire.decode_fixed64(buf, pos) + val, pos = decode_fixed64(buf, pos) _n_unpacked_fixed64 = _n_unpacked_fixed64 + 1; list[_n_unpacked_fixed64] = val end elseif id == 22 then @@ -712,16 +726,16 @@ local list = result.unpacked_sint32 if list == nil then list = {}; result.unpacked_sint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint32(payload, p2) + val, p2 = decode_sint32(payload, p2) _n_unpacked_sint32 = _n_unpacked_sint32 + 1; list[_n_unpacked_sint32] = val end else local val - val, pos = wire.decode_sint32(buf, pos) + val, pos = decode_sint32(buf, pos) _n_unpacked_sint32 = _n_unpacked_sint32 + 1; list[_n_unpacked_sint32] = val end elseif id == 30 then @@ -761,7 +775,7 @@ elseif id == 40 then local list = result.messages if list == nil then list = {}; result.messages = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_messages = _n_messages + 1; list[_n_messages] = M.Inner_decode(payload) else local _ebid = M.Holder_descriptor.extensions_by_id diff --git a/examples/expected/full/conformance/conformance_pb.lua b/examples/expected/full/conformance/conformance_pb.lua index 949df2b0759a7437c11423d7b0cc0fe63358b5fd..6c27c526b5578410a453dad35a733a35a6f653ce 100644 --- a/examples/expected/full/conformance/conformance_pb.lua +++ b/examples/expected/full/conformance/conformance_pb.lua @@ -203,6 +203,7 @@ ---@param t conformance.TestStatus ---@return string function M.TestStatus_encode(t) + local encode_varint = wire.encode_varint local _d = M.TestStatus_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -221,7 +222,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -233,7 +234,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -245,7 +246,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -271,6 +272,7 @@ ---@param b string ---@return conformance.TestStatus function M.TestStatus_decode(buf) + local decode_string = wire.decode_string local _d = M.TestStatus_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -307,7 +309,7 @@ result.name = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.name = val end elseif id == 2 then @@ -322,7 +324,7 @@ result.failure_message = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.failure_message = val end elseif id == 3 then @@ -337,7 +339,7 @@ result.matched_name = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.matched_name = val end else @@ -481,6 +483,8 @@ ---@param t conformance.ConformanceRequest ---@return string function M.ConformanceRequest_encode(t) + local encode_int32 = wire.encode_int32 + local encode_varint = wire.encode_varint local _d = M.ConformanceRequest_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -504,7 +508,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -516,7 +520,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -528,7 +532,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -540,7 +544,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -554,7 +558,7 @@ if nv == nil then error("unknown enum value '" .. v .. "' for conformance.WireFormat", 0) end end if nv ~= 0 then n = n + 1; out[n] = "\x18" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end end -- field 4: message_type @@ -565,7 +569,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -579,7 +583,7 @@ if nv == nil then error("unknown enum value '" .. v .. "' for conformance.TestCategory", 0) end end if nv ~= 0 then n = n + 1; out[n] = "\x28" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end end -- field 6: jspb_encoding_options @@ -591,7 +595,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -623,6 +627,9 @@ ---@param b string ---@return conformance.ConformanceRequest function M.ConformanceRequest_decode(buf) + local decode_string = wire.decode_string + local decode_varint = wire.decode_varint + local varint_to_int32 = wire.varint_to_int32 local _d = M.ConformanceRequest_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -676,7 +683,7 @@ result.json_payload = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.json_payload = val end result.protobuf_payload = nil @@ -694,7 +701,7 @@ result.jspb_payload = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.jspb_payload = val end result.protobuf_payload = nil @@ -712,7 +719,7 @@ result.text_payload = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.text_payload = val end result.protobuf_payload = nil @@ -720,8 +727,8 @@ result.json_payload = nil result.jspb_payload = nil elseif id == 3 then local u - u, pos = wire.decode_varint(buf, pos) - result.requested_output_format = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + result.requested_output_format = varint_to_int32(u) elseif id == 4 then local _lb = string_byte(buf, pos) if _lb ~= nil and _lb < 0x80 then @@ -734,13 +741,13 @@ result.message_type = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.message_type = val end elseif id == 5 then local u - u, pos = wire.decode_varint(buf, pos) - result.test_category = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + result.test_category = varint_to_int32(u) elseif id == 6 then local payload payload, pos = wire.decode_len(buf, pos) @@ -785,6 +792,7 @@ ---@param t conformance.ConformanceResponse ---@return string function M.ConformanceResponse_encode(t) + local encode_varint = wire.encode_varint local _d = M.ConformanceResponse_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -813,7 +821,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -825,7 +833,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -837,7 +845,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -849,7 +857,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -861,7 +869,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -873,7 +881,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -885,7 +893,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -897,7 +905,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -909,7 +917,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -935,6 +943,7 @@ ---@param b string ---@return conformance.ConformanceResponse function M.ConformanceResponse_decode(buf) + local decode_string = wire.decode_string local _d = M.ConformanceResponse_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -971,7 +980,7 @@ result.parse_error = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.parse_error = val end result.serialize_error = nil @@ -994,7 +1003,7 @@ result.serialize_error = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.serialize_error = val end result.parse_error = nil @@ -1017,7 +1026,7 @@ result.timeout_error = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.timeout_error = val end result.parse_error = nil @@ -1040,7 +1049,7 @@ result.runtime_error = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.runtime_error = val end result.parse_error = nil @@ -1085,7 +1094,7 @@ result.json_payload = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.json_payload = val end result.parse_error = nil @@ -1108,7 +1117,7 @@ result.skipped = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.skipped = val end result.parse_error = nil @@ -1131,7 +1140,7 @@ result.jspb_payload = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.jspb_payload = val end result.parse_error = nil @@ -1154,7 +1163,7 @@ result.text_payload = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.text_payload = val end result.parse_error = nil diff --git a/examples/expected/full/hello/hello_pb.lua b/examples/expected/full/hello/hello_pb.lua index 22688ac6544da3cf842fbcd23d06e7aca403775b..a0f65fad79f5417be5ad86eb7592c36f604481d3 100644 --- a/examples/expected/full/hello/hello_pb.lua +++ b/examples/expected/full/hello/hello_pb.lua @@ -214,6 +214,8 @@ ---@param t hello.Result ---@return string function M.Result_encode(t) + local encode_int32 = wire.encode_int32 + local encode_varint = wire.encode_varint local _d = M.Result_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -232,7 +234,7 @@ -- field 1: id v = t.id if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x08" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 2: text v = t.text @@ -242,7 +244,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -250,7 +252,7 @@ -- field 3: code v = t.code if _of_outcome == "code" then n = n + 1; out[n] = "\x18" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 4: details v = t.details @@ -261,7 +263,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -287,6 +289,7 @@ ---@param b string ---@return hello.Result function M.Result_decode(buf) + local decode_int32 = wire.decode_int32 local _d = M.Result_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -313,7 +316,7 @@ id, wt, pos = wire.decode_tag(buf, pos) end if id == 1 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.id = val elseif id == 2 then local _lb = string_byte(buf, pos) @@ -334,7 +337,7 @@ result.code = nil result.details = nil elseif id == 3 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.code = val result.text = nil result.details = nil @@ -608,6 +611,7 @@ ---@param t hello.Event ---@return string function M.Event_encode(t) + local encode_varint = wire.encode_varint local _d = M.Event_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -626,7 +630,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -639,7 +643,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -652,7 +656,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -665,7 +669,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -678,7 +682,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -691,7 +695,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -704,7 +708,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -717,7 +721,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -730,7 +734,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -743,7 +747,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -756,7 +760,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -769,7 +773,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -795,6 +799,7 @@ ---@param b string ---@return hello.Event function M.Event_decode(buf) + local decode_len = wire.decode_len local _d = M.Event_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -836,47 +841,47 @@ result.title = val end elseif id == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.created_at = pb.wkt.Timestamp_decode(payload) elseif id == 3 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.duration = pb.wkt.Duration_decode(payload) elseif id == 4 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.ack = pb.wkt.Empty_decode(payload) elseif id == 5 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.retry_count = pb.wkt.Int32Value_decode(payload) elseif id == 6 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.note = pb.wkt.StringValue_decode(payload) elseif id == 7 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.is_admin = pb.wkt.BoolValue_decode(payload) elseif id == 8 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.payload = pb.wkt.Struct_decode(payload) elseif id == 9 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.attribute = pb.wkt.Value_decode(payload) elseif id == 10 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.tags = pb.wkt.ListValue_decode(payload) elseif id == 11 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.extension = pb.wkt.Any_decode(payload) elseif id == 12 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.update_mask = pb.wkt.FieldMask_decode(payload) else local _ebid = M.Event_descriptor.extensions_by_id @@ -909,6 +914,7 @@ ---@param t hello.Address ---@return string function M.Address_encode(t) + local encode_varint = wire.encode_varint local _d = M.Address_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -927,7 +933,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -939,7 +945,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -957,7 +963,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -983,6 +989,7 @@ ---@param b string ---@return hello.Address function M.Address_decode(buf) + local decode_string = wire.decode_string local _d = M.Address_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -1019,7 +1026,7 @@ result.street = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.street = val end elseif id == 2 then @@ -1034,7 +1041,7 @@ result.city = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.city = val end elseif id == 3 then @@ -1053,7 +1060,7 @@ result.apartment = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.apartment = val end else @@ -1092,6 +1099,9 @@ ---@param t hello.Person ---@return string function M.Person_encode(t) + local encode_int32 = wire.encode_int32 + local encode_string = wire.encode_string + local encode_varint = wire.encode_varint local _d = M.Person_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -1110,7 +1120,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -1118,7 +1128,7 @@ -- field 2: age v = t.age if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x10" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 3: emails v = t.emails @@ -1131,7 +1141,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1146,7 +1156,7 @@ if nv == nil then error("unknown enum value '" .. v .. "' for hello.Status", 0) end end if nv ~= 0 then n = n + 1; out[n] = "\x20" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end end -- field 5: address @@ -1158,7 +1168,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1173,7 +1183,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1183,7 +1193,7 @@ v = t.lucky_numbers if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_int32(v[_i]) + m = m + 1; parts[m] = encode_int32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x3a" @@ -1191,7 +1201,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1203,7 +1213,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -1233,11 +1243,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_int32(_val) + _m = _m + 1; entry[_m] = encode_int32(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1245,7 +1255,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1258,11 +1268,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_int32(_k) + _m = _m + 1; entry[_m] = encode_int32(_k) end if _val ~= '' then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_string(_val) + _m = _m + 1; entry[_m] = encode_string(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1270,7 +1280,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1283,7 +1293,7 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end if _val ~= nil then _m = _m + 1; entry[_m] = _vtag @@ -1295,7 +1305,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1322,6 +1332,11 @@ ---@param b string ---@return hello.Person function M.Person_decode(buf) + local decode_int32 = wire.decode_int32 + local decode_len = wire.decode_len + local decode_string = wire.decode_string + local decode_tag = wire.decode_tag + local skip_field = wire.skip_field local _d = M.Person_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -1347,7 +1362,7 @@ id = rshift(_b, 3) if id == 0 then error("illegal field number 0", 0) end pos = pos + 1 else - id, wt, pos = wire.decode_tag(buf, pos) + id, wt, pos = decode_tag(buf, pos) end if id == 1 then local _lb = string_byte(buf, pos) @@ -1361,12 +1376,12 @@ result.name = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.name = val end elseif id == 2 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.age = val elseif id == 3 then local list = result.emails @@ -1382,7 +1397,7 @@ _n_emails = _n_emails + 1; list[_n_emails] = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) _n_emails = _n_emails + 1; list[_n_emails] = val end elseif id == 4 then @@ -1391,7 +1406,7 @@ u, pos = wire.decode_varint(buf, pos) result.status = wire.varint_to_int32(u) elseif id == 5 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.address if prev == nil then result.address = M.Address_decode(payload) @@ -1402,23 +1417,23 @@ elseif id == 6 then local list = result.friends if list == nil then list = {}; result.friends = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_friends = _n_friends + 1; list[_n_friends] = M.Person_decode(payload) elseif id == 7 then local list = result.lucky_numbers if list == nil then list = {}; result.lucky_numbers = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_lucky_numbers = _n_lucky_numbers + 1; list[_n_lucky_numbers] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_lucky_numbers = _n_lucky_numbers + 1; list[_n_lucky_numbers] = val end elseif id == 8 then @@ -1451,18 +1466,18 @@ elseif id == 13 then local map = result.ages_by_nickname if map == nil then map = {}; result.ages_by_nickname = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_int32(payload, _ep) + _val, _ep = decode_int32(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -1470,18 +1485,18 @@ elseif id == 14 then local map = result.nickname_by_age if map == nil then map = {}; result.nickname_by_age = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, '' while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_int32(payload, _ep) + _key, _ep = decode_int32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_string(payload, _ep) + _val, _ep = decode_string(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -1489,20 +1504,20 @@ elseif id == 15 then local map = result.addresses_by_label if map == nil then map = {}; result.addresses_by_label = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', {} while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then local _payload - _payload, _ep = wire.decode_len(payload, _ep) + _payload, _ep = decode_len(payload, _ep) _val = M.Address_decode(_payload) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -1512,7 +1527,7 @@ local _ext = _ebid and _ebid[id] or nil if _ext ~= nil then pos = pb.codec.decode_extension(_ext, buf, pos, wt, result) else - pos = wire.skip_field(buf, pos, wt, id) + pos = skip_field(buf, pos, wt, id) if _uf == nil then _uf = {} end _uf[#_uf + 1] = buf:sub(_tag_start, pos - 1) end diff --git a/examples/expected/full/proto2_basic/proto2_basic_pb.lua b/examples/expected/full/proto2_basic/proto2_basic_pb.lua index 6f657eea50f256507e8efbc1cbb9c2abc31db942..3514f648a9059dbb19a3bff6b69511fc8cf8a918 100644 --- a/examples/expected/full/proto2_basic/proto2_basic_pb.lua +++ b/examples/expected/full/proto2_basic/proto2_basic_pb.lua @@ -241,6 +241,8 @@ ---@param t proto2_basic.Defaults ---@return string function M.Defaults_encode(t) + local encode_int32 = wire.encode_int32 + local encode_varint = wire.encode_varint local _d = M.Defaults_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -255,7 +257,7 @@ -- field 1: i v = t.i if v ~= nil then n = n + 1; out[n] = "\x08" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 2: s v = t.s @@ -265,7 +267,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -307,7 +309,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -320,7 +322,7 @@ nv = M.Defaults_Color[v] if nv == nil then error("unknown enum value '" .. v .. "' for proto2_basic.Defaults.Color", 0) end end n = n + 1; out[n] = "\x48" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end local _exts = t._extensions if _exts ~= nil then @@ -501,6 +503,7 @@ ---@param t proto2_basic.Cardinality ---@return string function M.Cardinality_encode(t) + local encode_int32 = wire.encode_int32 local _d = M.Cardinality_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -517,12 +520,12 @@ if v == nil then error("required field missing on encode: proto2_basic.Cardinality.r", 0) end n = n + 1; out[n] = "\x08" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) -- field 2: o v = t.o if v ~= nil then n = n + 1; out[n] = "\x10" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 3: packed_default v = t.packed_default @@ -530,7 +533,7 @@ if v ~= nil and #v > 0 then local _tag = "\x18" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_int32(v[_i]) + n = n + 1; out[n] = encode_int32(v[_i]) end end -- field 4: explicitly_packed @@ -538,7 +541,7 @@ v = t.explicitly_packed if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_int32(v[_i]) + m = m + 1; parts[m] = encode_int32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x22" @@ -556,7 +559,7 @@ if v ~= nil and #v > 0 then local _tag = "\x28" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_int32(v[_i]) + n = n + 1; out[n] = encode_int32(v[_i]) end end local _exts = t._extensions @@ -581,6 +584,8 @@ ---@param b string ---@return proto2_basic.Cardinality function M.Cardinality_decode(buf) + local decode_int32 = wire.decode_int32 + local decode_len = wire.decode_len local _d = M.Cardinality_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -610,27 +615,27 @@ id, wt, pos = wire.decode_tag(buf, pos) end if id == 1 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.r = val elseif id == 2 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.o = val elseif id == 3 then local list = result.packed_default if list == nil then list = {}; result.packed_default = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_packed_default = _n_packed_default + 1; list[_n_packed_default] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_packed_default = _n_packed_default + 1; list[_n_packed_default] = val end elseif id == 4 then @@ -638,16 +643,16 @@ local list = result.explicitly_packed if list == nil then list = {}; result.explicitly_packed = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_explicitly_packed = _n_explicitly_packed + 1; list[_n_explicitly_packed] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_explicitly_packed = _n_explicitly_packed + 1; list[_n_explicitly_packed] = val end elseif id == 5 then @@ -655,16 +660,16 @@ local list = result.explicitly_unpacked if list == nil then list = {}; result.explicitly_unpacked = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_explicitly_unpacked = _n_explicitly_unpacked + 1; list[_n_explicitly_unpacked] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_explicitly_unpacked = _n_explicitly_unpacked + 1; list[_n_explicitly_unpacked] = val end else @@ -703,6 +708,7 @@ ---@param t proto2_basic.Nested ---@return string function M.Nested_encode(t) + local encode_varint = wire.encode_varint local _d = M.Nested_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -724,7 +730,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b -- field 2: inner_opt @@ -736,7 +742,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -762,6 +768,7 @@ ---@param b string ---@return proto2_basic.Nested function M.Nested_decode(buf) + local decode_len = wire.decode_len local _d = M.Nested_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -788,7 +795,7 @@ id, wt, pos = wire.decode_tag(buf, pos) end if id == 1 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.inner if prev == nil then result.inner = M.Nested_Inner_decode(payload) @@ -797,7 +804,7 @@ pb.codec.merge_message(M.Nested_Inner_descriptor, prev, M.Nested_Inner_decode(payload)) end elseif id == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.inner_opt if prev == nil then result.inner_opt = M.Nested_Inner_decode(payload) @@ -1300,6 +1307,8 @@ ---@param t proto2_basic.BenchPayload ---@return string function M.BenchPayload_encode(t) + local encode_int32 = wire.encode_int32 + local encode_varint = wire.encode_varint local _d = M.BenchPayload_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -1316,7 +1325,7 @@ if v == nil then error("required field missing on encode: proto2_basic.BenchPayload.id", 0) end n = n + 1; out[n] = "\x08" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) -- field 2: name v = t.name if v ~= nil then @@ -1325,7 +1334,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -1333,14 +1342,14 @@ -- field 3: retries v = t.retries if v ~= nil then n = n + 1; out[n] = "\x18" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 4: lucky_numbers v = t.lucky_numbers if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_int32(v[_i]) + m = m + 1; parts[m] = encode_int32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x22" @@ -1348,7 +1357,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1363,7 +1372,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1377,7 +1386,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1410,6 +1419,9 @@ ---@param b string ---@return proto2_basic.BenchPayload function M.BenchPayload_decode(buf) + local decode_int32 = wire.decode_int32 + local decode_len = wire.decode_len + local decode_string = wire.decode_string local _d = M.BenchPayload_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -1438,7 +1450,7 @@ id, wt, pos = wire.decode_tag(buf, pos) end if id == 1 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.id = val elseif id == 2 then local _lb = string_byte(buf, pos) @@ -1452,28 +1464,28 @@ result.name = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.name = val end elseif id == 3 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.retries = val elseif id == 4 then local list = result.lucky_numbers if list == nil then list = {}; result.lucky_numbers = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_lucky_numbers = _n_lucky_numbers + 1; list[_n_lucky_numbers] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_lucky_numbers = _n_lucky_numbers + 1; list[_n_lucky_numbers] = val end elseif id == 5 then @@ -1490,12 +1502,12 @@ _n_tags = _n_tags + 1; list[_n_tags] = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) _n_tags = _n_tags + 1; list[_n_tags] = val end elseif id == 6 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.inner if prev == nil then result.inner = M.BenchPayload_Inner_decode(payload) @@ -1562,6 +1574,7 @@ ---@param t proto2_basic.BenchPayload.Stats ---@return string function M.BenchPayload_Stats_encode(t) + local encode_int32 = wire.encode_int32 local _d = M.BenchPayload_Stats_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -1576,13 +1589,13 @@ -- field 8: latency_ns v = t.latency_ns if v ~= nil then n = n + 1; out[n] = "\x40" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 9: attempts v = t.attempts if v ~= nil then n = n + 1; out[n] = "\x48" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end local _exts = t._extensions if _exts ~= nil then @@ -1606,6 +1619,7 @@ ---@param b string ---@return proto2_basic.BenchPayload.Stats function M.BenchPayload_Stats_decode(buf) + local decode_int32 = wire.decode_int32 local _d = M.BenchPayload_Stats_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -1632,11 +1646,11 @@ id, wt, pos = wire.decode_tag(buf, pos) end if id == 8 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.latency_ns = val elseif id == 9 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.attempts = val else local _ebid = M.BenchPayload_Stats_descriptor.extensions_by_id diff --git a/examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua b/examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua index 698bb690b2589109569ed57c0d58cf07d6d8f09f..3fa1cec88fe98b4f77241df9a0570a14b57682a3 100644 --- a/examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua +++ b/examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua @@ -903,6 +903,22 @@ ---@param t protobuf_test_messages.proto2.TestAllTypesProto2 ---@return string function M.TestAllTypesProto2_encode(t) + local encode_bool = wire.encode_bool + local encode_double = wire.encode_double + local encode_fixed32 = wire.encode_fixed32 + local encode_fixed64 = wire.encode_fixed64 + local encode_float = wire.encode_float + local encode_int32 = wire.encode_int32 + local encode_int64 = wire.encode_int64 + local encode_len = wire.encode_len + local encode_sfixed32 = wire.encode_sfixed32 + local encode_sfixed64 = wire.encode_sfixed64 + local encode_sint32 = wire.encode_sint32 + local encode_sint64 = wire.encode_sint64 + local encode_string = wire.encode_string + local encode_uint32 = wire.encode_uint32 + local encode_uint64 = wire.encode_uint64 + local encode_varint = wire.encode_varint local _d = M.TestAllTypesProto2_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -927,79 +943,79 @@ -- field 1: optional_int32 v = t.optional_int32 if v ~= nil then n = n + 1; out[n] = "\x08" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 2: optional_int64 v = t.optional_int64 if v ~= nil then n = n + 1; out[n] = "\x10" - n = n + 1; out[n] = wire.encode_int64(v) + n = n + 1; out[n] = encode_int64(v) end -- field 3: optional_uint32 v = t.optional_uint32 if v ~= nil then n = n + 1; out[n] = "\x18" - n = n + 1; out[n] = wire.encode_uint32(v) + n = n + 1; out[n] = encode_uint32(v) end -- field 4: optional_uint64 v = t.optional_uint64 if v ~= nil then n = n + 1; out[n] = "\x20" - n = n + 1; out[n] = wire.encode_uint64(v) + n = n + 1; out[n] = encode_uint64(v) end -- field 5: optional_sint32 v = t.optional_sint32 if v ~= nil then n = n + 1; out[n] = "\x28" - n = n + 1; out[n] = wire.encode_sint32(v) + n = n + 1; out[n] = encode_sint32(v) end -- field 6: optional_sint64 v = t.optional_sint64 if v ~= nil then n = n + 1; out[n] = "\x30" - n = n + 1; out[n] = wire.encode_sint64(v) + n = n + 1; out[n] = encode_sint64(v) end -- field 7: optional_fixed32 v = t.optional_fixed32 if v ~= nil then n = n + 1; out[n] = "\x3d" - n = n + 1; out[n] = wire.encode_fixed32(v) + n = n + 1; out[n] = encode_fixed32(v) end -- field 8: optional_fixed64 v = t.optional_fixed64 if v ~= nil then n = n + 1; out[n] = "\x41" - n = n + 1; out[n] = wire.encode_fixed64(v) + n = n + 1; out[n] = encode_fixed64(v) end -- field 9: optional_sfixed32 v = t.optional_sfixed32 if v ~= nil then n = n + 1; out[n] = "\x4d" - n = n + 1; out[n] = wire.encode_sfixed32(v) + n = n + 1; out[n] = encode_sfixed32(v) end -- field 10: optional_sfixed64 v = t.optional_sfixed64 if v ~= nil then n = n + 1; out[n] = "\x51" - n = n + 1; out[n] = wire.encode_sfixed64(v) + n = n + 1; out[n] = encode_sfixed64(v) end -- field 11: optional_float v = t.optional_float if v ~= nil then n = n + 1; out[n] = "\x5d" - n = n + 1; out[n] = wire.encode_float(v) + n = n + 1; out[n] = encode_float(v) end -- field 12: optional_double v = t.optional_double if v ~= nil then n = n + 1; out[n] = "\x61" - n = n + 1; out[n] = wire.encode_double(v) + n = n + 1; out[n] = encode_double(v) end -- field 13: optional_bool v = t.optional_bool if v ~= nil then n = n + 1; out[n] = "\x68" - n = n + 1; out[n] = wire.encode_bool(v) + n = n + 1; out[n] = encode_bool(v) end -- field 14: optional_string v = t.optional_string @@ -1009,7 +1025,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -1021,7 +1037,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -1034,7 +1050,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1047,7 +1063,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1060,7 +1076,7 @@ nv = M.TestAllTypesProto2_NestedEnum[v] if nv == nil then error("unknown enum value '" .. v .. "' for protobuf_test_messages.proto2.TestAllTypesProto2.NestedEnum", 0) end end n = n + 1; out[n] = "\xa8\x01" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end -- field 22: optional_foreign_enum v = t.optional_foreign_enum @@ -1071,7 +1087,7 @@ nv = M.ForeignEnumProto2[v] if nv == nil then error("unknown enum value '" .. v .. "' for protobuf_test_messages.proto2.ForeignEnumProto2", 0) end end n = n + 1; out[n] = "\xb0\x01" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end -- field 24: optional_string_piece v = t.optional_string_piece @@ -1081,7 +1097,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -1093,7 +1109,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -1106,7 +1122,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1116,7 +1132,7 @@ if v ~= nil and #v > 0 then local _tag = "\xf8\x01" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_int32(v[_i]) + n = n + 1; out[n] = encode_int32(v[_i]) end end -- field 32: repeated_int64 @@ -1125,7 +1141,7 @@ if v ~= nil and #v > 0 then local _tag = "\x80\x02" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_int64(v[_i]) + n = n + 1; out[n] = encode_int64(v[_i]) end end -- field 33: repeated_uint32 @@ -1134,7 +1150,7 @@ if v ~= nil and #v > 0 then local _tag = "\x88\x02" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_uint32(v[_i]) + n = n + 1; out[n] = encode_uint32(v[_i]) end end -- field 34: repeated_uint64 @@ -1143,7 +1159,7 @@ if v ~= nil and #v > 0 then local _tag = "\x90\x02" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_uint64(v[_i]) + n = n + 1; out[n] = encode_uint64(v[_i]) end end -- field 35: repeated_sint32 @@ -1152,7 +1168,7 @@ if v ~= nil and #v > 0 then local _tag = "\x98\x02" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_sint32(v[_i]) + n = n + 1; out[n] = encode_sint32(v[_i]) end end -- field 36: repeated_sint64 @@ -1161,7 +1177,7 @@ if v ~= nil and #v > 0 then local _tag = "\xa0\x02" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_sint64(v[_i]) + n = n + 1; out[n] = encode_sint64(v[_i]) end end -- field 37: repeated_fixed32 @@ -1170,7 +1186,7 @@ if v ~= nil and #v > 0 then local _tag = "\xad\x02" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_fixed32(v[_i]) + n = n + 1; out[n] = encode_fixed32(v[_i]) end end -- field 38: repeated_fixed64 @@ -1179,7 +1195,7 @@ if v ~= nil and #v > 0 then local _tag = "\xb1\x02" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_fixed64(v[_i]) + n = n + 1; out[n] = encode_fixed64(v[_i]) end end -- field 39: repeated_sfixed32 @@ -1188,7 +1204,7 @@ if v ~= nil and #v > 0 then local _tag = "\xbd\x02" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_sfixed32(v[_i]) + n = n + 1; out[n] = encode_sfixed32(v[_i]) end end -- field 40: repeated_sfixed64 @@ -1197,7 +1213,7 @@ if v ~= nil and #v > 0 then local _tag = "\xc1\x02" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_sfixed64(v[_i]) + n = n + 1; out[n] = encode_sfixed64(v[_i]) end end -- field 41: repeated_float @@ -1206,7 +1222,7 @@ if v ~= nil and #v > 0 then local _tag = "\xcd\x02" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_float(v[_i]) + n = n + 1; out[n] = encode_float(v[_i]) end end -- field 42: repeated_double @@ -1215,7 +1231,7 @@ if v ~= nil and #v > 0 then local _tag = "\xd1\x02" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_double(v[_i]) + n = n + 1; out[n] = encode_double(v[_i]) end end -- field 43: repeated_bool @@ -1224,7 +1240,7 @@ if v ~= nil and #v > 0 then local _tag = "\xd8\x02" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_bool(v[_i]) + n = n + 1; out[n] = encode_bool(v[_i]) end end -- field 44: repeated_string @@ -1238,7 +1254,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1254,7 +1270,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1270,7 +1286,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1286,7 +1302,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1302,7 +1318,7 @@ if type(elem) == 'string' then nv = M.TestAllTypesProto2_NestedEnum[elem] if nv == nil then error("unknown enum value '" .. elem .. "' for protobuf_test_messages.proto2.TestAllTypesProto2.NestedEnum", 0) end end - m = m + 1; parts[m] = wire.encode_int32(nv) + m = m + 1; parts[m] = encode_int32(nv) end local _b = table.concat(parts) n = n + 1; out[n] = "\x98\x03" @@ -1310,7 +1326,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1325,7 +1341,7 @@ if type(elem) == 'string' then nv = M.ForeignEnumProto2[elem] if nv == nil then error("unknown enum value '" .. elem .. "' for protobuf_test_messages.proto2.ForeignEnumProto2", 0) end end - m = m + 1; parts[m] = wire.encode_int32(nv) + m = m + 1; parts[m] = encode_int32(nv) end local _b = table.concat(parts) n = n + 1; out[n] = "\xa0\x03" @@ -1333,7 +1349,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1348,7 +1364,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1364,7 +1380,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1374,7 +1390,7 @@ v = t.packed_int32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_int32(v[_i]) + m = m + 1; parts[m] = encode_int32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xda\x04" @@ -1382,7 +1398,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1391,7 +1407,7 @@ v = t.packed_int64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_int64(v[_i]) + m = m + 1; parts[m] = encode_int64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xe2\x04" @@ -1399,7 +1415,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1408,7 +1424,7 @@ v = t.packed_uint32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_uint32(v[_i]) + m = m + 1; parts[m] = encode_uint32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xea\x04" @@ -1416,7 +1432,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1425,7 +1441,7 @@ v = t.packed_uint64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_uint64(v[_i]) + m = m + 1; parts[m] = encode_uint64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xf2\x04" @@ -1433,7 +1449,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1442,7 +1458,7 @@ v = t.packed_sint32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_sint32(v[_i]) + m = m + 1; parts[m] = encode_sint32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xfa\x04" @@ -1450,7 +1466,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1459,7 +1475,7 @@ v = t.packed_sint64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_sint64(v[_i]) + m = m + 1; parts[m] = encode_sint64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x82\x05" @@ -1467,7 +1483,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1476,7 +1492,7 @@ v = t.packed_fixed32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_fixed32(v[_i]) + m = m + 1; parts[m] = encode_fixed32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x8a\x05" @@ -1484,7 +1500,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1493,7 +1509,7 @@ v = t.packed_fixed64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_fixed64(v[_i]) + m = m + 1; parts[m] = encode_fixed64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x92\x05" @@ -1501,7 +1517,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1510,7 +1526,7 @@ v = t.packed_sfixed32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_sfixed32(v[_i]) + m = m + 1; parts[m] = encode_sfixed32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x9a\x05" @@ -1518,7 +1534,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1527,7 +1543,7 @@ v = t.packed_sfixed64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_sfixed64(v[_i]) + m = m + 1; parts[m] = encode_sfixed64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xa2\x05" @@ -1535,7 +1551,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1544,7 +1560,7 @@ v = t.packed_float if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_float(v[_i]) + m = m + 1; parts[m] = encode_float(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xaa\x05" @@ -1552,7 +1568,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1561,7 +1577,7 @@ v = t.packed_double if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_double(v[_i]) + m = m + 1; parts[m] = encode_double(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xb2\x05" @@ -1569,7 +1585,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1578,7 +1594,7 @@ v = t.packed_bool if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_bool(v[_i]) + m = m + 1; parts[m] = encode_bool(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xba\x05" @@ -1586,7 +1602,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1601,7 +1617,7 @@ if type(elem) == 'string' then nv = M.TestAllTypesProto2_NestedEnum[elem] if nv == nil then error("unknown enum value '" .. elem .. "' for protobuf_test_messages.proto2.TestAllTypesProto2.NestedEnum", 0) end end - m = m + 1; parts[m] = wire.encode_int32(nv) + m = m + 1; parts[m] = encode_int32(nv) end local _b = table.concat(parts) n = n + 1; out[n] = "\xc2\x05" @@ -1609,7 +1625,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1619,7 +1635,7 @@ if v ~= nil and #v > 0 then local _tag = "\xc8\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_int32(v[_i]) + n = n + 1; out[n] = encode_int32(v[_i]) end end -- field 90: unpacked_int64 @@ -1628,7 +1644,7 @@ if v ~= nil and #v > 0 then local _tag = "\xd0\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_int64(v[_i]) + n = n + 1; out[n] = encode_int64(v[_i]) end end -- field 91: unpacked_uint32 @@ -1637,7 +1653,7 @@ if v ~= nil and #v > 0 then local _tag = "\xd8\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_uint32(v[_i]) + n = n + 1; out[n] = encode_uint32(v[_i]) end end -- field 92: unpacked_uint64 @@ -1646,7 +1662,7 @@ if v ~= nil and #v > 0 then local _tag = "\xe0\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_uint64(v[_i]) + n = n + 1; out[n] = encode_uint64(v[_i]) end end -- field 93: unpacked_sint32 @@ -1655,7 +1671,7 @@ if v ~= nil and #v > 0 then local _tag = "\xe8\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_sint32(v[_i]) + n = n + 1; out[n] = encode_sint32(v[_i]) end end -- field 94: unpacked_sint64 @@ -1664,7 +1680,7 @@ if v ~= nil and #v > 0 then local _tag = "\xf0\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_sint64(v[_i]) + n = n + 1; out[n] = encode_sint64(v[_i]) end end -- field 95: unpacked_fixed32 @@ -1673,7 +1689,7 @@ if v ~= nil and #v > 0 then local _tag = "\xfd\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_fixed32(v[_i]) + n = n + 1; out[n] = encode_fixed32(v[_i]) end end -- field 96: unpacked_fixed64 @@ -1682,7 +1698,7 @@ if v ~= nil and #v > 0 then local _tag = "\x81\x06" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_fixed64(v[_i]) + n = n + 1; out[n] = encode_fixed64(v[_i]) end end -- field 97: unpacked_sfixed32 @@ -1691,7 +1707,7 @@ if v ~= nil and #v > 0 then local _tag = "\x8d\x06" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_sfixed32(v[_i]) + n = n + 1; out[n] = encode_sfixed32(v[_i]) end end -- field 98: unpacked_sfixed64 @@ -1700,7 +1716,7 @@ if v ~= nil and #v > 0 then local _tag = "\x91\x06" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_sfixed64(v[_i]) + n = n + 1; out[n] = encode_sfixed64(v[_i]) end end -- field 99: unpacked_float @@ -1709,7 +1725,7 @@ if v ~= nil and #v > 0 then local _tag = "\x9d\x06" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_float(v[_i]) + n = n + 1; out[n] = encode_float(v[_i]) end end -- field 100: unpacked_double @@ -1718,7 +1734,7 @@ if v ~= nil and #v > 0 then local _tag = "\xa1\x06" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_double(v[_i]) + n = n + 1; out[n] = encode_double(v[_i]) end end -- field 101: unpacked_bool @@ -1727,7 +1743,7 @@ if v ~= nil and #v > 0 then local _tag = "\xa8\x06" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_bool(v[_i]) + n = n + 1; out[n] = encode_bool(v[_i]) end end -- field 102: unpacked_nested_enum @@ -1741,7 +1757,7 @@ if type(elem) == 'string' then nv = M.TestAllTypesProto2_NestedEnum[elem] if nv == nil then error("unknown enum value '" .. elem .. "' for protobuf_test_messages.proto2.TestAllTypesProto2.NestedEnum", 0) end end - m = m + 1; parts[m] = wire.encode_int32(nv) + m = m + 1; parts[m] = encode_int32(nv) end local _b = table.concat(parts) n = n + 1; out[n] = "\xb0\x06" @@ -1749,7 +1765,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1761,11 +1777,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_int32(_k) + _m = _m + 1; entry[_m] = encode_int32(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_int32(_val) + _m = _m + 1; entry[_m] = encode_int32(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1773,7 +1789,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1786,11 +1802,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_int64(_k) + _m = _m + 1; entry[_m] = encode_int64(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_int64(_val) + _m = _m + 1; entry[_m] = encode_int64(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1798,7 +1814,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1811,11 +1827,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_uint32(_k) + _m = _m + 1; entry[_m] = encode_uint32(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_uint32(_val) + _m = _m + 1; entry[_m] = encode_uint32(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1823,7 +1839,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1836,11 +1852,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_uint64(_k) + _m = _m + 1; entry[_m] = encode_uint64(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_uint64(_val) + _m = _m + 1; entry[_m] = encode_uint64(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1848,7 +1864,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1861,11 +1877,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_sint32(_k) + _m = _m + 1; entry[_m] = encode_sint32(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_sint32(_val) + _m = _m + 1; entry[_m] = encode_sint32(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1873,7 +1889,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1886,11 +1902,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_sint64(_k) + _m = _m + 1; entry[_m] = encode_sint64(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_sint64(_val) + _m = _m + 1; entry[_m] = encode_sint64(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1898,7 +1914,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1911,11 +1927,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_fixed32(_k) + _m = _m + 1; entry[_m] = encode_fixed32(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_fixed32(_val) + _m = _m + 1; entry[_m] = encode_fixed32(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1923,7 +1939,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1936,11 +1952,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_fixed64(_k) + _m = _m + 1; entry[_m] = encode_fixed64(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_fixed64(_val) + _m = _m + 1; entry[_m] = encode_fixed64(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1948,7 +1964,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1961,11 +1977,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_sfixed32(_k) + _m = _m + 1; entry[_m] = encode_sfixed32(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_sfixed32(_val) + _m = _m + 1; entry[_m] = encode_sfixed32(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1973,7 +1989,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1986,11 +2002,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_sfixed64(_k) + _m = _m + 1; entry[_m] = encode_sfixed64(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_sfixed64(_val) + _m = _m + 1; entry[_m] = encode_sfixed64(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1998,7 +2014,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2011,11 +2027,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_int32(_k) + _m = _m + 1; entry[_m] = encode_int32(_k) end if _val ~= false then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_bool(_val) + _m = _m + 1; entry[_m] = encode_bool(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -2023,7 +2039,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2036,11 +2052,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_int32(_k) + _m = _m + 1; entry[_m] = encode_int32(_k) end if (_val ~= 0 or 1/_val == -math.huge) then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_float(_val) + _m = _m + 1; entry[_m] = encode_float(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -2048,7 +2064,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2061,11 +2077,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_int32(_k) + _m = _m + 1; entry[_m] = encode_int32(_k) end if (_val ~= 0 or 1/_val == -math.huge) then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_double(_val) + _m = _m + 1; entry[_m] = encode_double(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -2073,7 +2089,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2086,11 +2102,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_int32(_k) + _m = _m + 1; entry[_m] = encode_int32(_k) end if _val ~= nil then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_len(M.TestAllTypesProto2_NestedMessage_encode(_val)) + _m = _m + 1; entry[_m] = encode_len(M.TestAllTypesProto2_NestedMessage_encode(_val)) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -2098,7 +2114,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2111,11 +2127,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= false then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_bool(_k) + _m = _m + 1; entry[_m] = encode_bool(_k) end if _val ~= false then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_bool(_val) + _m = _m + 1; entry[_m] = encode_bool(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -2123,7 +2139,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2136,11 +2152,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end if _val ~= '' then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_string(_val) + _m = _m + 1; entry[_m] = encode_string(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -2148,7 +2164,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2161,7 +2177,7 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end if _val ~= '' then _m = _m + 1; entry[_m] = _vtag @@ -2173,7 +2189,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2186,11 +2202,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end if _val ~= nil then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_len(M.TestAllTypesProto2_NestedMessage_encode(_val)) + _m = _m + 1; entry[_m] = encode_len(M.TestAllTypesProto2_NestedMessage_encode(_val)) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -2198,7 +2214,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2211,11 +2227,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end if _val ~= nil then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_len(M.ForeignMessageProto2_encode(_val)) + _m = _m + 1; entry[_m] = encode_len(M.ForeignMessageProto2_encode(_val)) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -2223,7 +2239,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2236,7 +2252,7 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end do local _nv = _val @@ -2245,7 +2261,7 @@ _nv = M.TestAllTypesProto2_NestedEnum[_val] if _nv == nil then error("unknown enum value '" .. _val .. "' for protobuf_test_messages.proto2.TestAllTypesProto2.NestedEnum", 0) end end _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_int32(_nv) + _m = _m + 1; entry[_m] = encode_int32(_nv) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -2253,7 +2269,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2266,7 +2282,7 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end do local _nv = _val @@ -2275,7 +2291,7 @@ _nv = M.ForeignEnumProto2[_val] if _nv == nil then error("unknown enum value '" .. _val .. "' for protobuf_test_messages.proto2.ForeignEnumProto2", 0) end end _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_int32(_nv) + _m = _m + 1; entry[_m] = encode_int32(_nv) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -2283,7 +2299,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2292,7 +2308,7 @@ -- field 111: oneof_uint32 v = t.oneof_uint32 if _of_oneof_field == "oneof_uint32" then n = n + 1; out[n] = "\xf8\x06" - n = n + 1; out[n] = wire.encode_uint32(v) + n = n + 1; out[n] = encode_uint32(v) end -- field 112: oneof_nested_message v = t.oneof_nested_message @@ -2303,7 +2319,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2315,7 +2331,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -2327,7 +2343,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -2335,25 +2351,25 @@ -- field 115: oneof_bool v = t.oneof_bool if _of_oneof_field == "oneof_bool" then n = n + 1; out[n] = "\x98\x07" - n = n + 1; out[n] = wire.encode_bool(v) + n = n + 1; out[n] = encode_bool(v) end -- field 116: oneof_uint64 v = t.oneof_uint64 if _of_oneof_field == "oneof_uint64" then n = n + 1; out[n] = "\xa0\x07" - n = n + 1; out[n] = wire.encode_uint64(v) + n = n + 1; out[n] = encode_uint64(v) end -- field 117: oneof_float v = t.oneof_float if _of_oneof_field == "oneof_float" then n = n + 1; out[n] = "\xad\x07" - n = n + 1; out[n] = wire.encode_float(v) + n = n + 1; out[n] = encode_float(v) end -- field 118: oneof_double v = t.oneof_double if _of_oneof_field == "oneof_double" then n = n + 1; out[n] = "\xb1\x07" - n = n + 1; out[n] = wire.encode_double(v) + n = n + 1; out[n] = encode_double(v) end -- field 119: oneof_enum v = t.oneof_enum @@ -2364,7 +2380,7 @@ nv = M.TestAllTypesProto2_NestedEnum[v] if nv == nil then error("unknown enum value '" .. v .. "' for protobuf_test_messages.proto2.TestAllTypesProto2.NestedEnum", 0) end end n = n + 1; out[n] = "\xb8\x07" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end -- field 201: data v = t.data @@ -2384,79 +2400,79 @@ -- field 241: default_int32 v = t.default_int32 if v ~= nil then n = n + 1; out[n] = "\x88\x0f" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 242: default_int64 v = t.default_int64 if v ~= nil then n = n + 1; out[n] = "\x90\x0f" - n = n + 1; out[n] = wire.encode_int64(v) + n = n + 1; out[n] = encode_int64(v) end -- field 243: default_uint32 v = t.default_uint32 if v ~= nil then n = n + 1; out[n] = "\x98\x0f" - n = n + 1; out[n] = wire.encode_uint32(v) + n = n + 1; out[n] = encode_uint32(v) end -- field 244: default_uint64 v = t.default_uint64 if v ~= nil then n = n + 1; out[n] = "\xa0\x0f" - n = n + 1; out[n] = wire.encode_uint64(v) + n = n + 1; out[n] = encode_uint64(v) end -- field 245: default_sint32 v = t.default_sint32 if v ~= nil then n = n + 1; out[n] = "\xa8\x0f" - n = n + 1; out[n] = wire.encode_sint32(v) + n = n + 1; out[n] = encode_sint32(v) end -- field 246: default_sint64 v = t.default_sint64 if v ~= nil then n = n + 1; out[n] = "\xb0\x0f" - n = n + 1; out[n] = wire.encode_sint64(v) + n = n + 1; out[n] = encode_sint64(v) end -- field 247: default_fixed32 v = t.default_fixed32 if v ~= nil then n = n + 1; out[n] = "\xbd\x0f" - n = n + 1; out[n] = wire.encode_fixed32(v) + n = n + 1; out[n] = encode_fixed32(v) end -- field 248: default_fixed64 v = t.default_fixed64 if v ~= nil then n = n + 1; out[n] = "\xc1\x0f" - n = n + 1; out[n] = wire.encode_fixed64(v) + n = n + 1; out[n] = encode_fixed64(v) end -- field 249: default_sfixed32 v = t.default_sfixed32 if v ~= nil then n = n + 1; out[n] = "\xcd\x0f" - n = n + 1; out[n] = wire.encode_sfixed32(v) + n = n + 1; out[n] = encode_sfixed32(v) end -- field 250: default_sfixed64 v = t.default_sfixed64 if v ~= nil then n = n + 1; out[n] = "\xd1\x0f" - n = n + 1; out[n] = wire.encode_sfixed64(v) + n = n + 1; out[n] = encode_sfixed64(v) end -- field 251: default_float v = t.default_float if v ~= nil then n = n + 1; out[n] = "\xdd\x0f" - n = n + 1; out[n] = wire.encode_float(v) + n = n + 1; out[n] = encode_float(v) end -- field 252: default_double v = t.default_double if v ~= nil then n = n + 1; out[n] = "\xe1\x0f" - n = n + 1; out[n] = wire.encode_double(v) + n = n + 1; out[n] = encode_double(v) end -- field 253: default_bool v = t.default_bool if v ~= nil then n = n + 1; out[n] = "\xe8\x0f" - n = n + 1; out[n] = wire.encode_bool(v) + n = n + 1; out[n] = encode_bool(v) end -- field 254: default_string v = t.default_string @@ -2466,7 +2482,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -2478,7 +2494,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -2486,109 +2502,109 @@ -- field 401: fieldname1 v = t.fieldname1 if v ~= nil then n = n + 1; out[n] = "\x88\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 402: field_name2 v = t.field_name2 if v ~= nil then n = n + 1; out[n] = "\x90\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 403: _field_name3 v = t._field_name3 if v ~= nil then n = n + 1; out[n] = "\x98\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 404: field__name4_ v = t.field__name4_ if v ~= nil then n = n + 1; out[n] = "\xa0\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 405: field0name5 v = t.field0name5 if v ~= nil then n = n + 1; out[n] = "\xa8\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 406: field_0_name6 v = t.field_0_name6 if v ~= nil then n = n + 1; out[n] = "\xb0\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 407: fieldName7 v = t.fieldName7 if v ~= nil then n = n + 1; out[n] = "\xb8\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 408: FieldName8 v = t.FieldName8 if v ~= nil then n = n + 1; out[n] = "\xc0\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 409: field_Name9 v = t.field_Name9 if v ~= nil then n = n + 1; out[n] = "\xc8\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 410: Field_Name10 v = t.Field_Name10 if v ~= nil then n = n + 1; out[n] = "\xd0\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 411: FIELD_NAME11 v = t.FIELD_NAME11 if v ~= nil then n = n + 1; out[n] = "\xd8\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 412: FIELD_name12 v = t.FIELD_name12 if v ~= nil then n = n + 1; out[n] = "\xe0\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 413: __field_name13 v = t.__field_name13 if v ~= nil then n = n + 1; out[n] = "\xe8\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 414: __Field_name14 v = t.__Field_name14 if v ~= nil then n = n + 1; out[n] = "\xf0\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 415: field__name15 v = t.field__name15 if v ~= nil then n = n + 1; out[n] = "\xf8\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 416: field__Name16 v = t.field__Name16 if v ~= nil then n = n + 1; out[n] = "\x80\x1a" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 417: field_name17__ v = t.field_name17__ if v ~= nil then n = n + 1; out[n] = "\x88\x1a" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 418: Field_name18__ v = t.Field_name18__ if v ~= nil then n = n + 1; out[n] = "\x90\x1a" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end local _exts = t._extensions if _exts ~= nil then @@ -2612,6 +2628,26 @@ ---@param b string ---@return protobuf_test_messages.proto2.TestAllTypesProto2 function M.TestAllTypesProto2_decode(buf) + local decode_bool = wire.decode_bool + local decode_bytes = wire.decode_bytes + local decode_double = wire.decode_double + local decode_fixed32 = wire.decode_fixed32 + local decode_fixed64 = wire.decode_fixed64 + local decode_float = wire.decode_float + local decode_int32 = wire.decode_int32 + local decode_int64 = wire.decode_int64 + local decode_len = wire.decode_len + local decode_sfixed32 = wire.decode_sfixed32 + local decode_sfixed64 = wire.decode_sfixed64 + local decode_sint32 = wire.decode_sint32 + local decode_sint64 = wire.decode_sint64 + local decode_string = wire.decode_string + local decode_tag = wire.decode_tag + local decode_uint32 = wire.decode_uint32 + local decode_uint64 = wire.decode_uint64 + local decode_varint = wire.decode_varint + local skip_field = wire.skip_field + local varint_to_int32 = wire.varint_to_int32 local _d = M.TestAllTypesProto2_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -2683,59 +2719,59 @@ id = rshift(_b, 3) if id == 0 then error("illegal field number 0", 0) end pos = pos + 1 else - id, wt, pos = wire.decode_tag(buf, pos) + id, wt, pos = decode_tag(buf, pos) end if id == 1 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.optional_int32 = val elseif id == 2 then local val - val, pos = wire.decode_int64(buf, pos) + val, pos = decode_int64(buf, pos) result.optional_int64 = val elseif id == 3 then local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) result.optional_uint32 = val elseif id == 4 then local val - val, pos = wire.decode_uint64(buf, pos) + val, pos = decode_uint64(buf, pos) result.optional_uint64 = val elseif id == 5 then local val - val, pos = wire.decode_sint32(buf, pos) + val, pos = decode_sint32(buf, pos) result.optional_sint32 = val elseif id == 6 then local val - val, pos = wire.decode_sint64(buf, pos) + val, pos = decode_sint64(buf, pos) result.optional_sint64 = val elseif id == 7 then local val - val, pos = wire.decode_fixed32(buf, pos) + val, pos = decode_fixed32(buf, pos) result.optional_fixed32 = val elseif id == 8 then local val - val, pos = wire.decode_fixed64(buf, pos) + val, pos = decode_fixed64(buf, pos) result.optional_fixed64 = val elseif id == 9 then local val - val, pos = wire.decode_sfixed32(buf, pos) + val, pos = decode_sfixed32(buf, pos) result.optional_sfixed32 = val elseif id == 10 then local val - val, pos = wire.decode_sfixed64(buf, pos) + val, pos = decode_sfixed64(buf, pos) result.optional_sfixed64 = val elseif id == 11 then local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) result.optional_float = val elseif id == 12 then local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) result.optional_double = val elseif id == 13 then local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) result.optional_bool = val elseif id == 14 then local _lb = string_byte(buf, pos) @@ -2749,7 +2785,7 @@ result.optional_string = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.optional_string = val end elseif id == 15 then @@ -2763,12 +2799,12 @@ result.optional_bytes = _s pos = _epos else local val - val, pos = wire.decode_bytes(buf, pos) + val, pos = decode_bytes(buf, pos) result.optional_bytes = val end elseif id == 18 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.optional_nested_message if prev == nil then result.optional_nested_message = M.TestAllTypesProto2_NestedMessage_decode(payload) @@ -2777,7 +2813,7 @@ pb.codec.merge_message(M.TestAllTypesProto2_NestedMessage_descriptor, prev, M.TestAllTypesProto2_NestedMessage_decode(payload)) end elseif id == 19 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.optional_foreign_message if prev == nil then result.optional_foreign_message = M.ForeignMessageProto2_decode(payload) @@ -2786,12 +2822,12 @@ pb.codec.merge_message(M.ForeignMessageProto2_descriptor, prev, M.ForeignMessageProto2_decode(payload)) end elseif id == 21 then local u - u, pos = wire.decode_varint(buf, pos) - result.optional_nested_enum = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + result.optional_nested_enum = varint_to_int32(u) elseif id == 22 then local u - u, pos = wire.decode_varint(buf, pos) - result.optional_foreign_enum = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + result.optional_foreign_enum = varint_to_int32(u) elseif id == 24 then local _lb = string_byte(buf, pos) if _lb ~= nil and _lb < 0x80 then @@ -2804,7 +2840,7 @@ result.optional_string_piece = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.optional_string_piece = val end elseif id == 25 then @@ -2819,12 +2855,12 @@ result.optional_cord = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.optional_cord = val end elseif id == 27 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.recursive_message if prev == nil then result.recursive_message = M.TestAllTypesProto2_decode(payload) @@ -2836,16 +2872,16 @@ local list = result.repeated_int32 if list == nil then list = {}; result.repeated_int32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_repeated_int32 = _n_repeated_int32 + 1; list[_n_repeated_int32] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_repeated_int32 = _n_repeated_int32 + 1; list[_n_repeated_int32] = val end elseif id == 32 then @@ -2853,16 +2889,16 @@ local list = result.repeated_int64 if list == nil then list = {}; result.repeated_int64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int64(payload, p2) + val, p2 = decode_int64(payload, p2) _n_repeated_int64 = _n_repeated_int64 + 1; list[_n_repeated_int64] = val end else local val - val, pos = wire.decode_int64(buf, pos) + val, pos = decode_int64(buf, pos) _n_repeated_int64 = _n_repeated_int64 + 1; list[_n_repeated_int64] = val end elseif id == 33 then @@ -2870,16 +2906,16 @@ local list = result.repeated_uint32 if list == nil then list = {}; result.repeated_uint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_uint32(payload, p2) + val, p2 = decode_uint32(payload, p2) _n_repeated_uint32 = _n_repeated_uint32 + 1; list[_n_repeated_uint32] = val end else local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) _n_repeated_uint32 = _n_repeated_uint32 + 1; list[_n_repeated_uint32] = val end elseif id == 34 then @@ -2887,16 +2923,16 @@ local list = result.repeated_uint64 if list == nil then list = {}; result.repeated_uint64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_uint64(payload, p2) + val, p2 = decode_uint64(payload, p2) _n_repeated_uint64 = _n_repeated_uint64 + 1; list[_n_repeated_uint64] = val end else local val - val, pos = wire.decode_uint64(buf, pos) + val, pos = decode_uint64(buf, pos) _n_repeated_uint64 = _n_repeated_uint64 + 1; list[_n_repeated_uint64] = val end elseif id == 35 then @@ -2904,16 +2940,16 @@ local list = result.repeated_sint32 if list == nil then list = {}; result.repeated_sint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint32(payload, p2) + val, p2 = decode_sint32(payload, p2) _n_repeated_sint32 = _n_repeated_sint32 + 1; list[_n_repeated_sint32] = val end else local val - val, pos = wire.decode_sint32(buf, pos) + val, pos = decode_sint32(buf, pos) _n_repeated_sint32 = _n_repeated_sint32 + 1; list[_n_repeated_sint32] = val end elseif id == 36 then @@ -2921,16 +2957,16 @@ local list = result.repeated_sint64 if list == nil then list = {}; result.repeated_sint64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint64(payload, p2) + val, p2 = decode_sint64(payload, p2) _n_repeated_sint64 = _n_repeated_sint64 + 1; list[_n_repeated_sint64] = val end else local val - val, pos = wire.decode_sint64(buf, pos) + val, pos = decode_sint64(buf, pos) _n_repeated_sint64 = _n_repeated_sint64 + 1; list[_n_repeated_sint64] = val end elseif id == 37 then @@ -2938,16 +2974,16 @@ local list = result.repeated_fixed32 if list == nil then list = {}; result.repeated_fixed32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed32(payload, p2) + val, p2 = decode_fixed32(payload, p2) _n_repeated_fixed32 = _n_repeated_fixed32 + 1; list[_n_repeated_fixed32] = val end else local val - val, pos = wire.decode_fixed32(buf, pos) + val, pos = decode_fixed32(buf, pos) _n_repeated_fixed32 = _n_repeated_fixed32 + 1; list[_n_repeated_fixed32] = val end elseif id == 38 then @@ -2955,16 +2991,16 @@ local list = result.repeated_fixed64 if list == nil then list = {}; result.repeated_fixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed64(payload, p2) + val, p2 = decode_fixed64(payload, p2) _n_repeated_fixed64 = _n_repeated_fixed64 + 1; list[_n_repeated_fixed64] = val end else local val - val, pos = wire.decode_fixed64(buf, pos) + val, pos = decode_fixed64(buf, pos) _n_repeated_fixed64 = _n_repeated_fixed64 + 1; list[_n_repeated_fixed64] = val end elseif id == 39 then @@ -2972,16 +3008,16 @@ local list = result.repeated_sfixed32 if list == nil then list = {}; result.repeated_sfixed32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sfixed32(payload, p2) + val, p2 = decode_sfixed32(payload, p2) _n_repeated_sfixed32 = _n_repeated_sfixed32 + 1; list[_n_repeated_sfixed32] = val end else local val - val, pos = wire.decode_sfixed32(buf, pos) + val, pos = decode_sfixed32(buf, pos) _n_repeated_sfixed32 = _n_repeated_sfixed32 + 1; list[_n_repeated_sfixed32] = val end elseif id == 40 then @@ -2989,16 +3025,16 @@ local list = result.repeated_sfixed64 if list == nil then list = {}; result.repeated_sfixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sfixed64(payload, p2) + val, p2 = decode_sfixed64(payload, p2) _n_repeated_sfixed64 = _n_repeated_sfixed64 + 1; list[_n_repeated_sfixed64] = val end else local val - val, pos = wire.decode_sfixed64(buf, pos) + val, pos = decode_sfixed64(buf, pos) _n_repeated_sfixed64 = _n_repeated_sfixed64 + 1; list[_n_repeated_sfixed64] = val end elseif id == 41 then @@ -3006,16 +3042,16 @@ local list = result.repeated_float if list == nil then list = {}; result.repeated_float = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_float(payload, p2) + val, p2 = decode_float(payload, p2) _n_repeated_float = _n_repeated_float + 1; list[_n_repeated_float] = val end else local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) _n_repeated_float = _n_repeated_float + 1; list[_n_repeated_float] = val end elseif id == 42 then @@ -3023,16 +3059,16 @@ local list = result.repeated_double if list == nil then list = {}; result.repeated_double = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_double(payload, p2) + val, p2 = decode_double(payload, p2) _n_repeated_double = _n_repeated_double + 1; list[_n_repeated_double] = val end else local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) _n_repeated_double = _n_repeated_double + 1; list[_n_repeated_double] = val end elseif id == 43 then @@ -3040,16 +3076,16 @@ local list = result.repeated_bool if list == nil then list = {}; result.repeated_bool = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_bool(payload, p2) + val, p2 = decode_bool(payload, p2) _n_repeated_bool = _n_repeated_bool + 1; list[_n_repeated_bool] = val end else local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) _n_repeated_bool = _n_repeated_bool + 1; list[_n_repeated_bool] = val end elseif id == 44 then @@ -3066,7 +3102,7 @@ _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = val end elseif id == 45 then @@ -3082,54 +3118,54 @@ _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = _s pos = _epos else local val - val, pos = wire.decode_bytes(buf, pos) + val, pos = decode_bytes(buf, pos) _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = val end elseif id == 48 then local list = result.repeated_nested_message if list == nil then list = {}; result.repeated_nested_message = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_nested_message = _n_repeated_nested_message + 1; list[_n_repeated_nested_message] = M.TestAllTypesProto2_NestedMessage_decode(payload) elseif id == 49 then local list = result.repeated_foreign_message if list == nil then list = {}; result.repeated_foreign_message = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_foreign_message = _n_repeated_foreign_message + 1; list[_n_repeated_foreign_message] = M.ForeignMessageProto2_decode(payload) elseif id == 51 then local list = result.repeated_nested_enum if list == nil then list = {}; result.repeated_nested_enum = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local u - u, p2 = wire.decode_varint(payload, p2) - _n_repeated_nested_enum = _n_repeated_nested_enum + 1; list[_n_repeated_nested_enum] = wire.varint_to_int32(u) + u, p2 = decode_varint(payload, p2) + _n_repeated_nested_enum = _n_repeated_nested_enum + 1; list[_n_repeated_nested_enum] = varint_to_int32(u) end else local u - u, pos = wire.decode_varint(buf, pos) - _n_repeated_nested_enum = _n_repeated_nested_enum + 1; list[_n_repeated_nested_enum] = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + _n_repeated_nested_enum = _n_repeated_nested_enum + 1; list[_n_repeated_nested_enum] = varint_to_int32(u) end elseif id == 52 then local list = result.repeated_foreign_enum if list == nil then list = {}; result.repeated_foreign_enum = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local u - u, p2 = wire.decode_varint(payload, p2) - _n_repeated_foreign_enum = _n_repeated_foreign_enum + 1; list[_n_repeated_foreign_enum] = wire.varint_to_int32(u) + u, p2 = decode_varint(payload, p2) + _n_repeated_foreign_enum = _n_repeated_foreign_enum + 1; list[_n_repeated_foreign_enum] = varint_to_int32(u) end else local u - u, pos = wire.decode_varint(buf, pos) - _n_repeated_foreign_enum = _n_repeated_foreign_enum + 1; list[_n_repeated_foreign_enum] = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + _n_repeated_foreign_enum = _n_repeated_foreign_enum + 1; list[_n_repeated_foreign_enum] = varint_to_int32(u) end elseif id == 54 then local list = result.repeated_string_piece @@ -3145,7 +3181,7 @@ _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = val end elseif id == 55 then @@ -3162,7 +3198,7 @@ _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = val end elseif id == 75 then @@ -3170,16 +3206,16 @@ local list = result.packed_int32 if list == nil then list = {}; result.packed_int32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_packed_int32 = _n_packed_int32 + 1; list[_n_packed_int32] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_packed_int32 = _n_packed_int32 + 1; list[_n_packed_int32] = val end elseif id == 76 then @@ -3187,16 +3223,16 @@ local list = result.packed_int64 if list == nil then list = {}; result.packed_int64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int64(payload, p2) + val, p2 = decode_int64(payload, p2) _n_packed_int64 = _n_packed_int64 + 1; list[_n_packed_int64] = val end else local val - val, pos = wire.decode_int64(buf, pos) + val, pos = decode_int64(buf, pos) _n_packed_int64 = _n_packed_int64 + 1; list[_n_packed_int64] = val end elseif id == 77 then @@ -3204,16 +3240,16 @@ local list = result.packed_uint32 if list == nil then list = {}; result.packed_uint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_uint32(payload, p2) + val, p2 = decode_uint32(payload, p2) _n_packed_uint32 = _n_packed_uint32 + 1; list[_n_packed_uint32] = val end else local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) _n_packed_uint32 = _n_packed_uint32 + 1; list[_n_packed_uint32] = val end elseif id == 78 then @@ -3221,16 +3257,16 @@ local list = result.packed_uint64 if list == nil then list = {}; result.packed_uint64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_uint64(payload, p2) + val, p2 = decode_uint64(payload, p2) _n_packed_uint64 = _n_packed_uint64 + 1; list[_n_packed_uint64] = val end else local val - val, pos = wire.decode_uint64(buf, pos) + val, pos = decode_uint64(buf, pos) _n_packed_uint64 = _n_packed_uint64 + 1; list[_n_packed_uint64] = val end elseif id == 79 then @@ -3238,16 +3274,16 @@ local list = result.packed_sint32 if list == nil then list = {}; result.packed_sint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint32(payload, p2) + val, p2 = decode_sint32(payload, p2) _n_packed_sint32 = _n_packed_sint32 + 1; list[_n_packed_sint32] = val end else local val - val, pos = wire.decode_sint32(buf, pos) + val, pos = decode_sint32(buf, pos) _n_packed_sint32 = _n_packed_sint32 + 1; list[_n_packed_sint32] = val end elseif id == 80 then @@ -3255,16 +3291,16 @@ local list = result.packed_sint64 if list == nil then list = {}; result.packed_sint64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint64(payload, p2) + val, p2 = decode_sint64(payload, p2) _n_packed_sint64 = _n_packed_sint64 + 1; list[_n_packed_sint64] = val end else local val - val, pos = wire.decode_sint64(buf, pos) + val, pos = decode_sint64(buf, pos) _n_packed_sint64 = _n_packed_sint64 + 1; list[_n_packed_sint64] = val end elseif id == 81 then @@ -3272,16 +3308,16 @@ local list = result.packed_fixed32 if list == nil then list = {}; result.packed_fixed32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed32(payload, p2) + val, p2 = decode_fixed32(payload, p2) _n_packed_fixed32 = _n_packed_fixed32 + 1; list[_n_packed_fixed32] = val end else local val - val, pos = wire.decode_fixed32(buf, pos) + val, pos = decode_fixed32(buf, pos) _n_packed_fixed32 = _n_packed_fixed32 + 1; list[_n_packed_fixed32] = val end elseif id == 82 then @@ -3289,16 +3325,16 @@ local list = result.packed_fixed64 if list == nil then list = {}; result.packed_fixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed64(payload, p2) + val, p2 = decode_fixed64(payload, p2) _n_packed_fixed64 = _n_packed_fixed64 + 1; list[_n_packed_fixed64] = val end else local val - val, pos = wire.decode_fixed64(buf, pos) + val, pos = decode_fixed64(buf, pos) _n_packed_fixed64 = _n_packed_fixed64 + 1; list[_n_packed_fixed64] = val end elseif id == 83 then @@ -3306,16 +3342,16 @@ local list = result.packed_sfixed32 if list == nil then list = {}; result.packed_sfixed32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sfixed32(payload, p2) + val, p2 = decode_sfixed32(payload, p2) _n_packed_sfixed32 = _n_packed_sfixed32 + 1; list[_n_packed_sfixed32] = val end else local val - val, pos = wire.decode_sfixed32(buf, pos) + val, pos = decode_sfixed32(buf, pos) _n_packed_sfixed32 = _n_packed_sfixed32 + 1; list[_n_packed_sfixed32] = val end elseif id == 84 then @@ -3323,16 +3359,16 @@ local list = result.packed_sfixed64 if list == nil then list = {}; result.packed_sfixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sfixed64(payload, p2) + val, p2 = decode_sfixed64(payload, p2) _n_packed_sfixed64 = _n_packed_sfixed64 + 1; list[_n_packed_sfixed64] = val end else local val - val, pos = wire.decode_sfixed64(buf, pos) + val, pos = decode_sfixed64(buf, pos) _n_packed_sfixed64 = _n_packed_sfixed64 + 1; list[_n_packed_sfixed64] = val end elseif id == 85 then @@ -3340,16 +3376,16 @@ local list = result.packed_float if list == nil then list = {}; result.packed_float = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_float(payload, p2) + val, p2 = decode_float(payload, p2) _n_packed_float = _n_packed_float + 1; list[_n_packed_float] = val end else local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) _n_packed_float = _n_packed_float + 1; list[_n_packed_float] = val end elseif id == 86 then @@ -3357,16 +3393,16 @@ local list = result.packed_double if list == nil then list = {}; result.packed_double = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_double(payload, p2) + val, p2 = decode_double(payload, p2) _n_packed_double = _n_packed_double + 1; list[_n_packed_double] = val end else local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) _n_packed_double = _n_packed_double + 1; list[_n_packed_double] = val end elseif id == 87 then @@ -3374,16 +3410,16 @@ local list = result.packed_bool if list == nil then list = {}; result.packed_bool = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_bool(payload, p2) + val, p2 = decode_bool(payload, p2) _n_packed_bool = _n_packed_bool + 1; list[_n_packed_bool] = val end else local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) _n_packed_bool = _n_packed_bool + 1; list[_n_packed_bool] = val end elseif id == 88 then @@ -3391,33 +3427,33 @@ local list = result.packed_nested_enum if list == nil then list = {}; result.packed_nested_enum = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local u - u, p2 = wire.decode_varint(payload, p2) - _n_packed_nested_enum = _n_packed_nested_enum + 1; list[_n_packed_nested_enum] = wire.varint_to_int32(u) + u, p2 = decode_varint(payload, p2) + _n_packed_nested_enum = _n_packed_nested_enum + 1; list[_n_packed_nested_enum] = varint_to_int32(u) end else local u - u, pos = wire.decode_varint(buf, pos) - _n_packed_nested_enum = _n_packed_nested_enum + 1; list[_n_packed_nested_enum] = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + _n_packed_nested_enum = _n_packed_nested_enum + 1; list[_n_packed_nested_enum] = varint_to_int32(u) end elseif id == 89 then local list = result.unpacked_int32 if list == nil then list = {}; result.unpacked_int32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_unpacked_int32 = _n_unpacked_int32 + 1; list[_n_unpacked_int32] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_unpacked_int32 = _n_unpacked_int32 + 1; list[_n_unpacked_int32] = val end elseif id == 90 then @@ -3425,16 +3461,16 @@ local list = result.unpacked_int64 if list == nil then list = {}; result.unpacked_int64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int64(payload, p2) + val, p2 = decode_int64(payload, p2) _n_unpacked_int64 = _n_unpacked_int64 + 1; list[_n_unpacked_int64] = val end else local val - val, pos = wire.decode_int64(buf, pos) + val, pos = decode_int64(buf, pos) _n_unpacked_int64 = _n_unpacked_int64 + 1; list[_n_unpacked_int64] = val end elseif id == 91 then @@ -3442,16 +3478,16 @@ local list = result.unpacked_uint32 if list == nil then list = {}; result.unpacked_uint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_uint32(payload, p2) + val, p2 = decode_uint32(payload, p2) _n_unpacked_uint32 = _n_unpacked_uint32 + 1; list[_n_unpacked_uint32] = val end else local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) _n_unpacked_uint32 = _n_unpacked_uint32 + 1; list[_n_unpacked_uint32] = val end elseif id == 92 then @@ -3459,16 +3495,16 @@ local list = result.unpacked_uint64 if list == nil then list = {}; result.unpacked_uint64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_uint64(payload, p2) + val, p2 = decode_uint64(payload, p2) _n_unpacked_uint64 = _n_unpacked_uint64 + 1; list[_n_unpacked_uint64] = val end else local val - val, pos = wire.decode_uint64(buf, pos) + val, pos = decode_uint64(buf, pos) _n_unpacked_uint64 = _n_unpacked_uint64 + 1; list[_n_unpacked_uint64] = val end elseif id == 93 then @@ -3476,16 +3512,16 @@ local list = result.unpacked_sint32 if list == nil then list = {}; result.unpacked_sint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint32(payload, p2) + val, p2 = decode_sint32(payload, p2) _n_unpacked_sint32 = _n_unpacked_sint32 + 1; list[_n_unpacked_sint32] = val end else local val - val, pos = wire.decode_sint32(buf, pos) + val, pos = decode_sint32(buf, pos) _n_unpacked_sint32 = _n_unpacked_sint32 + 1; list[_n_unpacked_sint32] = val end elseif id == 94 then @@ -3493,16 +3529,16 @@ local list = result.unpacked_sint64 if list == nil then list = {}; result.unpacked_sint64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint64(payload, p2) + val, p2 = decode_sint64(payload, p2) _n_unpacked_sint64 = _n_unpacked_sint64 + 1; list[_n_unpacked_sint64] = val end else local val - val, pos = wire.decode_sint64(buf, pos) + val, pos = decode_sint64(buf, pos) _n_unpacked_sint64 = _n_unpacked_sint64 + 1; list[_n_unpacked_sint64] = val end elseif id == 95 then @@ -3510,16 +3546,16 @@ local list = result.unpacked_fixed32 if list == nil then list = {}; result.unpacked_fixed32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed32(payload, p2) + val, p2 = decode_fixed32(payload, p2) _n_unpacked_fixed32 = _n_unpacked_fixed32 + 1; list[_n_unpacked_fixed32] = val end else local val - val, pos = wire.decode_fixed32(buf, pos) + val, pos = decode_fixed32(buf, pos) _n_unpacked_fixed32 = _n_unpacked_fixed32 + 1; list[_n_unpacked_fixed32] = val end elseif id == 96 then @@ -3527,16 +3563,16 @@ local list = result.unpacked_fixed64 if list == nil then list = {}; result.unpacked_fixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed64(payload, p2) + val, p2 = decode_fixed64(payload, p2) _n_unpacked_fixed64 = _n_unpacked_fixed64 + 1; list[_n_unpacked_fixed64] = val end else local val - val, pos = wire.decode_fixed64(buf, pos) + val, pos = decode_fixed64(buf, pos) _n_unpacked_fixed64 = _n_unpacked_fixed64 + 1; list[_n_unpacked_fixed64] = val end elseif id == 97 then @@ -3544,16 +3580,16 @@ local list = result.unpacked_sfixed32 if list == nil then list = {}; result.unpacked_sfixed32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sfixed32(payload, p2) + val, p2 = decode_sfixed32(payload, p2) _n_unpacked_sfixed32 = _n_unpacked_sfixed32 + 1; list[_n_unpacked_sfixed32] = val end else local val - val, pos = wire.decode_sfixed32(buf, pos) + val, pos = decode_sfixed32(buf, pos) _n_unpacked_sfixed32 = _n_unpacked_sfixed32 + 1; list[_n_unpacked_sfixed32] = val end elseif id == 98 then @@ -3561,16 +3597,16 @@ local list = result.unpacked_sfixed64 if list == nil then list = {}; result.unpacked_sfixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sfixed64(payload, p2) + val, p2 = decode_sfixed64(payload, p2) _n_unpacked_sfixed64 = _n_unpacked_sfixed64 + 1; list[_n_unpacked_sfixed64] = val end else local val - val, pos = wire.decode_sfixed64(buf, pos) + val, pos = decode_sfixed64(buf, pos) _n_unpacked_sfixed64 = _n_unpacked_sfixed64 + 1; list[_n_unpacked_sfixed64] = val end elseif id == 99 then @@ -3578,16 +3614,16 @@ local list = result.unpacked_float if list == nil then list = {}; result.unpacked_float = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_float(payload, p2) + val, p2 = decode_float(payload, p2) _n_unpacked_float = _n_unpacked_float + 1; list[_n_unpacked_float] = val end else local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) _n_unpacked_float = _n_unpacked_float + 1; list[_n_unpacked_float] = val end elseif id == 100 then @@ -3595,16 +3631,16 @@ local list = result.unpacked_double if list == nil then list = {}; result.unpacked_double = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_double(payload, p2) + val, p2 = decode_double(payload, p2) _n_unpacked_double = _n_unpacked_double + 1; list[_n_unpacked_double] = val end else local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) _n_unpacked_double = _n_unpacked_double + 1; list[_n_unpacked_double] = val end elseif id == 101 then @@ -3612,16 +3648,16 @@ local list = result.unpacked_bool if list == nil then list = {}; result.unpacked_bool = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_bool(payload, p2) + val, p2 = decode_bool(payload, p2) _n_unpacked_bool = _n_unpacked_bool + 1; list[_n_unpacked_bool] = val end else local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) _n_unpacked_bool = _n_unpacked_bool + 1; list[_n_unpacked_bool] = val end elseif id == 102 then @@ -3629,34 +3665,34 @@ local list = result.unpacked_nested_enum if list == nil then list = {}; result.unpacked_nested_enum = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local u - u, p2 = wire.decode_varint(payload, p2) - _n_unpacked_nested_enum = _n_unpacked_nested_enum + 1; list[_n_unpacked_nested_enum] = wire.varint_to_int32(u) + u, p2 = decode_varint(payload, p2) + _n_unpacked_nested_enum = _n_unpacked_nested_enum + 1; list[_n_unpacked_nested_enum] = varint_to_int32(u) end else local u - u, pos = wire.decode_varint(buf, pos) - _n_unpacked_nested_enum = _n_unpacked_nested_enum + 1; list[_n_unpacked_nested_enum] = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + _n_unpacked_nested_enum = _n_unpacked_nested_enum + 1; list[_n_unpacked_nested_enum] = varint_to_int32(u) end elseif id == 56 then local map = result.map_int32_int32 if map == nil then map = {}; result.map_int32_int32 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_int32(payload, _ep) + _key, _ep = decode_int32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_int32(payload, _ep) + _val, _ep = decode_int32(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3664,18 +3700,18 @@ elseif id == 57 then local map = result.map_int64_int64 if map == nil then map = {}; result.map_int64_int64 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_int64(payload, _ep) + _key, _ep = decode_int64(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_int64(payload, _ep) + _val, _ep = decode_int64(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end for _k in pairs(map) do @@ -3686,18 +3722,18 @@ elseif id == 58 then local map = result.map_uint32_uint32 if map == nil then map = {}; result.map_uint32_uint32 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_uint32(payload, _ep) + _key, _ep = decode_uint32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_uint32(payload, _ep) + _val, _ep = decode_uint32(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3705,18 +3741,18 @@ elseif id == 59 then local map = result.map_uint64_uint64 if map == nil then map = {}; result.map_uint64_uint64 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_uint64(payload, _ep) + _key, _ep = decode_uint64(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_uint64(payload, _ep) + _val, _ep = decode_uint64(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end for _k in pairs(map) do @@ -3727,18 +3763,18 @@ elseif id == 60 then local map = result.map_sint32_sint32 if map == nil then map = {}; result.map_sint32_sint32 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_sint32(payload, _ep) + _key, _ep = decode_sint32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_sint32(payload, _ep) + _val, _ep = decode_sint32(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3746,18 +3782,18 @@ elseif id == 61 then local map = result.map_sint64_sint64 if map == nil then map = {}; result.map_sint64_sint64 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_sint64(payload, _ep) + _key, _ep = decode_sint64(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_sint64(payload, _ep) + _val, _ep = decode_sint64(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end for _k in pairs(map) do @@ -3768,18 +3804,18 @@ elseif id == 62 then local map = result.map_fixed32_fixed32 if map == nil then map = {}; result.map_fixed32_fixed32 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_fixed32(payload, _ep) + _key, _ep = decode_fixed32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_fixed32(payload, _ep) + _val, _ep = decode_fixed32(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3787,18 +3823,18 @@ elseif id == 63 then local map = result.map_fixed64_fixed64 if map == nil then map = {}; result.map_fixed64_fixed64 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_fixed64(payload, _ep) + _key, _ep = decode_fixed64(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_fixed64(payload, _ep) + _val, _ep = decode_fixed64(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end for _k in pairs(map) do @@ -3809,18 +3845,18 @@ elseif id == 64 then local map = result.map_sfixed32_sfixed32 if map == nil then map = {}; result.map_sfixed32_sfixed32 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_sfixed32(payload, _ep) + _key, _ep = decode_sfixed32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_sfixed32(payload, _ep) + _val, _ep = decode_sfixed32(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3828,18 +3864,18 @@ elseif id == 65 then local map = result.map_sfixed64_sfixed64 if map == nil then map = {}; result.map_sfixed64_sfixed64 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_sfixed64(payload, _ep) + _key, _ep = decode_sfixed64(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_sfixed64(payload, _ep) + _val, _ep = decode_sfixed64(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end for _k in pairs(map) do @@ -3850,18 +3886,18 @@ elseif id == 104 then local map = result.map_int32_bool if map == nil then map = {}; result.map_int32_bool = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, false while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_int32(payload, _ep) + _key, _ep = decode_int32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_bool(payload, _ep) + _val, _ep = decode_bool(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3869,18 +3905,18 @@ elseif id == 66 then local map = result.map_int32_float if map == nil then map = {}; result.map_int32_float = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_int32(payload, _ep) + _key, _ep = decode_int32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_float(payload, _ep) + _val, _ep = decode_float(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3888,18 +3924,18 @@ elseif id == 67 then local map = result.map_int32_double if map == nil then map = {}; result.map_int32_double = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_int32(payload, _ep) + _key, _ep = decode_int32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_double(payload, _ep) + _val, _ep = decode_double(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3907,20 +3943,20 @@ elseif id == 103 then local map = result.map_int32_nested_message if map == nil then map = {}; result.map_int32_nested_message = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, {} while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_int32(payload, _ep) + _key, _ep = decode_int32(payload, _ep) elseif eid == 2 then local _payload - _payload, _ep = wire.decode_len(payload, _ep) + _payload, _ep = decode_len(payload, _ep) _val = M.TestAllTypesProto2_NestedMessage_decode(_payload) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3928,18 +3964,18 @@ elseif id == 68 then local map = result.map_bool_bool if map == nil then map = {}; result.map_bool_bool = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = false, false while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_bool(payload, _ep) + _key, _ep = decode_bool(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_bool(payload, _ep) + _val, _ep = decode_bool(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3947,18 +3983,18 @@ elseif id == 69 then local map = result.map_string_string if map == nil then map = {}; result.map_string_string = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', '' while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_string(payload, _ep) + _val, _ep = decode_string(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3966,18 +4002,18 @@ elseif id == 70 then local map = result.map_string_bytes if map == nil then map = {}; result.map_string_bytes = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', '' while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_bytes(payload, _ep) + _val, _ep = decode_bytes(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3985,20 +4021,20 @@ elseif id == 71 then local map = result.map_string_nested_message if map == nil then map = {}; result.map_string_nested_message = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', {} while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then local _payload - _payload, _ep = wire.decode_len(payload, _ep) + _payload, _ep = decode_len(payload, _ep) _val = M.TestAllTypesProto2_NestedMessage_decode(_payload) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -4006,20 +4042,20 @@ elseif id == 72 then local map = result.map_string_foreign_message if map == nil then map = {}; result.map_string_foreign_message = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', {} while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then local _payload - _payload, _ep = wire.decode_len(payload, _ep) + _payload, _ep = decode_len(payload, _ep) _val = M.ForeignMessageProto2_decode(_payload) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -4027,20 +4063,20 @@ elseif id == 73 then local map = result.map_string_nested_enum if map == nil then map = {}; result.map_string_nested_enum = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then local _u - _u, _ep = wire.decode_varint(payload, _ep) - _val = wire.varint_to_int32(_u) + _u, _ep = decode_varint(payload, _ep) + _val = varint_to_int32(_u) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -4048,26 +4084,26 @@ elseif id == 74 then local map = result.map_string_foreign_enum if map == nil then map = {}; result.map_string_foreign_enum = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then local _u - _u, _ep = wire.decode_varint(payload, _ep) - _val = wire.varint_to_int32(_u) + _u, _ep = decode_varint(payload, _ep) + _val = varint_to_int32(_u) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val elseif id == 111 then local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) result.oneof_uint32 = val result.oneof_nested_message = nil result.oneof_string = nil @@ -4079,7 +4115,7 @@ result.oneof_double = nil result.oneof_enum = nil elseif id == 112 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.oneof_nested_message if prev == nil then result.oneof_nested_message = M.TestAllTypesProto2_NestedMessage_decode(payload) @@ -4106,7 +4142,7 @@ result.oneof_string = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.oneof_string = val end result.oneof_uint32 = nil @@ -4128,7 +4164,7 @@ result.oneof_bytes = _s pos = _epos else local val - val, pos = wire.decode_bytes(buf, pos) + val, pos = decode_bytes(buf, pos) result.oneof_bytes = val end result.oneof_uint32 = nil @@ -4141,7 +4177,7 @@ result.oneof_double = nil result.oneof_enum = nil elseif id == 115 then local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) result.oneof_bool = val result.oneof_uint32 = nil result.oneof_nested_message = nil @@ -4153,7 +4189,7 @@ result.oneof_double = nil result.oneof_enum = nil elseif id == 116 then local val - val, pos = wire.decode_uint64(buf, pos) + val, pos = decode_uint64(buf, pos) result.oneof_uint64 = val result.oneof_uint32 = nil result.oneof_nested_message = nil @@ -4165,7 +4201,7 @@ result.oneof_double = nil result.oneof_enum = nil elseif id == 117 then local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) result.oneof_float = val result.oneof_uint32 = nil result.oneof_nested_message = nil @@ -4177,7 +4213,7 @@ result.oneof_double = nil result.oneof_enum = nil elseif id == 118 then local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) result.oneof_double = val result.oneof_uint32 = nil result.oneof_nested_message = nil @@ -4189,8 +4225,8 @@ result.oneof_float = nil result.oneof_enum = nil elseif id == 119 then local u - u, pos = wire.decode_varint(buf, pos) - result.oneof_enum = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + result.oneof_enum = varint_to_int32(u) result.oneof_uint32 = nil result.oneof_nested_message = nil result.oneof_string = nil @@ -4219,55 +4255,55 @@ pb.codec.merge_message(M.TestAllTypesProto2_MultiWordGroupField_descriptor, prev, payload) end elseif id == 241 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.default_int32 = val elseif id == 242 then local val - val, pos = wire.decode_int64(buf, pos) + val, pos = decode_int64(buf, pos) result.default_int64 = val elseif id == 243 then local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) result.default_uint32 = val elseif id == 244 then local val - val, pos = wire.decode_uint64(buf, pos) + val, pos = decode_uint64(buf, pos) result.default_uint64 = val elseif id == 245 then local val - val, pos = wire.decode_sint32(buf, pos) + val, pos = decode_sint32(buf, pos) result.default_sint32 = val elseif id == 246 then local val - val, pos = wire.decode_sint64(buf, pos) + val, pos = decode_sint64(buf, pos) result.default_sint64 = val elseif id == 247 then local val - val, pos = wire.decode_fixed32(buf, pos) + val, pos = decode_fixed32(buf, pos) result.default_fixed32 = val elseif id == 248 then local val - val, pos = wire.decode_fixed64(buf, pos) + val, pos = decode_fixed64(buf, pos) result.default_fixed64 = val elseif id == 249 then local val - val, pos = wire.decode_sfixed32(buf, pos) + val, pos = decode_sfixed32(buf, pos) result.default_sfixed32 = val elseif id == 250 then local val - val, pos = wire.decode_sfixed64(buf, pos) + val, pos = decode_sfixed64(buf, pos) result.default_sfixed64 = val elseif id == 251 then local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) result.default_float = val elseif id == 252 then local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) result.default_double = val elseif id == 253 then local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) result.default_bool = val elseif id == 254 then local _lb = string_byte(buf, pos) @@ -4281,7 +4317,7 @@ result.default_string = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.default_string = val end elseif id == 255 then @@ -4295,80 +4331,80 @@ result.default_bytes = _s pos = _epos else local val - val, pos = wire.decode_bytes(buf, pos) + val, pos = decode_bytes(buf, pos) result.default_bytes = val end elseif id == 401 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.fieldname1 = val elseif id == 402 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field_name2 = val elseif id == 403 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result._field_name3 = val elseif id == 404 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field__name4_ = val elseif id == 405 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field0name5 = val elseif id == 406 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field_0_name6 = val elseif id == 407 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.fieldName7 = val elseif id == 408 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.FieldName8 = val elseif id == 409 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field_Name9 = val elseif id == 410 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.Field_Name10 = val elseif id == 411 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.FIELD_NAME11 = val elseif id == 412 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.FIELD_name12 = val elseif id == 413 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.__field_name13 = val elseif id == 414 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.__Field_name14 = val elseif id == 415 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field__name15 = val elseif id == 416 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field__Name16 = val elseif id == 417 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field_name17__ = val elseif id == 418 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.Field_name18__ = val else local _ebid = M.TestAllTypesProto2_descriptor.extensions_by_id @@ -4376,7 +4412,7 @@ local _ext = _ebid and _ebid[id] or nil if _ext ~= nil then pos = pb.codec.decode_extension(_ext, buf, pos, wt, result) else - pos = wire.skip_field(buf, pos, wt, id) + pos = skip_field(buf, pos, wt, id) if _uf == nil then _uf = {} end _uf[#_uf + 1] = buf:sub(_tag_start, pos - 1) end @@ -5268,6 +5304,8 @@ ---@param t protobuf_test_messages.proto2.UnknownToTestAllTypes ---@return string function M.UnknownToTestAllTypes_encode(t) + local encode_int32 = wire.encode_int32 + local encode_varint = wire.encode_varint local _d = M.UnknownToTestAllTypes_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -5282,7 +5320,7 @@ -- field 1001: optional_int32 v = t.optional_int32 if v ~= nil then n = n + 1; out[n] = "\xc8\x3e" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 1002: optional_string v = t.optional_string @@ -5292,7 +5330,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -5305,7 +5343,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -5328,7 +5366,7 @@ if v ~= nil and #v > 0 then local _tag = "\x98\x3f" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_int32(v[_i]) + n = n + 1; out[n] = encode_int32(v[_i]) end end local _exts = t._extensions @@ -5353,6 +5391,8 @@ ---@param b string ---@return protobuf_test_messages.proto2.UnknownToTestAllTypes function M.UnknownToTestAllTypes_decode(buf) + local decode_int32 = wire.decode_int32 + local decode_len = wire.decode_len local _d = M.UnknownToTestAllTypes_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -5380,7 +5420,7 @@ id, wt, pos = wire.decode_tag(buf, pos) end if id == 1001 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.optional_int32 = val elseif id == 1002 then local _lb = string_byte(buf, pos) @@ -5399,7 +5439,7 @@ result.optional_string = val end elseif id == 1003 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.nested_message if prev == nil then result.nested_message = M.ForeignMessageProto2_decode(payload) @@ -5424,16 +5464,16 @@ local list = result.repeated_int32 if list == nil then list = {}; result.repeated_int32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_repeated_int32 = _n_repeated_int32 + 1; list[_n_repeated_int32] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_repeated_int32 = _n_repeated_int32 + 1; list[_n_repeated_int32] = val end else @@ -5889,6 +5929,7 @@ ---@param t protobuf_test_messages.proto2.ProtoWithKeywords ---@return string function M.ProtoWithKeywords_encode(t) + local encode_varint = wire.encode_varint local _d = M.ProtoWithKeywords_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -5913,7 +5954,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -5928,7 +5969,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -5955,6 +5996,7 @@ ---@param b string ---@return protobuf_test_messages.proto2.ProtoWithKeywords function M.ProtoWithKeywords_decode(buf) + local decode_string = wire.decode_string local _d = M.ProtoWithKeywords_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -5996,7 +6038,7 @@ result.concept = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.concept = val end elseif id == 3 then @@ -6013,7 +6055,7 @@ _n_requires = _n_requires + 1; list[_n_requires] = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) _n_requires = _n_requires + 1; list[_n_requires] = val end else @@ -6057,6 +6099,20 @@ ---@param t protobuf_test_messages.proto2.TestAllRequiredTypesProto2 ---@return string function M.TestAllRequiredTypesProto2_encode(t) + local encode_bool = wire.encode_bool + local encode_double = wire.encode_double + local encode_fixed32 = wire.encode_fixed32 + local encode_fixed64 = wire.encode_fixed64 + local encode_float = wire.encode_float + local encode_int32 = wire.encode_int32 + local encode_int64 = wire.encode_int64 + local encode_sfixed32 = wire.encode_sfixed32 + local encode_sfixed64 = wire.encode_sfixed64 + local encode_sint32 = wire.encode_sint32 + local encode_sint64 = wire.encode_sint64 + local encode_uint32 = wire.encode_uint32 + local encode_uint64 = wire.encode_uint64 + local encode_varint = wire.encode_varint local _d = M.TestAllRequiredTypesProto2_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -6073,91 +6129,91 @@ if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.required_int32", 0) end n = n + 1; out[n] = "\x08" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) -- field 2: required_int64 v = t.required_int64 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.required_int64", 0) end n = n + 1; out[n] = "\x10" - n = n + 1; out[n] = wire.encode_int64(v) + n = n + 1; out[n] = encode_int64(v) -- field 3: required_uint32 v = t.required_uint32 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.required_uint32", 0) end n = n + 1; out[n] = "\x18" - n = n + 1; out[n] = wire.encode_uint32(v) + n = n + 1; out[n] = encode_uint32(v) -- field 4: required_uint64 v = t.required_uint64 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.required_uint64", 0) end n = n + 1; out[n] = "\x20" - n = n + 1; out[n] = wire.encode_uint64(v) + n = n + 1; out[n] = encode_uint64(v) -- field 5: required_sint32 v = t.required_sint32 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.required_sint32", 0) end n = n + 1; out[n] = "\x28" - n = n + 1; out[n] = wire.encode_sint32(v) + n = n + 1; out[n] = encode_sint32(v) -- field 6: required_sint64 v = t.required_sint64 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.required_sint64", 0) end n = n + 1; out[n] = "\x30" - n = n + 1; out[n] = wire.encode_sint64(v) + n = n + 1; out[n] = encode_sint64(v) -- field 7: required_fixed32 v = t.required_fixed32 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.required_fixed32", 0) end n = n + 1; out[n] = "\x3d" - n = n + 1; out[n] = wire.encode_fixed32(v) + n = n + 1; out[n] = encode_fixed32(v) -- field 8: required_fixed64 v = t.required_fixed64 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.required_fixed64", 0) end n = n + 1; out[n] = "\x41" - n = n + 1; out[n] = wire.encode_fixed64(v) + n = n + 1; out[n] = encode_fixed64(v) -- field 9: required_sfixed32 v = t.required_sfixed32 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.required_sfixed32", 0) end n = n + 1; out[n] = "\x4d" - n = n + 1; out[n] = wire.encode_sfixed32(v) + n = n + 1; out[n] = encode_sfixed32(v) -- field 10: required_sfixed64 v = t.required_sfixed64 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.required_sfixed64", 0) end n = n + 1; out[n] = "\x51" - n = n + 1; out[n] = wire.encode_sfixed64(v) + n = n + 1; out[n] = encode_sfixed64(v) -- field 11: required_float v = t.required_float if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.required_float", 0) end n = n + 1; out[n] = "\x5d" - n = n + 1; out[n] = wire.encode_float(v) + n = n + 1; out[n] = encode_float(v) -- field 12: required_double v = t.required_double if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.required_double", 0) end n = n + 1; out[n] = "\x61" - n = n + 1; out[n] = wire.encode_double(v) + n = n + 1; out[n] = encode_double(v) -- field 13: required_bool v = t.required_bool if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.required_bool", 0) end n = n + 1; out[n] = "\x68" - n = n + 1; out[n] = wire.encode_bool(v) + n = n + 1; out[n] = encode_bool(v) -- field 14: required_string v = t.required_string if v == nil then @@ -6168,7 +6224,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v -- field 15: required_bytes @@ -6181,7 +6237,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v -- field 18: required_nested_message @@ -6195,7 +6251,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b -- field 19: required_foreign_message @@ -6209,7 +6265,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b -- field 21: required_nested_enum @@ -6224,7 +6280,7 @@ nv = M.TestAllRequiredTypesProto2_NestedEnum[v] if nv == nil then error("unknown enum value '" .. v .. "' for protobuf_test_messages.proto2.TestAllRequiredTypesProto2.NestedEnum", 0) end end n = n + 1; out[n] = "\xa8\x01" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end -- field 22: required_foreign_enum v = t.required_foreign_enum @@ -6238,7 +6294,7 @@ nv = M.ForeignEnumProto2[v] if nv == nil then error("unknown enum value '" .. v .. "' for protobuf_test_messages.proto2.ForeignEnumProto2", 0) end end n = n + 1; out[n] = "\xb0\x01" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end -- field 24: required_string_piece v = t.required_string_piece @@ -6250,7 +6306,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v -- field 25: required_cord @@ -6263,7 +6319,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v -- field 27: recursive_message @@ -6277,7 +6333,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b -- field 28: optional_recursive_message @@ -6289,7 +6345,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -6304,7 +6360,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b -- field 241: default_int32 @@ -6313,91 +6369,91 @@ if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.default_int32", 0) end n = n + 1; out[n] = "\x88\x0f" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) -- field 242: default_int64 v = t.default_int64 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.default_int64", 0) end n = n + 1; out[n] = "\x90\x0f" - n = n + 1; out[n] = wire.encode_int64(v) + n = n + 1; out[n] = encode_int64(v) -- field 243: default_uint32 v = t.default_uint32 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.default_uint32", 0) end n = n + 1; out[n] = "\x98\x0f" - n = n + 1; out[n] = wire.encode_uint32(v) + n = n + 1; out[n] = encode_uint32(v) -- field 244: default_uint64 v = t.default_uint64 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.default_uint64", 0) end n = n + 1; out[n] = "\xa0\x0f" - n = n + 1; out[n] = wire.encode_uint64(v) + n = n + 1; out[n] = encode_uint64(v) -- field 245: default_sint32 v = t.default_sint32 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.default_sint32", 0) end n = n + 1; out[n] = "\xa8\x0f" - n = n + 1; out[n] = wire.encode_sint32(v) + n = n + 1; out[n] = encode_sint32(v) -- field 246: default_sint64 v = t.default_sint64 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.default_sint64", 0) end n = n + 1; out[n] = "\xb0\x0f" - n = n + 1; out[n] = wire.encode_sint64(v) + n = n + 1; out[n] = encode_sint64(v) -- field 247: default_fixed32 v = t.default_fixed32 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.default_fixed32", 0) end n = n + 1; out[n] = "\xbd\x0f" - n = n + 1; out[n] = wire.encode_fixed32(v) + n = n + 1; out[n] = encode_fixed32(v) -- field 248: default_fixed64 v = t.default_fixed64 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.default_fixed64", 0) end n = n + 1; out[n] = "\xc1\x0f" - n = n + 1; out[n] = wire.encode_fixed64(v) + n = n + 1; out[n] = encode_fixed64(v) -- field 249: default_sfixed32 v = t.default_sfixed32 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.default_sfixed32", 0) end n = n + 1; out[n] = "\xcd\x0f" - n = n + 1; out[n] = wire.encode_sfixed32(v) + n = n + 1; out[n] = encode_sfixed32(v) -- field 250: default_sfixed64 v = t.default_sfixed64 if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.default_sfixed64", 0) end n = n + 1; out[n] = "\xd1\x0f" - n = n + 1; out[n] = wire.encode_sfixed64(v) + n = n + 1; out[n] = encode_sfixed64(v) -- field 251: default_float v = t.default_float if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.default_float", 0) end n = n + 1; out[n] = "\xdd\x0f" - n = n + 1; out[n] = wire.encode_float(v) + n = n + 1; out[n] = encode_float(v) -- field 252: default_double v = t.default_double if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.default_double", 0) end n = n + 1; out[n] = "\xe1\x0f" - n = n + 1; out[n] = wire.encode_double(v) + n = n + 1; out[n] = encode_double(v) -- field 253: default_bool v = t.default_bool if v == nil then error("required field missing on encode: protobuf_test_messages.proto2.TestAllRequiredTypesProto2.default_bool", 0) end n = n + 1; out[n] = "\xe8\x0f" - n = n + 1; out[n] = wire.encode_bool(v) + n = n + 1; out[n] = encode_bool(v) -- field 254: default_string v = t.default_string if v == nil then @@ -6408,7 +6464,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v -- field 255: default_bytes @@ -6421,7 +6477,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v local _exts = t._extensions @@ -6446,6 +6502,24 @@ ---@param b string ---@return protobuf_test_messages.proto2.TestAllRequiredTypesProto2 function M.TestAllRequiredTypesProto2_decode(buf) + local decode_bool = wire.decode_bool + local decode_bytes = wire.decode_bytes + local decode_double = wire.decode_double + local decode_fixed32 = wire.decode_fixed32 + local decode_fixed64 = wire.decode_fixed64 + local decode_float = wire.decode_float + local decode_int32 = wire.decode_int32 + local decode_int64 = wire.decode_int64 + local decode_len = wire.decode_len + local decode_sfixed32 = wire.decode_sfixed32 + local decode_sfixed64 = wire.decode_sfixed64 + local decode_sint32 = wire.decode_sint32 + local decode_sint64 = wire.decode_sint64 + local decode_string = wire.decode_string + local decode_uint32 = wire.decode_uint32 + local decode_uint64 = wire.decode_uint64 + local decode_varint = wire.decode_varint + local varint_to_int32 = wire.varint_to_int32 local _d = M.TestAllRequiredTypesProto2_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -6472,55 +6546,55 @@ id, wt, pos = wire.decode_tag(buf, pos) end if id == 1 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.required_int32 = val elseif id == 2 then local val - val, pos = wire.decode_int64(buf, pos) + val, pos = decode_int64(buf, pos) result.required_int64 = val elseif id == 3 then local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) result.required_uint32 = val elseif id == 4 then local val - val, pos = wire.decode_uint64(buf, pos) + val, pos = decode_uint64(buf, pos) result.required_uint64 = val elseif id == 5 then local val - val, pos = wire.decode_sint32(buf, pos) + val, pos = decode_sint32(buf, pos) result.required_sint32 = val elseif id == 6 then local val - val, pos = wire.decode_sint64(buf, pos) + val, pos = decode_sint64(buf, pos) result.required_sint64 = val elseif id == 7 then local val - val, pos = wire.decode_fixed32(buf, pos) + val, pos = decode_fixed32(buf, pos) result.required_fixed32 = val elseif id == 8 then local val - val, pos = wire.decode_fixed64(buf, pos) + val, pos = decode_fixed64(buf, pos) result.required_fixed64 = val elseif id == 9 then local val - val, pos = wire.decode_sfixed32(buf, pos) + val, pos = decode_sfixed32(buf, pos) result.required_sfixed32 = val elseif id == 10 then local val - val, pos = wire.decode_sfixed64(buf, pos) + val, pos = decode_sfixed64(buf, pos) result.required_sfixed64 = val elseif id == 11 then local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) result.required_float = val elseif id == 12 then local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) result.required_double = val elseif id == 13 then local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) result.required_bool = val elseif id == 14 then local _lb = string_byte(buf, pos) @@ -6534,7 +6608,7 @@ result.required_string = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.required_string = val end elseif id == 15 then @@ -6548,12 +6622,12 @@ result.required_bytes = _s pos = _epos else local val - val, pos = wire.decode_bytes(buf, pos) + val, pos = decode_bytes(buf, pos) result.required_bytes = val end elseif id == 18 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.required_nested_message if prev == nil then result.required_nested_message = M.TestAllRequiredTypesProto2_NestedMessage_decode(payload) @@ -6562,7 +6636,7 @@ pb.codec.merge_message(M.TestAllRequiredTypesProto2_NestedMessage_descriptor, prev, M.TestAllRequiredTypesProto2_NestedMessage_decode(payload)) end elseif id == 19 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.required_foreign_message if prev == nil then result.required_foreign_message = M.ForeignMessageProto2_decode(payload) @@ -6571,12 +6645,12 @@ pb.codec.merge_message(M.ForeignMessageProto2_descriptor, prev, M.ForeignMessageProto2_decode(payload)) end elseif id == 21 then local u - u, pos = wire.decode_varint(buf, pos) - result.required_nested_enum = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + result.required_nested_enum = varint_to_int32(u) elseif id == 22 then local u - u, pos = wire.decode_varint(buf, pos) - result.required_foreign_enum = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + result.required_foreign_enum = varint_to_int32(u) elseif id == 24 then local _lb = string_byte(buf, pos) if _lb ~= nil and _lb < 0x80 then @@ -6589,7 +6663,7 @@ result.required_string_piece = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.required_string_piece = val end elseif id == 25 then @@ -6604,12 +6678,12 @@ result.required_cord = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.required_cord = val end elseif id == 27 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.recursive_message if prev == nil then result.recursive_message = M.TestAllRequiredTypesProto2_decode(payload) @@ -6618,7 +6692,7 @@ pb.codec.merge_message(M.TestAllRequiredTypesProto2_descriptor, prev, M.TestAllRequiredTypesProto2_decode(payload)) end elseif id == 28 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.optional_recursive_message if prev == nil then result.optional_recursive_message = M.TestAllRequiredTypesProto2_decode(payload) @@ -6636,55 +6710,55 @@ pb.codec.merge_message(M.TestAllRequiredTypesProto2_Data_descriptor, prev, payload) end elseif id == 241 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.default_int32 = val elseif id == 242 then local val - val, pos = wire.decode_int64(buf, pos) + val, pos = decode_int64(buf, pos) result.default_int64 = val elseif id == 243 then local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) result.default_uint32 = val elseif id == 244 then local val - val, pos = wire.decode_uint64(buf, pos) + val, pos = decode_uint64(buf, pos) result.default_uint64 = val elseif id == 245 then local val - val, pos = wire.decode_sint32(buf, pos) + val, pos = decode_sint32(buf, pos) result.default_sint32 = val elseif id == 246 then local val - val, pos = wire.decode_sint64(buf, pos) + val, pos = decode_sint64(buf, pos) result.default_sint64 = val elseif id == 247 then local val - val, pos = wire.decode_fixed32(buf, pos) + val, pos = decode_fixed32(buf, pos) result.default_fixed32 = val elseif id == 248 then local val - val, pos = wire.decode_fixed64(buf, pos) + val, pos = decode_fixed64(buf, pos) result.default_fixed64 = val elseif id == 249 then local val - val, pos = wire.decode_sfixed32(buf, pos) + val, pos = decode_sfixed32(buf, pos) result.default_sfixed32 = val elseif id == 250 then local val - val, pos = wire.decode_sfixed64(buf, pos) + val, pos = decode_sfixed64(buf, pos) result.default_sfixed64 = val elseif id == 251 then local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) result.default_float = val elseif id == 252 then local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) result.default_double = val elseif id == 253 then local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) result.default_bool = val elseif id == 254 then local _lb = string_byte(buf, pos) @@ -6698,7 +6772,7 @@ result.default_string = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.default_string = val end elseif id == 255 then @@ -6712,7 +6786,7 @@ result.default_bytes = _s pos = _epos else local val - val, pos = wire.decode_bytes(buf, pos) + val, pos = decode_bytes(buf, pos) result.default_bytes = val end else @@ -6751,6 +6825,7 @@ ---@param t protobuf_test_messages.proto2.TestAllRequiredTypesProto2.NestedMessage ---@return string function M.TestAllRequiredTypesProto2_NestedMessage_encode(t) + local encode_varint = wire.encode_varint local _d = M.TestAllRequiredTypesProto2_NestedMessage_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -6779,7 +6854,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b -- field 3: optional_corecursive @@ -6791,7 +6866,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -6817,6 +6892,7 @@ ---@param b string ---@return protobuf_test_messages.proto2.TestAllRequiredTypesProto2.NestedMessage function M.TestAllRequiredTypesProto2_NestedMessage_decode(buf) + local decode_len = wire.decode_len local _d = M.TestAllRequiredTypesProto2_NestedMessage_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -6847,7 +6923,7 @@ val, pos = wire.decode_int32(buf, pos) result.a = val elseif id == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.corecursive if prev == nil then result.corecursive = M.TestAllRequiredTypesProto2_decode(payload) @@ -6856,7 +6932,7 @@ pb.codec.merge_message(M.TestAllRequiredTypesProto2_descriptor, prev, M.TestAllRequiredTypesProto2_decode(payload)) end elseif id == 3 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.optional_corecursive if prev == nil then result.optional_corecursive = M.TestAllRequiredTypesProto2_decode(payload) @@ -7008,6 +7084,7 @@ ---@param t protobuf_test_messages.proto2.TestLargeOneof ---@return string function M.TestLargeOneof_encode(t) + local encode_varint = wire.encode_varint local _d = M.TestLargeOneof_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -7033,7 +7110,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -7046,7 +7123,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -7059,7 +7136,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -7072,7 +7149,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -7085,7 +7162,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -7111,6 +7188,7 @@ ---@param b string ---@return protobuf_test_messages.proto2.TestLargeOneof function M.TestLargeOneof_decode(buf) + local decode_len = wire.decode_len local _d = M.TestLargeOneof_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -7137,7 +7215,7 @@ id, wt, pos = wire.decode_tag(buf, pos) end if id == 1 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.a1 if prev == nil then result.a1 = M.TestLargeOneof_A1_decode(payload) @@ -7150,7 +7228,7 @@ result.a4 = nil result.a5 = nil elseif id == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.a2 if prev == nil then result.a2 = M.TestLargeOneof_A2_decode(payload) @@ -7163,7 +7241,7 @@ result.a4 = nil result.a5 = nil elseif id == 3 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.a3 if prev == nil then result.a3 = M.TestLargeOneof_A3_decode(payload) @@ -7176,7 +7254,7 @@ result.a4 = nil result.a5 = nil elseif id == 4 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.a4 if prev == nil then result.a4 = M.TestLargeOneof_A4_decode(payload) @@ -7189,7 +7267,7 @@ result.a3 = nil result.a5 = nil elseif id == 5 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.a5 if prev == nil then result.a5 = M.TestLargeOneof_A5_decode(payload) diff --git a/examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua b/examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua index 4128053ce1bf6e97ce51982ccdfcf56fd4a0c2a5..25a77d67a3e1f22716176a8af1e62379ffb81a64 100644 --- a/examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua +++ b/examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua @@ -597,6 +597,22 @@ ---@param t protobuf_test_messages.proto3.TestAllTypesProto3 ---@return string function M.TestAllTypesProto3_encode(t) + local encode_bool = wire.encode_bool + local encode_double = wire.encode_double + local encode_fixed32 = wire.encode_fixed32 + local encode_fixed64 = wire.encode_fixed64 + local encode_float = wire.encode_float + local encode_int32 = wire.encode_int32 + local encode_int64 = wire.encode_int64 + local encode_len = wire.encode_len + local encode_sfixed32 = wire.encode_sfixed32 + local encode_sfixed64 = wire.encode_sfixed64 + local encode_sint32 = wire.encode_sint32 + local encode_sint64 = wire.encode_sint64 + local encode_string = wire.encode_string + local encode_uint32 = wire.encode_uint32 + local encode_uint64 = wire.encode_uint64 + local encode_varint = wire.encode_varint local _d = M.TestAllTypesProto3_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -622,79 +638,79 @@ -- field 1: optional_int32 v = t.optional_int32 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x08" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 2: optional_int64 v = t.optional_int64 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x10" - n = n + 1; out[n] = wire.encode_int64(v) + n = n + 1; out[n] = encode_int64(v) end -- field 3: optional_uint32 v = t.optional_uint32 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x18" - n = n + 1; out[n] = wire.encode_uint32(v) + n = n + 1; out[n] = encode_uint32(v) end -- field 4: optional_uint64 v = t.optional_uint64 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x20" - n = n + 1; out[n] = wire.encode_uint64(v) + n = n + 1; out[n] = encode_uint64(v) end -- field 5: optional_sint32 v = t.optional_sint32 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x28" - n = n + 1; out[n] = wire.encode_sint32(v) + n = n + 1; out[n] = encode_sint32(v) end -- field 6: optional_sint64 v = t.optional_sint64 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x30" - n = n + 1; out[n] = wire.encode_sint64(v) + n = n + 1; out[n] = encode_sint64(v) end -- field 7: optional_fixed32 v = t.optional_fixed32 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x3d" - n = n + 1; out[n] = wire.encode_fixed32(v) + n = n + 1; out[n] = encode_fixed32(v) end -- field 8: optional_fixed64 v = t.optional_fixed64 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x41" - n = n + 1; out[n] = wire.encode_fixed64(v) + n = n + 1; out[n] = encode_fixed64(v) end -- field 9: optional_sfixed32 v = t.optional_sfixed32 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x4d" - n = n + 1; out[n] = wire.encode_sfixed32(v) + n = n + 1; out[n] = encode_sfixed32(v) end -- field 10: optional_sfixed64 v = t.optional_sfixed64 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x51" - n = n + 1; out[n] = wire.encode_sfixed64(v) + n = n + 1; out[n] = encode_sfixed64(v) end -- field 11: optional_float v = t.optional_float if v ~= nil and (v ~= 0 or 1/v == -math.huge) then n = n + 1; out[n] = "\x5d" - n = n + 1; out[n] = wire.encode_float(v) + n = n + 1; out[n] = encode_float(v) end -- field 12: optional_double v = t.optional_double if v ~= nil and (v ~= 0 or 1/v == -math.huge) then n = n + 1; out[n] = "\x61" - n = n + 1; out[n] = wire.encode_double(v) + n = n + 1; out[n] = encode_double(v) end -- field 13: optional_bool v = t.optional_bool if v ~= nil and v ~= false then n = n + 1; out[n] = "\x68" - n = n + 1; out[n] = wire.encode_bool(v) + n = n + 1; out[n] = encode_bool(v) end -- field 14: optional_string v = t.optional_string @@ -704,7 +720,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -716,7 +732,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -729,7 +745,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -742,7 +758,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -756,7 +772,7 @@ if nv == nil then error("unknown enum value '" .. v .. "' for protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum", 0) end end if nv ~= 0 then n = n + 1; out[n] = "\xa8\x01" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end end -- field 22: optional_foreign_enum @@ -769,7 +785,7 @@ if nv == nil then error("unknown enum value '" .. v .. "' for protobuf_test_messages.proto3.ForeignEnum", 0) end end if nv ~= 0 then n = n + 1; out[n] = "\xb0\x01" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end end -- field 23: optional_aliased_enum @@ -782,7 +798,7 @@ if nv == nil then error("unknown enum value '" .. v .. "' for protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum", 0) end end if nv ~= 0 then n = n + 1; out[n] = "\xb8\x01" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end end -- field 24: optional_string_piece @@ -793,7 +809,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -805,7 +821,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -818,7 +834,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -827,7 +843,7 @@ v = t.repeated_int32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_int32(v[_i]) + m = m + 1; parts[m] = encode_int32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xfa\x01" @@ -835,7 +851,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -844,7 +860,7 @@ v = t.repeated_int64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_int64(v[_i]) + m = m + 1; parts[m] = encode_int64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x82\x02" @@ -852,7 +868,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -861,7 +877,7 @@ v = t.repeated_uint32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_uint32(v[_i]) + m = m + 1; parts[m] = encode_uint32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x8a\x02" @@ -869,7 +885,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -878,7 +894,7 @@ v = t.repeated_uint64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_uint64(v[_i]) + m = m + 1; parts[m] = encode_uint64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x92\x02" @@ -886,7 +902,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -895,7 +911,7 @@ v = t.repeated_sint32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_sint32(v[_i]) + m = m + 1; parts[m] = encode_sint32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x9a\x02" @@ -903,7 +919,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -912,7 +928,7 @@ v = t.repeated_sint64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_sint64(v[_i]) + m = m + 1; parts[m] = encode_sint64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xa2\x02" @@ -920,7 +936,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -929,7 +945,7 @@ v = t.repeated_fixed32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_fixed32(v[_i]) + m = m + 1; parts[m] = encode_fixed32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xaa\x02" @@ -937,7 +953,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -946,7 +962,7 @@ v = t.repeated_fixed64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_fixed64(v[_i]) + m = m + 1; parts[m] = encode_fixed64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xb2\x02" @@ -954,7 +970,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -963,7 +979,7 @@ v = t.repeated_sfixed32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_sfixed32(v[_i]) + m = m + 1; parts[m] = encode_sfixed32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xba\x02" @@ -971,7 +987,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -980,7 +996,7 @@ v = t.repeated_sfixed64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_sfixed64(v[_i]) + m = m + 1; parts[m] = encode_sfixed64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xc2\x02" @@ -988,7 +1004,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -997,7 +1013,7 @@ v = t.repeated_float if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_float(v[_i]) + m = m + 1; parts[m] = encode_float(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xca\x02" @@ -1005,7 +1021,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1014,7 +1030,7 @@ v = t.repeated_double if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_double(v[_i]) + m = m + 1; parts[m] = encode_double(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xd2\x02" @@ -1022,7 +1038,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1031,7 +1047,7 @@ v = t.repeated_bool if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_bool(v[_i]) + m = m + 1; parts[m] = encode_bool(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xda\x02" @@ -1039,7 +1055,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1054,7 +1070,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1070,7 +1086,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1086,7 +1102,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1102,7 +1118,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1118,7 +1134,7 @@ if type(elem) == 'string' then nv = M.TestAllTypesProto3_NestedEnum[elem] if nv == nil then error("unknown enum value '" .. elem .. "' for protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum", 0) end end - m = m + 1; parts[m] = wire.encode_int32(nv) + m = m + 1; parts[m] = encode_int32(nv) end local _b = table.concat(parts) n = n + 1; out[n] = "\x9a\x03" @@ -1126,7 +1142,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1141,7 +1157,7 @@ if type(elem) == 'string' then nv = M.ForeignEnum[elem] if nv == nil then error("unknown enum value '" .. elem .. "' for protobuf_test_messages.proto3.ForeignEnum", 0) end end - m = m + 1; parts[m] = wire.encode_int32(nv) + m = m + 1; parts[m] = encode_int32(nv) end local _b = table.concat(parts) n = n + 1; out[n] = "\xa2\x03" @@ -1149,7 +1165,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1164,7 +1180,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1180,7 +1196,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1190,7 +1206,7 @@ v = t.packed_int32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_int32(v[_i]) + m = m + 1; parts[m] = encode_int32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xda\x04" @@ -1198,7 +1214,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1207,7 +1223,7 @@ v = t.packed_int64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_int64(v[_i]) + m = m + 1; parts[m] = encode_int64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xe2\x04" @@ -1215,7 +1231,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1224,7 +1240,7 @@ v = t.packed_uint32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_uint32(v[_i]) + m = m + 1; parts[m] = encode_uint32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xea\x04" @@ -1232,7 +1248,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1241,7 +1257,7 @@ v = t.packed_uint64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_uint64(v[_i]) + m = m + 1; parts[m] = encode_uint64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xf2\x04" @@ -1249,7 +1265,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1258,7 +1274,7 @@ v = t.packed_sint32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_sint32(v[_i]) + m = m + 1; parts[m] = encode_sint32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xfa\x04" @@ -1266,7 +1282,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1275,7 +1291,7 @@ v = t.packed_sint64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_sint64(v[_i]) + m = m + 1; parts[m] = encode_sint64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x82\x05" @@ -1283,7 +1299,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1292,7 +1308,7 @@ v = t.packed_fixed32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_fixed32(v[_i]) + m = m + 1; parts[m] = encode_fixed32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x8a\x05" @@ -1300,7 +1316,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1309,7 +1325,7 @@ v = t.packed_fixed64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_fixed64(v[_i]) + m = m + 1; parts[m] = encode_fixed64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x92\x05" @@ -1317,7 +1333,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1326,7 +1342,7 @@ v = t.packed_sfixed32 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_sfixed32(v[_i]) + m = m + 1; parts[m] = encode_sfixed32(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\x9a\x05" @@ -1334,7 +1350,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1343,7 +1359,7 @@ v = t.packed_sfixed64 if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_sfixed64(v[_i]) + m = m + 1; parts[m] = encode_sfixed64(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xa2\x05" @@ -1351,7 +1367,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1360,7 +1376,7 @@ v = t.packed_float if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_float(v[_i]) + m = m + 1; parts[m] = encode_float(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xaa\x05" @@ -1368,7 +1384,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1377,7 +1393,7 @@ v = t.packed_double if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_double(v[_i]) + m = m + 1; parts[m] = encode_double(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xb2\x05" @@ -1385,7 +1401,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1394,7 +1410,7 @@ v = t.packed_bool if v ~= nil and #v > 0 then local parts, m = {}, 0 for _i = 1, #v do - m = m + 1; parts[m] = wire.encode_bool(v[_i]) + m = m + 1; parts[m] = encode_bool(v[_i]) end local _b = table.concat(parts) n = n + 1; out[n] = "\xba\x05" @@ -1402,7 +1418,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1417,7 +1433,7 @@ if type(elem) == 'string' then nv = M.TestAllTypesProto3_NestedEnum[elem] if nv == nil then error("unknown enum value '" .. elem .. "' for protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum", 0) end end - m = m + 1; parts[m] = wire.encode_int32(nv) + m = m + 1; parts[m] = encode_int32(nv) end local _b = table.concat(parts) n = n + 1; out[n] = "\xc2\x05" @@ -1425,7 +1441,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1435,7 +1451,7 @@ if v ~= nil and #v > 0 then local _tag = "\xc8\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_int32(v[_i]) + n = n + 1; out[n] = encode_int32(v[_i]) end end -- field 90: unpacked_int64 @@ -1444,7 +1460,7 @@ if v ~= nil and #v > 0 then local _tag = "\xd0\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_int64(v[_i]) + n = n + 1; out[n] = encode_int64(v[_i]) end end -- field 91: unpacked_uint32 @@ -1453,7 +1469,7 @@ if v ~= nil and #v > 0 then local _tag = "\xd8\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_uint32(v[_i]) + n = n + 1; out[n] = encode_uint32(v[_i]) end end -- field 92: unpacked_uint64 @@ -1462,7 +1478,7 @@ if v ~= nil and #v > 0 then local _tag = "\xe0\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_uint64(v[_i]) + n = n + 1; out[n] = encode_uint64(v[_i]) end end -- field 93: unpacked_sint32 @@ -1471,7 +1487,7 @@ if v ~= nil and #v > 0 then local _tag = "\xe8\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_sint32(v[_i]) + n = n + 1; out[n] = encode_sint32(v[_i]) end end -- field 94: unpacked_sint64 @@ -1480,7 +1496,7 @@ if v ~= nil and #v > 0 then local _tag = "\xf0\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_sint64(v[_i]) + n = n + 1; out[n] = encode_sint64(v[_i]) end end -- field 95: unpacked_fixed32 @@ -1489,7 +1505,7 @@ if v ~= nil and #v > 0 then local _tag = "\xfd\x05" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_fixed32(v[_i]) + n = n + 1; out[n] = encode_fixed32(v[_i]) end end -- field 96: unpacked_fixed64 @@ -1498,7 +1514,7 @@ if v ~= nil and #v > 0 then local _tag = "\x81\x06" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_fixed64(v[_i]) + n = n + 1; out[n] = encode_fixed64(v[_i]) end end -- field 97: unpacked_sfixed32 @@ -1507,7 +1523,7 @@ if v ~= nil and #v > 0 then local _tag = "\x8d\x06" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_sfixed32(v[_i]) + n = n + 1; out[n] = encode_sfixed32(v[_i]) end end -- field 98: unpacked_sfixed64 @@ -1516,7 +1532,7 @@ if v ~= nil and #v > 0 then local _tag = "\x91\x06" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_sfixed64(v[_i]) + n = n + 1; out[n] = encode_sfixed64(v[_i]) end end -- field 99: unpacked_float @@ -1525,7 +1541,7 @@ if v ~= nil and #v > 0 then local _tag = "\x9d\x06" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_float(v[_i]) + n = n + 1; out[n] = encode_float(v[_i]) end end -- field 100: unpacked_double @@ -1534,7 +1550,7 @@ if v ~= nil and #v > 0 then local _tag = "\xa1\x06" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_double(v[_i]) + n = n + 1; out[n] = encode_double(v[_i]) end end -- field 101: unpacked_bool @@ -1543,7 +1559,7 @@ if v ~= nil and #v > 0 then local _tag = "\xa8\x06" for _i = 1, #v do n = n + 1; out[n] = _tag - n = n + 1; out[n] = wire.encode_bool(v[_i]) + n = n + 1; out[n] = encode_bool(v[_i]) end end -- field 102: unpacked_nested_enum @@ -1557,7 +1573,7 @@ if type(elem) == 'string' then nv = M.TestAllTypesProto3_NestedEnum[elem] if nv == nil then error("unknown enum value '" .. elem .. "' for protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum", 0) end end - m = m + 1; parts[m] = wire.encode_int32(nv) + m = m + 1; parts[m] = encode_int32(nv) end local _b = table.concat(parts) n = n + 1; out[n] = "\xb0\x06" @@ -1565,7 +1581,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1577,11 +1593,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_int32(_k) + _m = _m + 1; entry[_m] = encode_int32(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_int32(_val) + _m = _m + 1; entry[_m] = encode_int32(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1589,7 +1605,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1602,11 +1618,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_int64(_k) + _m = _m + 1; entry[_m] = encode_int64(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_int64(_val) + _m = _m + 1; entry[_m] = encode_int64(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1614,7 +1630,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1627,11 +1643,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_uint32(_k) + _m = _m + 1; entry[_m] = encode_uint32(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_uint32(_val) + _m = _m + 1; entry[_m] = encode_uint32(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1639,7 +1655,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1652,11 +1668,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_uint64(_k) + _m = _m + 1; entry[_m] = encode_uint64(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_uint64(_val) + _m = _m + 1; entry[_m] = encode_uint64(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1664,7 +1680,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1677,11 +1693,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_sint32(_k) + _m = _m + 1; entry[_m] = encode_sint32(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_sint32(_val) + _m = _m + 1; entry[_m] = encode_sint32(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1689,7 +1705,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1702,11 +1718,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_sint64(_k) + _m = _m + 1; entry[_m] = encode_sint64(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_sint64(_val) + _m = _m + 1; entry[_m] = encode_sint64(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1714,7 +1730,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1727,11 +1743,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_fixed32(_k) + _m = _m + 1; entry[_m] = encode_fixed32(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_fixed32(_val) + _m = _m + 1; entry[_m] = encode_fixed32(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1739,7 +1755,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1752,11 +1768,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_fixed64(_k) + _m = _m + 1; entry[_m] = encode_fixed64(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_fixed64(_val) + _m = _m + 1; entry[_m] = encode_fixed64(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1764,7 +1780,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1777,11 +1793,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_sfixed32(_k) + _m = _m + 1; entry[_m] = encode_sfixed32(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_sfixed32(_val) + _m = _m + 1; entry[_m] = encode_sfixed32(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1789,7 +1805,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1802,11 +1818,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_sfixed64(_k) + _m = _m + 1; entry[_m] = encode_sfixed64(_k) end if _val ~= 0 then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_sfixed64(_val) + _m = _m + 1; entry[_m] = encode_sfixed64(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1814,7 +1830,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1827,11 +1843,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_int32(_k) + _m = _m + 1; entry[_m] = encode_int32(_k) end if (_val ~= 0 or 1/_val == -math.huge) then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_float(_val) + _m = _m + 1; entry[_m] = encode_float(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1839,7 +1855,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1852,11 +1868,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= 0 then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_int32(_k) + _m = _m + 1; entry[_m] = encode_int32(_k) end if (_val ~= 0 or 1/_val == -math.huge) then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_double(_val) + _m = _m + 1; entry[_m] = encode_double(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1864,7 +1880,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1877,11 +1893,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= false then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_bool(_k) + _m = _m + 1; entry[_m] = encode_bool(_k) end if _val ~= false then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_bool(_val) + _m = _m + 1; entry[_m] = encode_bool(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1889,7 +1905,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1902,11 +1918,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end if _val ~= '' then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_string(_val) + _m = _m + 1; entry[_m] = encode_string(_val) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1914,7 +1930,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1927,7 +1943,7 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end if _val ~= '' then _m = _m + 1; entry[_m] = _vtag @@ -1939,7 +1955,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1952,11 +1968,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end if _val ~= nil then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_len(M.TestAllTypesProto3_NestedMessage_encode(_val)) + _m = _m + 1; entry[_m] = encode_len(M.TestAllTypesProto3_NestedMessage_encode(_val)) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1964,7 +1980,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -1977,11 +1993,11 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end if _val ~= nil then _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_len(M.ForeignMessage_encode(_val)) + _m = _m + 1; entry[_m] = encode_len(M.ForeignMessage_encode(_val)) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -1989,7 +2005,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2002,7 +2018,7 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end do local _nv = _val @@ -2011,7 +2027,7 @@ _nv = M.TestAllTypesProto3_NestedEnum[_val] if _nv == nil then error("unknown enum value '" .. _val .. "' for protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum", 0) end end _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_int32(_nv) + _m = _m + 1; entry[_m] = encode_int32(_nv) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -2019,7 +2035,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2032,7 +2048,7 @@ for _k, _val in pairs(v) do local entry, _m = {}, 0 if _k ~= '' then _m = _m + 1; entry[_m] = _ktag - _m = _m + 1; entry[_m] = wire.encode_string(_k) + _m = _m + 1; entry[_m] = encode_string(_k) end do local _nv = _val @@ -2041,7 +2057,7 @@ _nv = M.ForeignEnum[_val] if _nv == nil then error("unknown enum value '" .. _val .. "' for protobuf_test_messages.proto3.ForeignEnum", 0) end end _m = _m + 1; entry[_m] = _vtag - _m = _m + 1; entry[_m] = wire.encode_int32(_nv) + _m = _m + 1; entry[_m] = encode_int32(_nv) end n = n + 1; out[n] = _tag local _b = table.concat(entry) @@ -2049,7 +2065,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2058,7 +2074,7 @@ -- field 111: oneof_uint32 v = t.oneof_uint32 if _of_oneof_field == "oneof_uint32" then n = n + 1; out[n] = "\xf8\x06" - n = n + 1; out[n] = wire.encode_uint32(v) + n = n + 1; out[n] = encode_uint32(v) end -- field 112: oneof_nested_message v = t.oneof_nested_message @@ -2069,7 +2085,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2081,7 +2097,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -2093,7 +2109,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -2101,25 +2117,25 @@ -- field 115: oneof_bool v = t.oneof_bool if _of_oneof_field == "oneof_bool" then n = n + 1; out[n] = "\x98\x07" - n = n + 1; out[n] = wire.encode_bool(v) + n = n + 1; out[n] = encode_bool(v) end -- field 116: oneof_uint64 v = t.oneof_uint64 if _of_oneof_field == "oneof_uint64" then n = n + 1; out[n] = "\xa0\x07" - n = n + 1; out[n] = wire.encode_uint64(v) + n = n + 1; out[n] = encode_uint64(v) end -- field 117: oneof_float v = t.oneof_float if _of_oneof_field == "oneof_float" then n = n + 1; out[n] = "\xad\x07" - n = n + 1; out[n] = wire.encode_float(v) + n = n + 1; out[n] = encode_float(v) end -- field 118: oneof_double v = t.oneof_double if _of_oneof_field == "oneof_double" then n = n + 1; out[n] = "\xb1\x07" - n = n + 1; out[n] = wire.encode_double(v) + n = n + 1; out[n] = encode_double(v) end -- field 119: oneof_enum v = t.oneof_enum @@ -2130,7 +2146,7 @@ nv = M.TestAllTypesProto3_NestedEnum[v] if nv == nil then error("unknown enum value '" .. v .. "' for protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum", 0) end end n = n + 1; out[n] = "\xb8\x07" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end -- field 120: oneof_null_value v = t.oneof_null_value @@ -2141,7 +2157,7 @@ nv = pb.wkt.NullValue[v] if nv == nil then error("unknown enum value '" .. v .. "' for google.protobuf.NullValue", 0) end end n = n + 1; out[n] = "\xc0\x07" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end -- field 201: optional_bool_wrapper v = t.optional_bool_wrapper @@ -2152,7 +2168,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2165,7 +2181,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2178,7 +2194,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2191,7 +2207,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2204,7 +2220,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2217,7 +2233,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2230,7 +2246,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2243,7 +2259,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2256,7 +2272,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2271,7 +2287,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2287,7 +2303,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2303,7 +2319,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2319,7 +2335,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2335,7 +2351,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2351,7 +2367,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2367,7 +2383,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2383,7 +2399,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2399,7 +2415,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2413,7 +2429,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2426,7 +2442,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2439,7 +2455,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2452,7 +2468,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2465,7 +2481,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2478,7 +2494,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2492,7 +2508,7 @@ if nv == nil then error("unknown enum value '" .. v .. "' for google.protobuf.NullValue", 0) end end if nv ~= 0 then n = n + 1; out[n] = "\x98\x13" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end end -- field 308: optional_empty @@ -2504,7 +2520,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2519,7 +2535,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2535,7 +2551,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2551,7 +2567,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2567,7 +2583,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2583,7 +2599,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2599,7 +2615,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2615,7 +2631,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2631,7 +2647,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -2640,109 +2656,109 @@ -- field 401: fieldname1 v = t.fieldname1 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x88\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 402: field_name2 v = t.field_name2 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x90\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 403: _field_name3 v = t._field_name3 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x98\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 404: field__name4_ v = t.field__name4_ if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\xa0\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 405: field0name5 v = t.field0name5 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\xa8\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 406: field_0_name6 v = t.field_0_name6 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\xb0\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 407: fieldName7 v = t.fieldName7 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\xb8\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 408: FieldName8 v = t.FieldName8 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\xc0\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 409: field_Name9 v = t.field_Name9 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\xc8\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 410: Field_Name10 v = t.Field_Name10 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\xd0\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 411: FIELD_NAME11 v = t.FIELD_NAME11 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\xd8\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 412: FIELD_name12 v = t.FIELD_name12 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\xe0\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 413: __field_name13 v = t.__field_name13 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\xe8\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 414: __Field_name14 v = t.__Field_name14 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\xf0\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 415: field__name15 v = t.field__name15 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\xf8\x19" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 416: field__Name16 v = t.field__Name16 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x80\x1a" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 417: field_name17__ v = t.field_name17__ if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x88\x1a" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 418: Field_name18__ v = t.Field_name18__ if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x90\x1a" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end local _exts = t._extensions if _exts ~= nil then @@ -2766,6 +2782,26 @@ ---@param b string ---@return protobuf_test_messages.proto3.TestAllTypesProto3 function M.TestAllTypesProto3_decode(buf) + local decode_bool = wire.decode_bool + local decode_bytes = wire.decode_bytes + local decode_double = wire.decode_double + local decode_fixed32 = wire.decode_fixed32 + local decode_fixed64 = wire.decode_fixed64 + local decode_float = wire.decode_float + local decode_int32 = wire.decode_int32 + local decode_int64 = wire.decode_int64 + local decode_len = wire.decode_len + local decode_sfixed32 = wire.decode_sfixed32 + local decode_sfixed64 = wire.decode_sfixed64 + local decode_sint32 = wire.decode_sint32 + local decode_sint64 = wire.decode_sint64 + local decode_string = wire.decode_string + local decode_tag = wire.decode_tag + local decode_uint32 = wire.decode_uint32 + local decode_uint64 = wire.decode_uint64 + local decode_varint = wire.decode_varint + local skip_field = wire.skip_field + local varint_to_int32 = wire.varint_to_int32 local _d = M.TestAllTypesProto3_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -2854,59 +2890,59 @@ id = rshift(_b, 3) if id == 0 then error("illegal field number 0", 0) end pos = pos + 1 else - id, wt, pos = wire.decode_tag(buf, pos) + id, wt, pos = decode_tag(buf, pos) end if id == 1 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.optional_int32 = val elseif id == 2 then local val - val, pos = wire.decode_int64(buf, pos) + val, pos = decode_int64(buf, pos) result.optional_int64 = val elseif id == 3 then local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) result.optional_uint32 = val elseif id == 4 then local val - val, pos = wire.decode_uint64(buf, pos) + val, pos = decode_uint64(buf, pos) result.optional_uint64 = val elseif id == 5 then local val - val, pos = wire.decode_sint32(buf, pos) + val, pos = decode_sint32(buf, pos) result.optional_sint32 = val elseif id == 6 then local val - val, pos = wire.decode_sint64(buf, pos) + val, pos = decode_sint64(buf, pos) result.optional_sint64 = val elseif id == 7 then local val - val, pos = wire.decode_fixed32(buf, pos) + val, pos = decode_fixed32(buf, pos) result.optional_fixed32 = val elseif id == 8 then local val - val, pos = wire.decode_fixed64(buf, pos) + val, pos = decode_fixed64(buf, pos) result.optional_fixed64 = val elseif id == 9 then local val - val, pos = wire.decode_sfixed32(buf, pos) + val, pos = decode_sfixed32(buf, pos) result.optional_sfixed32 = val elseif id == 10 then local val - val, pos = wire.decode_sfixed64(buf, pos) + val, pos = decode_sfixed64(buf, pos) result.optional_sfixed64 = val elseif id == 11 then local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) result.optional_float = val elseif id == 12 then local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) result.optional_double = val elseif id == 13 then local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) result.optional_bool = val elseif id == 14 then local _lb = string_byte(buf, pos) @@ -2920,7 +2956,7 @@ result.optional_string = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.optional_string = val end elseif id == 15 then @@ -2934,12 +2970,12 @@ result.optional_bytes = _s pos = _epos else local val - val, pos = wire.decode_bytes(buf, pos) + val, pos = decode_bytes(buf, pos) result.optional_bytes = val end elseif id == 18 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.optional_nested_message if prev == nil then result.optional_nested_message = M.TestAllTypesProto3_NestedMessage_decode(payload) @@ -2948,7 +2984,7 @@ pb.codec.merge_message(M.TestAllTypesProto3_NestedMessage_descriptor, prev, M.TestAllTypesProto3_NestedMessage_decode(payload)) end elseif id == 19 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.optional_foreign_message if prev == nil then result.optional_foreign_message = M.ForeignMessage_decode(payload) @@ -2957,16 +2993,16 @@ pb.codec.merge_message(M.ForeignMessage_descriptor, prev, M.ForeignMessage_decode(payload)) end elseif id == 21 then local u - u, pos = wire.decode_varint(buf, pos) - result.optional_nested_enum = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + result.optional_nested_enum = varint_to_int32(u) elseif id == 22 then local u - u, pos = wire.decode_varint(buf, pos) - result.optional_foreign_enum = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + result.optional_foreign_enum = varint_to_int32(u) elseif id == 23 then local u - u, pos = wire.decode_varint(buf, pos) - result.optional_aliased_enum = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + result.optional_aliased_enum = varint_to_int32(u) elseif id == 24 then local _lb = string_byte(buf, pos) if _lb ~= nil and _lb < 0x80 then @@ -2979,7 +3015,7 @@ result.optional_string_piece = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.optional_string_piece = val end elseif id == 25 then @@ -2994,12 +3030,12 @@ result.optional_cord = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.optional_cord = val end elseif id == 27 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.recursive_message if prev == nil then result.recursive_message = M.TestAllTypesProto3_decode(payload) @@ -3011,16 +3047,16 @@ local list = result.repeated_int32 if list == nil then list = {}; result.repeated_int32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_repeated_int32 = _n_repeated_int32 + 1; list[_n_repeated_int32] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_repeated_int32 = _n_repeated_int32 + 1; list[_n_repeated_int32] = val end elseif id == 32 then @@ -3028,16 +3064,16 @@ local list = result.repeated_int64 if list == nil then list = {}; result.repeated_int64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int64(payload, p2) + val, p2 = decode_int64(payload, p2) _n_repeated_int64 = _n_repeated_int64 + 1; list[_n_repeated_int64] = val end else local val - val, pos = wire.decode_int64(buf, pos) + val, pos = decode_int64(buf, pos) _n_repeated_int64 = _n_repeated_int64 + 1; list[_n_repeated_int64] = val end elseif id == 33 then @@ -3045,16 +3081,16 @@ local list = result.repeated_uint32 if list == nil then list = {}; result.repeated_uint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_uint32(payload, p2) + val, p2 = decode_uint32(payload, p2) _n_repeated_uint32 = _n_repeated_uint32 + 1; list[_n_repeated_uint32] = val end else local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) _n_repeated_uint32 = _n_repeated_uint32 + 1; list[_n_repeated_uint32] = val end elseif id == 34 then @@ -3062,16 +3098,16 @@ local list = result.repeated_uint64 if list == nil then list = {}; result.repeated_uint64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_uint64(payload, p2) + val, p2 = decode_uint64(payload, p2) _n_repeated_uint64 = _n_repeated_uint64 + 1; list[_n_repeated_uint64] = val end else local val - val, pos = wire.decode_uint64(buf, pos) + val, pos = decode_uint64(buf, pos) _n_repeated_uint64 = _n_repeated_uint64 + 1; list[_n_repeated_uint64] = val end elseif id == 35 then @@ -3079,16 +3115,16 @@ local list = result.repeated_sint32 if list == nil then list = {}; result.repeated_sint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint32(payload, p2) + val, p2 = decode_sint32(payload, p2) _n_repeated_sint32 = _n_repeated_sint32 + 1; list[_n_repeated_sint32] = val end else local val - val, pos = wire.decode_sint32(buf, pos) + val, pos = decode_sint32(buf, pos) _n_repeated_sint32 = _n_repeated_sint32 + 1; list[_n_repeated_sint32] = val end elseif id == 36 then @@ -3096,16 +3132,16 @@ local list = result.repeated_sint64 if list == nil then list = {}; result.repeated_sint64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint64(payload, p2) + val, p2 = decode_sint64(payload, p2) _n_repeated_sint64 = _n_repeated_sint64 + 1; list[_n_repeated_sint64] = val end else local val - val, pos = wire.decode_sint64(buf, pos) + val, pos = decode_sint64(buf, pos) _n_repeated_sint64 = _n_repeated_sint64 + 1; list[_n_repeated_sint64] = val end elseif id == 37 then @@ -3113,16 +3149,16 @@ local list = result.repeated_fixed32 if list == nil then list = {}; result.repeated_fixed32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed32(payload, p2) + val, p2 = decode_fixed32(payload, p2) _n_repeated_fixed32 = _n_repeated_fixed32 + 1; list[_n_repeated_fixed32] = val end else local val - val, pos = wire.decode_fixed32(buf, pos) + val, pos = decode_fixed32(buf, pos) _n_repeated_fixed32 = _n_repeated_fixed32 + 1; list[_n_repeated_fixed32] = val end elseif id == 38 then @@ -3130,16 +3166,16 @@ local list = result.repeated_fixed64 if list == nil then list = {}; result.repeated_fixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed64(payload, p2) + val, p2 = decode_fixed64(payload, p2) _n_repeated_fixed64 = _n_repeated_fixed64 + 1; list[_n_repeated_fixed64] = val end else local val - val, pos = wire.decode_fixed64(buf, pos) + val, pos = decode_fixed64(buf, pos) _n_repeated_fixed64 = _n_repeated_fixed64 + 1; list[_n_repeated_fixed64] = val end elseif id == 39 then @@ -3147,16 +3183,16 @@ local list = result.repeated_sfixed32 if list == nil then list = {}; result.repeated_sfixed32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sfixed32(payload, p2) + val, p2 = decode_sfixed32(payload, p2) _n_repeated_sfixed32 = _n_repeated_sfixed32 + 1; list[_n_repeated_sfixed32] = val end else local val - val, pos = wire.decode_sfixed32(buf, pos) + val, pos = decode_sfixed32(buf, pos) _n_repeated_sfixed32 = _n_repeated_sfixed32 + 1; list[_n_repeated_sfixed32] = val end elseif id == 40 then @@ -3164,16 +3200,16 @@ local list = result.repeated_sfixed64 if list == nil then list = {}; result.repeated_sfixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sfixed64(payload, p2) + val, p2 = decode_sfixed64(payload, p2) _n_repeated_sfixed64 = _n_repeated_sfixed64 + 1; list[_n_repeated_sfixed64] = val end else local val - val, pos = wire.decode_sfixed64(buf, pos) + val, pos = decode_sfixed64(buf, pos) _n_repeated_sfixed64 = _n_repeated_sfixed64 + 1; list[_n_repeated_sfixed64] = val end elseif id == 41 then @@ -3181,16 +3217,16 @@ local list = result.repeated_float if list == nil then list = {}; result.repeated_float = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_float(payload, p2) + val, p2 = decode_float(payload, p2) _n_repeated_float = _n_repeated_float + 1; list[_n_repeated_float] = val end else local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) _n_repeated_float = _n_repeated_float + 1; list[_n_repeated_float] = val end elseif id == 42 then @@ -3198,16 +3234,16 @@ local list = result.repeated_double if list == nil then list = {}; result.repeated_double = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_double(payload, p2) + val, p2 = decode_double(payload, p2) _n_repeated_double = _n_repeated_double + 1; list[_n_repeated_double] = val end else local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) _n_repeated_double = _n_repeated_double + 1; list[_n_repeated_double] = val end elseif id == 43 then @@ -3215,16 +3251,16 @@ local list = result.repeated_bool if list == nil then list = {}; result.repeated_bool = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_bool(payload, p2) + val, p2 = decode_bool(payload, p2) _n_repeated_bool = _n_repeated_bool + 1; list[_n_repeated_bool] = val end else local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) _n_repeated_bool = _n_repeated_bool + 1; list[_n_repeated_bool] = val end elseif id == 44 then @@ -3241,7 +3277,7 @@ _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = val end elseif id == 45 then @@ -3257,54 +3293,54 @@ _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = _s pos = _epos else local val - val, pos = wire.decode_bytes(buf, pos) + val, pos = decode_bytes(buf, pos) _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = val end elseif id == 48 then local list = result.repeated_nested_message if list == nil then list = {}; result.repeated_nested_message = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_nested_message = _n_repeated_nested_message + 1; list[_n_repeated_nested_message] = M.TestAllTypesProto3_NestedMessage_decode(payload) elseif id == 49 then local list = result.repeated_foreign_message if list == nil then list = {}; result.repeated_foreign_message = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_foreign_message = _n_repeated_foreign_message + 1; list[_n_repeated_foreign_message] = M.ForeignMessage_decode(payload) elseif id == 51 then local list = result.repeated_nested_enum if list == nil then list = {}; result.repeated_nested_enum = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local u - u, p2 = wire.decode_varint(payload, p2) - _n_repeated_nested_enum = _n_repeated_nested_enum + 1; list[_n_repeated_nested_enum] = wire.varint_to_int32(u) + u, p2 = decode_varint(payload, p2) + _n_repeated_nested_enum = _n_repeated_nested_enum + 1; list[_n_repeated_nested_enum] = varint_to_int32(u) end else local u - u, pos = wire.decode_varint(buf, pos) - _n_repeated_nested_enum = _n_repeated_nested_enum + 1; list[_n_repeated_nested_enum] = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + _n_repeated_nested_enum = _n_repeated_nested_enum + 1; list[_n_repeated_nested_enum] = varint_to_int32(u) end elseif id == 52 then local list = result.repeated_foreign_enum if list == nil then list = {}; result.repeated_foreign_enum = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local u - u, p2 = wire.decode_varint(payload, p2) - _n_repeated_foreign_enum = _n_repeated_foreign_enum + 1; list[_n_repeated_foreign_enum] = wire.varint_to_int32(u) + u, p2 = decode_varint(payload, p2) + _n_repeated_foreign_enum = _n_repeated_foreign_enum + 1; list[_n_repeated_foreign_enum] = varint_to_int32(u) end else local u - u, pos = wire.decode_varint(buf, pos) - _n_repeated_foreign_enum = _n_repeated_foreign_enum + 1; list[_n_repeated_foreign_enum] = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + _n_repeated_foreign_enum = _n_repeated_foreign_enum + 1; list[_n_repeated_foreign_enum] = varint_to_int32(u) end elseif id == 54 then local list = result.repeated_string_piece @@ -3320,7 +3356,7 @@ _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = val end elseif id == 55 then @@ -3337,7 +3373,7 @@ _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = val end elseif id == 75 then @@ -3345,16 +3381,16 @@ local list = result.packed_int32 if list == nil then list = {}; result.packed_int32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_packed_int32 = _n_packed_int32 + 1; list[_n_packed_int32] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_packed_int32 = _n_packed_int32 + 1; list[_n_packed_int32] = val end elseif id == 76 then @@ -3362,16 +3398,16 @@ local list = result.packed_int64 if list == nil then list = {}; result.packed_int64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int64(payload, p2) + val, p2 = decode_int64(payload, p2) _n_packed_int64 = _n_packed_int64 + 1; list[_n_packed_int64] = val end else local val - val, pos = wire.decode_int64(buf, pos) + val, pos = decode_int64(buf, pos) _n_packed_int64 = _n_packed_int64 + 1; list[_n_packed_int64] = val end elseif id == 77 then @@ -3379,16 +3415,16 @@ local list = result.packed_uint32 if list == nil then list = {}; result.packed_uint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_uint32(payload, p2) + val, p2 = decode_uint32(payload, p2) _n_packed_uint32 = _n_packed_uint32 + 1; list[_n_packed_uint32] = val end else local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) _n_packed_uint32 = _n_packed_uint32 + 1; list[_n_packed_uint32] = val end elseif id == 78 then @@ -3396,16 +3432,16 @@ local list = result.packed_uint64 if list == nil then list = {}; result.packed_uint64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_uint64(payload, p2) + val, p2 = decode_uint64(payload, p2) _n_packed_uint64 = _n_packed_uint64 + 1; list[_n_packed_uint64] = val end else local val - val, pos = wire.decode_uint64(buf, pos) + val, pos = decode_uint64(buf, pos) _n_packed_uint64 = _n_packed_uint64 + 1; list[_n_packed_uint64] = val end elseif id == 79 then @@ -3413,16 +3449,16 @@ local list = result.packed_sint32 if list == nil then list = {}; result.packed_sint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint32(payload, p2) + val, p2 = decode_sint32(payload, p2) _n_packed_sint32 = _n_packed_sint32 + 1; list[_n_packed_sint32] = val end else local val - val, pos = wire.decode_sint32(buf, pos) + val, pos = decode_sint32(buf, pos) _n_packed_sint32 = _n_packed_sint32 + 1; list[_n_packed_sint32] = val end elseif id == 80 then @@ -3430,16 +3466,16 @@ local list = result.packed_sint64 if list == nil then list = {}; result.packed_sint64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint64(payload, p2) + val, p2 = decode_sint64(payload, p2) _n_packed_sint64 = _n_packed_sint64 + 1; list[_n_packed_sint64] = val end else local val - val, pos = wire.decode_sint64(buf, pos) + val, pos = decode_sint64(buf, pos) _n_packed_sint64 = _n_packed_sint64 + 1; list[_n_packed_sint64] = val end elseif id == 81 then @@ -3447,16 +3483,16 @@ local list = result.packed_fixed32 if list == nil then list = {}; result.packed_fixed32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed32(payload, p2) + val, p2 = decode_fixed32(payload, p2) _n_packed_fixed32 = _n_packed_fixed32 + 1; list[_n_packed_fixed32] = val end else local val - val, pos = wire.decode_fixed32(buf, pos) + val, pos = decode_fixed32(buf, pos) _n_packed_fixed32 = _n_packed_fixed32 + 1; list[_n_packed_fixed32] = val end elseif id == 82 then @@ -3464,16 +3500,16 @@ local list = result.packed_fixed64 if list == nil then list = {}; result.packed_fixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed64(payload, p2) + val, p2 = decode_fixed64(payload, p2) _n_packed_fixed64 = _n_packed_fixed64 + 1; list[_n_packed_fixed64] = val end else local val - val, pos = wire.decode_fixed64(buf, pos) + val, pos = decode_fixed64(buf, pos) _n_packed_fixed64 = _n_packed_fixed64 + 1; list[_n_packed_fixed64] = val end elseif id == 83 then @@ -3481,16 +3517,16 @@ local list = result.packed_sfixed32 if list == nil then list = {}; result.packed_sfixed32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sfixed32(payload, p2) + val, p2 = decode_sfixed32(payload, p2) _n_packed_sfixed32 = _n_packed_sfixed32 + 1; list[_n_packed_sfixed32] = val end else local val - val, pos = wire.decode_sfixed32(buf, pos) + val, pos = decode_sfixed32(buf, pos) _n_packed_sfixed32 = _n_packed_sfixed32 + 1; list[_n_packed_sfixed32] = val end elseif id == 84 then @@ -3498,16 +3534,16 @@ local list = result.packed_sfixed64 if list == nil then list = {}; result.packed_sfixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sfixed64(payload, p2) + val, p2 = decode_sfixed64(payload, p2) _n_packed_sfixed64 = _n_packed_sfixed64 + 1; list[_n_packed_sfixed64] = val end else local val - val, pos = wire.decode_sfixed64(buf, pos) + val, pos = decode_sfixed64(buf, pos) _n_packed_sfixed64 = _n_packed_sfixed64 + 1; list[_n_packed_sfixed64] = val end elseif id == 85 then @@ -3515,16 +3551,16 @@ local list = result.packed_float if list == nil then list = {}; result.packed_float = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_float(payload, p2) + val, p2 = decode_float(payload, p2) _n_packed_float = _n_packed_float + 1; list[_n_packed_float] = val end else local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) _n_packed_float = _n_packed_float + 1; list[_n_packed_float] = val end elseif id == 86 then @@ -3532,16 +3568,16 @@ local list = result.packed_double if list == nil then list = {}; result.packed_double = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_double(payload, p2) + val, p2 = decode_double(payload, p2) _n_packed_double = _n_packed_double + 1; list[_n_packed_double] = val end else local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) _n_packed_double = _n_packed_double + 1; list[_n_packed_double] = val end elseif id == 87 then @@ -3549,16 +3585,16 @@ local list = result.packed_bool if list == nil then list = {}; result.packed_bool = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_bool(payload, p2) + val, p2 = decode_bool(payload, p2) _n_packed_bool = _n_packed_bool + 1; list[_n_packed_bool] = val end else local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) _n_packed_bool = _n_packed_bool + 1; list[_n_packed_bool] = val end elseif id == 88 then @@ -3566,33 +3602,33 @@ local list = result.packed_nested_enum if list == nil then list = {}; result.packed_nested_enum = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local u - u, p2 = wire.decode_varint(payload, p2) - _n_packed_nested_enum = _n_packed_nested_enum + 1; list[_n_packed_nested_enum] = wire.varint_to_int32(u) + u, p2 = decode_varint(payload, p2) + _n_packed_nested_enum = _n_packed_nested_enum + 1; list[_n_packed_nested_enum] = varint_to_int32(u) end else local u - u, pos = wire.decode_varint(buf, pos) - _n_packed_nested_enum = _n_packed_nested_enum + 1; list[_n_packed_nested_enum] = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + _n_packed_nested_enum = _n_packed_nested_enum + 1; list[_n_packed_nested_enum] = varint_to_int32(u) end elseif id == 89 then local list = result.unpacked_int32 if list == nil then list = {}; result.unpacked_int32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int32(payload, p2) + val, p2 = decode_int32(payload, p2) _n_unpacked_int32 = _n_unpacked_int32 + 1; list[_n_unpacked_int32] = val end else local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) _n_unpacked_int32 = _n_unpacked_int32 + 1; list[_n_unpacked_int32] = val end elseif id == 90 then @@ -3600,16 +3636,16 @@ local list = result.unpacked_int64 if list == nil then list = {}; result.unpacked_int64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_int64(payload, p2) + val, p2 = decode_int64(payload, p2) _n_unpacked_int64 = _n_unpacked_int64 + 1; list[_n_unpacked_int64] = val end else local val - val, pos = wire.decode_int64(buf, pos) + val, pos = decode_int64(buf, pos) _n_unpacked_int64 = _n_unpacked_int64 + 1; list[_n_unpacked_int64] = val end elseif id == 91 then @@ -3617,16 +3653,16 @@ local list = result.unpacked_uint32 if list == nil then list = {}; result.unpacked_uint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_uint32(payload, p2) + val, p2 = decode_uint32(payload, p2) _n_unpacked_uint32 = _n_unpacked_uint32 + 1; list[_n_unpacked_uint32] = val end else local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) _n_unpacked_uint32 = _n_unpacked_uint32 + 1; list[_n_unpacked_uint32] = val end elseif id == 92 then @@ -3634,16 +3670,16 @@ local list = result.unpacked_uint64 if list == nil then list = {}; result.unpacked_uint64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_uint64(payload, p2) + val, p2 = decode_uint64(payload, p2) _n_unpacked_uint64 = _n_unpacked_uint64 + 1; list[_n_unpacked_uint64] = val end else local val - val, pos = wire.decode_uint64(buf, pos) + val, pos = decode_uint64(buf, pos) _n_unpacked_uint64 = _n_unpacked_uint64 + 1; list[_n_unpacked_uint64] = val end elseif id == 93 then @@ -3651,16 +3687,16 @@ local list = result.unpacked_sint32 if list == nil then list = {}; result.unpacked_sint32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint32(payload, p2) + val, p2 = decode_sint32(payload, p2) _n_unpacked_sint32 = _n_unpacked_sint32 + 1; list[_n_unpacked_sint32] = val end else local val - val, pos = wire.decode_sint32(buf, pos) + val, pos = decode_sint32(buf, pos) _n_unpacked_sint32 = _n_unpacked_sint32 + 1; list[_n_unpacked_sint32] = val end elseif id == 94 then @@ -3668,16 +3704,16 @@ local list = result.unpacked_sint64 if list == nil then list = {}; result.unpacked_sint64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sint64(payload, p2) + val, p2 = decode_sint64(payload, p2) _n_unpacked_sint64 = _n_unpacked_sint64 + 1; list[_n_unpacked_sint64] = val end else local val - val, pos = wire.decode_sint64(buf, pos) + val, pos = decode_sint64(buf, pos) _n_unpacked_sint64 = _n_unpacked_sint64 + 1; list[_n_unpacked_sint64] = val end elseif id == 95 then @@ -3685,16 +3721,16 @@ local list = result.unpacked_fixed32 if list == nil then list = {}; result.unpacked_fixed32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed32(payload, p2) + val, p2 = decode_fixed32(payload, p2) _n_unpacked_fixed32 = _n_unpacked_fixed32 + 1; list[_n_unpacked_fixed32] = val end else local val - val, pos = wire.decode_fixed32(buf, pos) + val, pos = decode_fixed32(buf, pos) _n_unpacked_fixed32 = _n_unpacked_fixed32 + 1; list[_n_unpacked_fixed32] = val end elseif id == 96 then @@ -3702,16 +3738,16 @@ local list = result.unpacked_fixed64 if list == nil then list = {}; result.unpacked_fixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_fixed64(payload, p2) + val, p2 = decode_fixed64(payload, p2) _n_unpacked_fixed64 = _n_unpacked_fixed64 + 1; list[_n_unpacked_fixed64] = val end else local val - val, pos = wire.decode_fixed64(buf, pos) + val, pos = decode_fixed64(buf, pos) _n_unpacked_fixed64 = _n_unpacked_fixed64 + 1; list[_n_unpacked_fixed64] = val end elseif id == 97 then @@ -3719,16 +3755,16 @@ local list = result.unpacked_sfixed32 if list == nil then list = {}; result.unpacked_sfixed32 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sfixed32(payload, p2) + val, p2 = decode_sfixed32(payload, p2) _n_unpacked_sfixed32 = _n_unpacked_sfixed32 + 1; list[_n_unpacked_sfixed32] = val end else local val - val, pos = wire.decode_sfixed32(buf, pos) + val, pos = decode_sfixed32(buf, pos) _n_unpacked_sfixed32 = _n_unpacked_sfixed32 + 1; list[_n_unpacked_sfixed32] = val end elseif id == 98 then @@ -3736,16 +3772,16 @@ local list = result.unpacked_sfixed64 if list == nil then list = {}; result.unpacked_sfixed64 = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_sfixed64(payload, p2) + val, p2 = decode_sfixed64(payload, p2) _n_unpacked_sfixed64 = _n_unpacked_sfixed64 + 1; list[_n_unpacked_sfixed64] = val end else local val - val, pos = wire.decode_sfixed64(buf, pos) + val, pos = decode_sfixed64(buf, pos) _n_unpacked_sfixed64 = _n_unpacked_sfixed64 + 1; list[_n_unpacked_sfixed64] = val end elseif id == 99 then @@ -3753,16 +3789,16 @@ local list = result.unpacked_float if list == nil then list = {}; result.unpacked_float = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_float(payload, p2) + val, p2 = decode_float(payload, p2) _n_unpacked_float = _n_unpacked_float + 1; list[_n_unpacked_float] = val end else local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) _n_unpacked_float = _n_unpacked_float + 1; list[_n_unpacked_float] = val end elseif id == 100 then @@ -3770,16 +3806,16 @@ local list = result.unpacked_double if list == nil then list = {}; result.unpacked_double = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_double(payload, p2) + val, p2 = decode_double(payload, p2) _n_unpacked_double = _n_unpacked_double + 1; list[_n_unpacked_double] = val end else local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) _n_unpacked_double = _n_unpacked_double + 1; list[_n_unpacked_double] = val end elseif id == 101 then @@ -3787,16 +3823,16 @@ local list = result.unpacked_bool if list == nil then list = {}; result.unpacked_bool = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local val - val, p2 = wire.decode_bool(payload, p2) + val, p2 = decode_bool(payload, p2) _n_unpacked_bool = _n_unpacked_bool + 1; list[_n_unpacked_bool] = val end else local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) _n_unpacked_bool = _n_unpacked_bool + 1; list[_n_unpacked_bool] = val end elseif id == 102 then @@ -3804,34 +3840,34 @@ local list = result.unpacked_nested_enum if list == nil then list = {}; result.unpacked_nested_enum = list end if wt == 2 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local p2, lim = 1, #payload while p2 <= lim do local u - u, p2 = wire.decode_varint(payload, p2) - _n_unpacked_nested_enum = _n_unpacked_nested_enum + 1; list[_n_unpacked_nested_enum] = wire.varint_to_int32(u) + u, p2 = decode_varint(payload, p2) + _n_unpacked_nested_enum = _n_unpacked_nested_enum + 1; list[_n_unpacked_nested_enum] = varint_to_int32(u) end else local u - u, pos = wire.decode_varint(buf, pos) - _n_unpacked_nested_enum = _n_unpacked_nested_enum + 1; list[_n_unpacked_nested_enum] = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + _n_unpacked_nested_enum = _n_unpacked_nested_enum + 1; list[_n_unpacked_nested_enum] = varint_to_int32(u) end elseif id == 56 then local map = result.map_int32_int32 if map == nil then map = {}; result.map_int32_int32 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_int32(payload, _ep) + _key, _ep = decode_int32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_int32(payload, _ep) + _val, _ep = decode_int32(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3839,18 +3875,18 @@ elseif id == 57 then local map = result.map_int64_int64 if map == nil then map = {}; result.map_int64_int64 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_int64(payload, _ep) + _key, _ep = decode_int64(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_int64(payload, _ep) + _val, _ep = decode_int64(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end for _k in pairs(map) do @@ -3861,18 +3897,18 @@ elseif id == 58 then local map = result.map_uint32_uint32 if map == nil then map = {}; result.map_uint32_uint32 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_uint32(payload, _ep) + _key, _ep = decode_uint32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_uint32(payload, _ep) + _val, _ep = decode_uint32(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3880,18 +3916,18 @@ elseif id == 59 then local map = result.map_uint64_uint64 if map == nil then map = {}; result.map_uint64_uint64 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_uint64(payload, _ep) + _key, _ep = decode_uint64(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_uint64(payload, _ep) + _val, _ep = decode_uint64(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end for _k in pairs(map) do @@ -3902,18 +3938,18 @@ elseif id == 60 then local map = result.map_sint32_sint32 if map == nil then map = {}; result.map_sint32_sint32 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_sint32(payload, _ep) + _key, _ep = decode_sint32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_sint32(payload, _ep) + _val, _ep = decode_sint32(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3921,18 +3957,18 @@ elseif id == 61 then local map = result.map_sint64_sint64 if map == nil then map = {}; result.map_sint64_sint64 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_sint64(payload, _ep) + _key, _ep = decode_sint64(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_sint64(payload, _ep) + _val, _ep = decode_sint64(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end for _k in pairs(map) do @@ -3943,18 +3979,18 @@ elseif id == 62 then local map = result.map_fixed32_fixed32 if map == nil then map = {}; result.map_fixed32_fixed32 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_fixed32(payload, _ep) + _key, _ep = decode_fixed32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_fixed32(payload, _ep) + _val, _ep = decode_fixed32(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -3962,18 +3998,18 @@ elseif id == 63 then local map = result.map_fixed64_fixed64 if map == nil then map = {}; result.map_fixed64_fixed64 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_fixed64(payload, _ep) + _key, _ep = decode_fixed64(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_fixed64(payload, _ep) + _val, _ep = decode_fixed64(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end for _k in pairs(map) do @@ -3984,18 +4020,18 @@ elseif id == 64 then local map = result.map_sfixed32_sfixed32 if map == nil then map = {}; result.map_sfixed32_sfixed32 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_sfixed32(payload, _ep) + _key, _ep = decode_sfixed32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_sfixed32(payload, _ep) + _val, _ep = decode_sfixed32(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -4003,18 +4039,18 @@ elseif id == 65 then local map = result.map_sfixed64_sfixed64 if map == nil then map = {}; result.map_sfixed64_sfixed64 = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_sfixed64(payload, _ep) + _key, _ep = decode_sfixed64(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_sfixed64(payload, _ep) + _val, _ep = decode_sfixed64(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end for _k in pairs(map) do @@ -4025,18 +4061,18 @@ elseif id == 66 then local map = result.map_int32_float if map == nil then map = {}; result.map_int32_float = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_int32(payload, _ep) + _key, _ep = decode_int32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_float(payload, _ep) + _val, _ep = decode_float(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -4044,18 +4080,18 @@ elseif id == 67 then local map = result.map_int32_double if map == nil then map = {}; result.map_int32_double = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = 0, 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_int32(payload, _ep) + _key, _ep = decode_int32(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_double(payload, _ep) + _val, _ep = decode_double(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -4063,18 +4099,18 @@ elseif id == 68 then local map = result.map_bool_bool if map == nil then map = {}; result.map_bool_bool = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = false, false while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_bool(payload, _ep) + _key, _ep = decode_bool(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_bool(payload, _ep) + _val, _ep = decode_bool(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -4082,18 +4118,18 @@ elseif id == 69 then local map = result.map_string_string if map == nil then map = {}; result.map_string_string = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', '' while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_string(payload, _ep) + _val, _ep = decode_string(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -4101,18 +4137,18 @@ elseif id == 70 then local map = result.map_string_bytes if map == nil then map = {}; result.map_string_bytes = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', '' while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then - _val, _ep = wire.decode_bytes(payload, _ep) + _val, _ep = decode_bytes(payload, _ep) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -4120,20 +4156,20 @@ elseif id == 71 then local map = result.map_string_nested_message if map == nil then map = {}; result.map_string_nested_message = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', {} while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then local _payload - _payload, _ep = wire.decode_len(payload, _ep) + _payload, _ep = decode_len(payload, _ep) _val = M.TestAllTypesProto3_NestedMessage_decode(_payload) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -4141,20 +4177,20 @@ elseif id == 72 then local map = result.map_string_foreign_message if map == nil then map = {}; result.map_string_foreign_message = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', {} while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then local _payload - _payload, _ep = wire.decode_len(payload, _ep) + _payload, _ep = decode_len(payload, _ep) _val = M.ForeignMessage_decode(_payload) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -4162,20 +4198,20 @@ elseif id == 73 then local map = result.map_string_nested_enum if map == nil then map = {}; result.map_string_nested_enum = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then local _u - _u, _ep = wire.decode_varint(payload, _ep) - _val = wire.varint_to_int32(_u) + _u, _ep = decode_varint(payload, _ep) + _val = varint_to_int32(_u) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val @@ -4183,26 +4219,26 @@ elseif id == 74 then local map = result.map_string_foreign_enum if map == nil then map = {}; result.map_string_foreign_enum = map end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local _ep, _elim = 1, #payload local _key, _val = '', 0 while _ep <= _elim do local eid, ewt - eid, ewt, _ep = wire.decode_tag(payload, _ep) + eid, ewt, _ep = decode_tag(payload, _ep) if eid == 1 then - _key, _ep = wire.decode_string(payload, _ep) + _key, _ep = decode_string(payload, _ep) elseif eid == 2 then local _u - _u, _ep = wire.decode_varint(payload, _ep) - _val = wire.varint_to_int32(_u) + _u, _ep = decode_varint(payload, _ep) + _val = varint_to_int32(_u) else - _ep = wire.skip_field(payload, _ep, ewt, eid) + _ep = skip_field(payload, _ep, ewt, eid) end end map[_key] = _val elseif id == 111 then local val - val, pos = wire.decode_uint32(buf, pos) + val, pos = decode_uint32(buf, pos) result.oneof_uint32 = val result.oneof_nested_message = nil result.oneof_string = nil @@ -4215,7 +4251,7 @@ result.oneof_enum = nil result.oneof_null_value = nil elseif id == 112 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) local prev = result.oneof_nested_message if prev == nil then result.oneof_nested_message = M.TestAllTypesProto3_NestedMessage_decode(payload) @@ -4243,7 +4279,7 @@ result.oneof_string = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.oneof_string = val end result.oneof_uint32 = nil @@ -4266,7 +4302,7 @@ result.oneof_bytes = _s pos = _epos else local val - val, pos = wire.decode_bytes(buf, pos) + val, pos = decode_bytes(buf, pos) result.oneof_bytes = val end result.oneof_uint32 = nil @@ -4280,7 +4316,7 @@ result.oneof_enum = nil result.oneof_null_value = nil elseif id == 115 then local val - val, pos = wire.decode_bool(buf, pos) + val, pos = decode_bool(buf, pos) result.oneof_bool = val result.oneof_uint32 = nil result.oneof_nested_message = nil @@ -4293,7 +4329,7 @@ result.oneof_enum = nil result.oneof_null_value = nil elseif id == 116 then local val - val, pos = wire.decode_uint64(buf, pos) + val, pos = decode_uint64(buf, pos) result.oneof_uint64 = val result.oneof_uint32 = nil result.oneof_nested_message = nil @@ -4306,7 +4342,7 @@ result.oneof_enum = nil result.oneof_null_value = nil elseif id == 117 then local val - val, pos = wire.decode_float(buf, pos) + val, pos = decode_float(buf, pos) result.oneof_float = val result.oneof_uint32 = nil result.oneof_nested_message = nil @@ -4319,7 +4355,7 @@ result.oneof_enum = nil result.oneof_null_value = nil elseif id == 118 then local val - val, pos = wire.decode_double(buf, pos) + val, pos = decode_double(buf, pos) result.oneof_double = val result.oneof_uint32 = nil result.oneof_nested_message = nil @@ -4332,8 +4368,8 @@ result.oneof_enum = nil result.oneof_null_value = nil elseif id == 119 then local u - u, pos = wire.decode_varint(buf, pos) - result.oneof_enum = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + result.oneof_enum = varint_to_int32(u) result.oneof_uint32 = nil result.oneof_nested_message = nil result.oneof_string = nil @@ -4345,8 +4381,8 @@ result.oneof_double = nil result.oneof_null_value = nil elseif id == 120 then local u - u, pos = wire.decode_varint(buf, pos) - result.oneof_null_value = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + result.oneof_null_value = varint_to_int32(u) result.oneof_uint32 = nil result.oneof_nested_message = nil result.oneof_string = nil @@ -4358,245 +4394,245 @@ result.oneof_double = nil result.oneof_enum = nil elseif id == 201 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_bool_wrapper = pb.wkt.BoolValue_decode(payload) elseif id == 202 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_int32_wrapper = pb.wkt.Int32Value_decode(payload) elseif id == 203 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_int64_wrapper = pb.wkt.Int64Value_decode(payload) elseif id == 204 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_uint32_wrapper = pb.wkt.UInt32Value_decode(payload) elseif id == 205 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_uint64_wrapper = pb.wkt.UInt64Value_decode(payload) elseif id == 206 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_float_wrapper = pb.wkt.FloatValue_decode(payload) elseif id == 207 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_double_wrapper = pb.wkt.DoubleValue_decode(payload) elseif id == 208 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_string_wrapper = pb.wkt.StringValue_decode(payload) elseif id == 209 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_bytes_wrapper = pb.wkt.BytesValue_decode(payload) elseif id == 211 then local list = result.repeated_bool_wrapper if list == nil then list = {}; result.repeated_bool_wrapper = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_bool_wrapper = _n_repeated_bool_wrapper + 1; list[_n_repeated_bool_wrapper] = pb.wkt.BoolValue_decode(payload) elseif id == 212 then local list = result.repeated_int32_wrapper if list == nil then list = {}; result.repeated_int32_wrapper = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_int32_wrapper = _n_repeated_int32_wrapper + 1; list[_n_repeated_int32_wrapper] = pb.wkt.Int32Value_decode(payload) elseif id == 213 then local list = result.repeated_int64_wrapper if list == nil then list = {}; result.repeated_int64_wrapper = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_int64_wrapper = _n_repeated_int64_wrapper + 1; list[_n_repeated_int64_wrapper] = pb.wkt.Int64Value_decode(payload) elseif id == 214 then local list = result.repeated_uint32_wrapper if list == nil then list = {}; result.repeated_uint32_wrapper = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_uint32_wrapper = _n_repeated_uint32_wrapper + 1; list[_n_repeated_uint32_wrapper] = pb.wkt.UInt32Value_decode(payload) elseif id == 215 then local list = result.repeated_uint64_wrapper if list == nil then list = {}; result.repeated_uint64_wrapper = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_uint64_wrapper = _n_repeated_uint64_wrapper + 1; list[_n_repeated_uint64_wrapper] = pb.wkt.UInt64Value_decode(payload) elseif id == 216 then local list = result.repeated_float_wrapper if list == nil then list = {}; result.repeated_float_wrapper = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_float_wrapper = _n_repeated_float_wrapper + 1; list[_n_repeated_float_wrapper] = pb.wkt.FloatValue_decode(payload) elseif id == 217 then local list = result.repeated_double_wrapper if list == nil then list = {}; result.repeated_double_wrapper = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_double_wrapper = _n_repeated_double_wrapper + 1; list[_n_repeated_double_wrapper] = pb.wkt.DoubleValue_decode(payload) elseif id == 218 then local list = result.repeated_string_wrapper if list == nil then list = {}; result.repeated_string_wrapper = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_string_wrapper = _n_repeated_string_wrapper + 1; list[_n_repeated_string_wrapper] = pb.wkt.StringValue_decode(payload) elseif id == 219 then local list = result.repeated_bytes_wrapper if list == nil then list = {}; result.repeated_bytes_wrapper = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_bytes_wrapper = _n_repeated_bytes_wrapper + 1; list[_n_repeated_bytes_wrapper] = pb.wkt.BytesValue_decode(payload) elseif id == 301 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_duration = pb.wkt.Duration_decode(payload) elseif id == 302 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_timestamp = pb.wkt.Timestamp_decode(payload) elseif id == 303 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_field_mask = pb.wkt.FieldMask_decode(payload) elseif id == 304 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_struct = pb.wkt.Struct_decode(payload) elseif id == 305 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_any = pb.wkt.Any_decode(payload) elseif id == 306 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_value = pb.wkt.Value_decode(payload) elseif id == 307 then local u - u, pos = wire.decode_varint(buf, pos) - result.optional_null_value = wire.varint_to_int32(u) + u, pos = decode_varint(buf, pos) + result.optional_null_value = varint_to_int32(u) elseif id == 308 then local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) result.optional_empty = pb.wkt.Empty_decode(payload) elseif id == 311 then local list = result.repeated_duration if list == nil then list = {}; result.repeated_duration = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_duration = _n_repeated_duration + 1; list[_n_repeated_duration] = pb.wkt.Duration_decode(payload) elseif id == 312 then local list = result.repeated_timestamp if list == nil then list = {}; result.repeated_timestamp = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_timestamp = _n_repeated_timestamp + 1; list[_n_repeated_timestamp] = pb.wkt.Timestamp_decode(payload) elseif id == 313 then local list = result.repeated_fieldmask if list == nil then list = {}; result.repeated_fieldmask = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_fieldmask = _n_repeated_fieldmask + 1; list[_n_repeated_fieldmask] = pb.wkt.FieldMask_decode(payload) elseif id == 324 then local list = result.repeated_struct if list == nil then list = {}; result.repeated_struct = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_struct = _n_repeated_struct + 1; list[_n_repeated_struct] = pb.wkt.Struct_decode(payload) elseif id == 315 then local list = result.repeated_any if list == nil then list = {}; result.repeated_any = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_any = _n_repeated_any + 1; list[_n_repeated_any] = pb.wkt.Any_decode(payload) elseif id == 316 then local list = result.repeated_value if list == nil then list = {}; result.repeated_value = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_value = _n_repeated_value + 1; list[_n_repeated_value] = pb.wkt.Value_decode(payload) elseif id == 317 then local list = result.repeated_list_value if list == nil then list = {}; result.repeated_list_value = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_list_value = _n_repeated_list_value + 1; list[_n_repeated_list_value] = pb.wkt.ListValue_decode(payload) elseif id == 318 then local list = result.repeated_empty if list == nil then list = {}; result.repeated_empty = list end local payload - payload, pos = wire.decode_len(buf, pos) + payload, pos = decode_len(buf, pos) _n_repeated_empty = _n_repeated_empty + 1; list[_n_repeated_empty] = pb.wkt.Empty_decode(payload) elseif id == 401 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.fieldname1 = val elseif id == 402 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field_name2 = val elseif id == 403 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result._field_name3 = val elseif id == 404 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field__name4_ = val elseif id == 405 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field0name5 = val elseif id == 406 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field_0_name6 = val elseif id == 407 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.fieldName7 = val elseif id == 408 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.FieldName8 = val elseif id == 409 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field_Name9 = val elseif id == 410 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.Field_Name10 = val elseif id == 411 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.FIELD_NAME11 = val elseif id == 412 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.FIELD_name12 = val elseif id == 413 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.__field_name13 = val elseif id == 414 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.__Field_name14 = val elseif id == 415 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field__name15 = val elseif id == 416 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field__Name16 = val elseif id == 417 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.field_name17__ = val elseif id == 418 then local val - val, pos = wire.decode_int32(buf, pos) + val, pos = decode_int32(buf, pos) result.Field_name18__ = val else local _ebid = M.TestAllTypesProto3_descriptor.extensions_by_id @@ -4604,7 +4640,7 @@ local _ext = _ebid and _ebid[id] or nil if _ext ~= nil then pos = pb.codec.decode_extension(_ext, buf, pos, wt, result) else - pos = wire.skip_field(buf, pos, wt, id) + pos = skip_field(buf, pos, wt, id) if _uf == nil then _uf = {} end _uf[#_uf + 1] = buf:sub(_tag_start, pos - 1) end diff --git a/examples/expected/full/quickstart/quickstart_pb.lua b/examples/expected/full/quickstart/quickstart_pb.lua index cdb0ce452f3df7d360f09366df54f61b4af0ddb7..4a6494eeb0d5fe0c4dbd40b5703bf35dbe5dc289 100644 --- a/examples/expected/full/quickstart/quickstart_pb.lua +++ b/examples/expected/full/quickstart/quickstart_pb.lua @@ -58,6 +58,8 @@ ---@param t quickstart.User ---@return string function M.User_encode(t) + local encode_int32 = wire.encode_int32 + local encode_varint = wire.encode_varint local _d = M.User_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -72,7 +74,7 @@ -- field 1: id v = t.id if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x08" - n = n + 1; out[n] = wire.encode_int32(v) + n = n + 1; out[n] = encode_int32(v) end -- field 2: name v = t.name @@ -82,7 +84,7 @@ local _len = #v if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = v end @@ -96,7 +98,7 @@ if nv == nil then error("unknown enum value '" .. v .. "' for quickstart.Role", 0) end end if nv ~= 0 then n = n + 1; out[n] = "\x18" - n = n + 1; out[n] = wire.encode_int32(nv) + n = n + 1; out[n] = encode_int32(nv) end end -- field 4: emails @@ -110,7 +112,7 @@ local _len = #_b if _len < 128 then n = n + 1; out[n] = string.char(_len) else - n = n + 1; out[n] = wire.encode_varint(_len) + n = n + 1; out[n] = encode_varint(_len) end n = n + 1; out[n] = _b end @@ -137,6 +139,7 @@ ---@param b string ---@return quickstart.User function M.User_decode(buf) + local decode_string = wire.decode_string local _d = M.User_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) @@ -178,7 +181,7 @@ result.name = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) result.name = val end elseif id == 3 then @@ -199,7 +202,7 @@ _n_emails = _n_emails + 1; list[_n_emails] = _s pos = _epos else local val - val, pos = wire.decode_string(buf, pos) + val, pos = decode_string(buf, pos) _n_emails = _n_emails + 1; list[_n_emails] = val end else