mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 13:41:37 +00:00
implemented bitwise instructions and fixed loading constants of type uint (CityOfZion/neo-storm#49)
Imported from CityOfZion/neo-storm (b8a9b14dacc4fd6a62c236b2e89545684435a8fb).
This commit is contained in:
parent
459d3654a2
commit
a765561b3a
1 changed files with 11 additions and 1 deletions
|
@ -58,7 +58,7 @@ func (c *codegen) emitLoadConst(t types.TypeAndValue) {
|
|||
switch typ := t.Type.Underlying().(type) {
|
||||
case *types.Basic:
|
||||
switch typ.Kind() {
|
||||
case types.Int, types.UntypedInt:
|
||||
case types.Int, types.UntypedInt, types.Uint:
|
||||
val, _ := constant.Int64Val(t.Value)
|
||||
emitInt(c.prog, val)
|
||||
case types.String, types.UntypedString:
|
||||
|
@ -686,6 +686,16 @@ func (c *codegen) convertToken(tok token.Token) {
|
|||
emitOpcode(c.prog, vm.INC)
|
||||
case token.NOT:
|
||||
emitOpcode(c.prog, vm.NOT)
|
||||
case token.AND:
|
||||
emitOpcode(c.prog, vm.AND)
|
||||
case token.OR:
|
||||
emitOpcode(c.prog, vm.OR)
|
||||
case token.SHL:
|
||||
emitOpcode(c.prog, vm.SHL)
|
||||
case token.SHR:
|
||||
emitOpcode(c.prog, vm.SHR)
|
||||
case token.XOR:
|
||||
emitOpcode(c.prog, vm.XOR)
|
||||
default:
|
||||
log.Fatalf("compiler could not convert token: %s", tok)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue