Make memory sizes parameters
This commit is contained in:
@@ -4,7 +4,7 @@ import "math/rand"
|
||||
|
||||
import "github.com/firestuff/subcoding/vm"
|
||||
|
||||
func randOperand(t vm.OperandNumericType) *vm.Operand {
|
||||
func randOperand(prog *vm.Program, t vm.OperandNumericType) *vm.Operand {
|
||||
for {
|
||||
op := &vm.Operand{
|
||||
Type: randOperandType(),
|
||||
@@ -12,10 +12,10 @@ func randOperand(t vm.OperandNumericType) *vm.Operand {
|
||||
|
||||
switch op.Type {
|
||||
case vm.GlobalMemoryIndex:
|
||||
op.Value = RandBiasedUint64n(vm.GlobalMemorySize)
|
||||
op.Value = RandBiasedUint64n(prog.GlobalMemorySize)
|
||||
|
||||
case vm.FunctionMemoryIndex:
|
||||
op.Value = RandBiasedUint64n(vm.FunctionMemorySize)
|
||||
op.Value = RandBiasedUint64n(prog.FunctionMemorySize)
|
||||
|
||||
case vm.Literal:
|
||||
switch t {
|
||||
|
||||
Reference in New Issue
Block a user