mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-23 03:38:35 +00:00
vm: redefine SHL/SHR limits based on integer size
This commit is contained in:
parent
439cd72294
commit
816d78b5ee
2 changed files with 4 additions and 4 deletions
|
@ -51,8 +51,8 @@ const (
|
|||
// on all stacks at once.
|
||||
MaxStackSize = 2 * 1024
|
||||
|
||||
maxSHLArg = 256
|
||||
minSHLArg = -256
|
||||
maxSHLArg = MaxBigIntegerSizeBits
|
||||
minSHLArg = -MaxBigIntegerSizeBits
|
||||
)
|
||||
|
||||
// VM represents the virtual machine.
|
||||
|
|
|
@ -624,7 +624,7 @@ func TestSHRSmallValue(t *testing.T) {
|
|||
prog := makeProgram(SHR)
|
||||
vm := load(prog)
|
||||
vm.estack.PushVal(5)
|
||||
vm.estack.PushVal(-257)
|
||||
vm.estack.PushVal(minSHLArg - 1)
|
||||
checkVMFailed(t, vm)
|
||||
}
|
||||
|
||||
|
@ -660,7 +660,7 @@ func TestSHLBigValue(t *testing.T) {
|
|||
prog := makeProgram(SHL)
|
||||
vm := load(prog)
|
||||
vm.estack.PushVal(5)
|
||||
vm.estack.PushVal(257)
|
||||
vm.estack.PushVal(maxSHLArg + 1)
|
||||
checkVMFailed(t, vm)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue