-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
int64 encoder _VarintSize error! #23
Comments
我今天也遇到你这个问题,测试发现这样改没有效果。 |
我看了一下我们项目里完整的修改 1.encoder.lua
改成
2.ware_format里 (非必要?)
改成
4.protobuf.lua
改成
仅供参考 |
测试OK啦,安卓上也测试OK,非常感谢您!! @zhenmu |
测试可用,感谢楼主 |
如上修改 发现,java后端传来的long型数值,在客户端解析的数据溢出 |
最大支持50位。 |
为什么最大是50位呀,哪里有限制的呢,不是真的int64呢 |
lua存放数值这类的都是用double的 |
有64位字段的message,里面数值很大时 在计算 bytesize时出错, 应该是之前代码没兼容64位
function _VarintSize(value)
if value <= 0x7f then return 1 end
if value <= 0x3fff then return 2 end
if value <= 0x1fffff then return 3 end
if value <= 0xfffffff then return 4 end
return 5
end
may need to change:
function _VarintSize(value)
if value <= 0x7f then return 1 end
if value <= 0x3fff then return 2 end
if value <= 0x1fffff then return 3 end
if value <= 0xfffffff then return 4 end
if value <= 0x7ffffffff then return 5 end
if value <= 0x3ffffffffff then return 6 end
if value <= 0x1ffffffffffff then return 7 end
if value <= 0xffffffffffffff then return 8 end
if value <= 0x7fffffffffffffff then return 9 end
return 10
end
不知道这样改可行不可行?
The text was updated successfully, but these errors were encountered: