-- Code generated by protoc-gen-tarantool. DO NOT EDIT. -- source: c_int64.proto -- syntax: proto3 -- package: c_int64 local pb = require("pb") local wire = pb.wire local string_byte = string.byte local utf8_len = require('utf8').len local band = bit.band local rshift = bit.rshift local CHARS = wire.CHARS local table_new = require('table.new') local M = {} M.options = {go_package = "tarantoolpb_synthetic/c_int64"} -- Pre-declare message descriptors so cross-references resolve. M.Wide_descriptor = {name = "c_int64.Wide"} -- Message: c_int64.Wide M.Wide_descriptor.fields = { {name="a_int64", id=1, kind='scalar', proto_type="int64"}, {name="a_uint64", id=2, kind='scalar', proto_type="uint64"}, {name="a_sint64", id=3, kind='scalar', proto_type="sint64"}, {name="a_fixed64", id=4, kind='scalar', proto_type="fixed64"}, {name="a_sfixed64", id=5, kind='scalar', proto_type="sfixed64"}, } pb.finalize_message(M.Wide_descriptor) M.Wide_fields = pb.field_names({ a_int64 = "a_int64", a_uint64 = "a_uint64", a_sint64 = "a_sint64", a_fixed64 = "a_fixed64", a_sfixed64 = "a_sfixed64", }) -- EmmyLua / lua-language-server type annotations. -- These are comments — no runtime effect. They give editors -- autocomplete and type-checking for the generated wrappers. ---@class c_int64.Wide ---@field a_int64 integer ---@field a_uint64 integer ---@field a_sint64 integer ---@field a_fixed64 integer ---@field a_sfixed64 integer ---@param t? c_int64.Wide ---@return c_int64.Wide function M.Wide_new(t) return t or {} end ---@param t c_int64.Wide ---@return string function M.Wide_encode(t) local _d = M.Wide_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) return pb.c_runtime.encode(_p, t) end if type(t) ~= 'table' then error("expected table for c_int64.Wide, got " .. type(t), 0) end local out, n = {}, 0 local v -- field 1: a_int64 v = t.a_int64 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x08" n = n + 1; out[n] = wire.encode_int64(v) end -- field 2: a_uint64 v = t.a_uint64 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x10" n = n + 1; out[n] = wire.encode_uint64(v) end -- field 3: a_sint64 v = t.a_sint64 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x18" n = n + 1; out[n] = wire.encode_sint64(v) end -- field 4: a_fixed64 v = t.a_fixed64 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x21" n = n + 1; out[n] = wire.encode_fixed64(v) end -- field 5: a_sfixed64 v = t.a_sfixed64 if v ~= nil and v ~= 0 then n = n + 1; out[n] = "\x29" n = n + 1; out[n] = wire.encode_sfixed64(v) end local _uf = t._unknown_fields if _uf ~= nil and _uf ~= '' then n = n + 1; out[n] = _uf end return table.concat(out) end ---@param b string ---@return c_int64.Wide function M.Wide_decode(buf) local decode_tag = wire.decode_tag local _d = M.Wide_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) return pb.c_runtime.decode(_p, buf) end if type(buf) ~= 'string' then error("expected string for c_int64.Wide decode, got " .. type(buf), 0) end local result = {} local pos, len = 1, #buf local _uf while pos <= len do local _tag_start = pos local id, wt local _b = string_byte(buf, pos) if _b ~= nil and _b < 0x80 then wt = band(_b, 7) if wt >= 6 then error("illegal wire type " .. wt, 0) end id = rshift(_b, 3) if id == 0 then error("illegal field number 0", 0) end pos = pos + 1 elseif _b ~= nil and pos < len then local _b2 = string_byte(buf, pos + 1) if _b2 < 0x80 then if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end local _v = _b - 128 + _b2 * 128 wt = band(_v, 7) if wt >= 6 then error("illegal wire type " .. wt, 0) end id = rshift(_v, 3) pos = pos + 2 else id, wt, pos = decode_tag(buf, pos) end else id, wt, pos = decode_tag(buf, pos) end if id == 1 then local val val, pos = wire.decode_int64(buf, pos) result.a_int64 = val elseif id == 2 then local val val, pos = wire.decode_uint64(buf, pos) result.a_uint64 = val elseif id == 3 then local val val, pos = wire.decode_sint64(buf, pos) result.a_sint64 = val elseif id == 4 then local val val, pos = wire.decode_fixed64(buf, pos) result.a_fixed64 = val elseif id == 5 then local val val, pos = wire.decode_sfixed64(buf, pos) result.a_sfixed64 = val else local _ebid = M.Wide_descriptor.extensions_by_id 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) if _uf == nil then _uf = {} end _uf[#_uf + 1] = buf:sub(_tag_start, pos - 1) end end end if _uf ~= nil then result._unknown_fields = table.concat(_uf) end return result end ---@param b string ---@return c_int64.Wide function M.Wide_decode_unsafe(buf) local decode_tag = wire.decode_tag local _d = M.Wide_descriptor if pb.c_runtime ~= nil then local _p = _d.c_plan or pb.c_runtime.compile_plan(_d) return pb.c_runtime.decode_unsafe(_p, buf) end if type(buf) ~= 'string' then error("expected string for c_int64.Wide decode, got " .. type(buf), 0) end local result = {} local pos, len = 1, #buf local _uf while pos <= len do local _tag_start = pos local id, wt local _b = string_byte(buf, pos) if _b ~= nil and _b < 0x80 then wt = band(_b, 7) if wt >= 6 then error("illegal wire type " .. wt, 0) end id = rshift(_b, 3) if id == 0 then error("illegal field number 0", 0) end pos = pos + 1 elseif _b ~= nil and pos < len then local _b2 = string_byte(buf, pos + 1) if _b2 < 0x80 then if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end local _v = _b - 128 + _b2 * 128 wt = band(_v, 7) if wt >= 6 then error("illegal wire type " .. wt, 0) end id = rshift(_v, 3) pos = pos + 2 else id, wt, pos = decode_tag(buf, pos) end else id, wt, pos = decode_tag(buf, pos) end if id == 1 then local val val, pos = wire.decode_int64(buf, pos) result.a_int64 = val elseif id == 2 then local val val, pos = wire.decode_uint64(buf, pos) result.a_uint64 = val elseif id == 3 then local val val, pos = wire.decode_sint64(buf, pos) result.a_sint64 = val elseif id == 4 then local val val, pos = wire.decode_fixed64(buf, pos) result.a_fixed64 = val elseif id == 5 then local val val, pos = wire.decode_sfixed64(buf, pos) result.a_sfixed64 = val else local _ebid = M.Wide_descriptor.extensions_by_id 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) if _uf == nil then _uf = {} end _uf[#_uf + 1] = buf:sub(_tag_start, pos - 1) end end end if _uf ~= nil then result._unknown_fields = table.concat(_uf) end return result end ---@param b string ---@return pb.MessageView function M.Wide_decode_lazy(b) return pb.decode_lazy(M.Wide_descriptor, b) end ---@param t c_int64.Wide ---@param opts? {single_line: boolean?, indent: string?} ---@return string function M.Wide_text(t, opts) return pb.text.encode(M.Wide_descriptor, t, opts) end return M