-
Notifications
You must be signed in to change notification settings - Fork 360
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
opt: encoder support Uint64ToString and Int64ToString #723
base: main
Are you sure you want to change the base?
Changes from all commits
b7038ed
7a803da
1db3dd0
7ad6f70
3f2445c
fcd8778
fd815ec
ee2a13a
90ab8e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,7 +179,7 @@ func (self *Compiler) compileOps(p *ir.Program, sp int, vt reflect.Type) { | |
case reflect.Bool: | ||
p.Add(ir.OP_bool) | ||
case reflect.Int: | ||
p.Add(ir.OP_int()) | ||
p.Add(ir.OP_int(), ir.OP_i) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里没看懂,应该没必要加这个CompactOp。在具体的 OP_i64读取flag bit或IsMapKey()进行处理就行了 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 因为vm里是用uint64的逻辑处理int的,如果没有compatOp,则会把int也处理 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 底层的OP int和uint都是分开的,这里肯定是不需要的。“vm里是用uint64的逻辑处理int的” There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
vm里确实是分开的,但是vm里Add时,调用了这样一个函数:
uint也有类似处理,这相当于int用int64、uint用uint64的相关函数来处理了 还有别的地方做差异化处理了吗? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. uint也可能会导致溢出,为啥不支持这个选项?我觉得这个选项只考虑uint64不合理 |
||
case reflect.Int8: | ||
p.Add(ir.OP_i8) | ||
case reflect.Int16: | ||
|
@@ -189,7 +189,7 @@ func (self *Compiler) compileOps(p *ir.Program, sp int, vt reflect.Type) { | |
case reflect.Int64: | ||
p.Add(ir.OP_i64) | ||
case reflect.Uint: | ||
p.Add(ir.OP_uint()) | ||
p.Add(ir.OP_uint(), ir.OP_u) | ||
case reflect.Uint8: | ||
p.Add(ir.OP_u8) | ||
case reflect.Uint16: | ||
|
@@ -301,7 +301,7 @@ func (self *Compiler) compileMapBodyTextKey(p *ir.Program, vk reflect.Type) { | |
case reflect.Bool: | ||
p.Key(ir.OP_bool) | ||
case reflect.Int: | ||
p.Key(ir.OP_int()) | ||
p.Key(ir.OP_int(), ir.OP_i) | ||
case reflect.Int8: | ||
p.Key(ir.OP_i8) | ||
case reflect.Int16: | ||
|
@@ -311,7 +311,7 @@ func (self *Compiler) compileMapBodyTextKey(p *ir.Program, vk reflect.Type) { | |
case reflect.Int64: | ||
p.Key(ir.OP_i64) | ||
case reflect.Uint: | ||
p.Key(ir.OP_uint()) | ||
p.Key(ir.OP_uint(), ir.OP_u) | ||
case reflect.Uint8: | ||
p.Key(ir.OP_u8) | ||
case reflect.Uint16: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
两个选项没必要,合并成一个选项吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
收到