From 320bd7418c4c807bc6ad94328ac75845f5344729 Mon Sep 17 00:00:00 2001 From: Federica Date: Tue, 19 Sep 2023 15:23:53 -0300 Subject: [PATCH] Move consts, use named import --- pkg/hints/{ => hint_codes}/math_cmp_hint_codes.go | 2 +- pkg/hints/math_cmp_hints.go | 6 +++--- pkg/hints/math_cmp_hints_test.go | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) rename pkg/hints/{ => hint_codes}/math_cmp_hint_codes.go (93%) diff --git a/pkg/hints/math_cmp_hint_codes.go b/pkg/hints/hint_codes/math_cmp_hint_codes.go similarity index 93% rename from pkg/hints/math_cmp_hint_codes.go rename to pkg/hints/hint_codes/math_cmp_hint_codes.go index 525d8cc1..fcd4f9f4 100644 --- a/pkg/hints/math_cmp_hint_codes.go +++ b/pkg/hints/hint_codes/math_cmp_hint_codes.go @@ -1,4 +1,4 @@ -package hints +package hint_codes const IS_NN = "memory[ap] = 0 if 0 <= (ids.a % PRIME) < range_check_builtin.bound else 1" diff --git a/pkg/hints/math_cmp_hints.go b/pkg/hints/math_cmp_hints.go index 5ee40405..5e4e064b 100644 --- a/pkg/hints/math_cmp_hints.go +++ b/pkg/hints/math_cmp_hints.go @@ -1,7 +1,7 @@ package hints import ( - . "github.com/lambdaclass/cairo-vm.go/pkg/builtins" + "github.com/lambdaclass/cairo-vm.go/pkg/builtins" . "github.com/lambdaclass/cairo-vm.go/pkg/hints/hint_utils" . "github.com/lambdaclass/cairo-vm.go/pkg/lambdaworks" . "github.com/lambdaclass/cairo-vm.go/pkg/vm" @@ -14,7 +14,7 @@ func isNN(ids IdsManager, vm *VirtualMachine) error { if err != nil { return err } - if a.Bits() < RANGE_CHECK_N_PARTS*INNER_RC_BOUND_SHIFT { + if a.Bits() < builtins.RANGE_CHECK_N_PARTS*builtins.INNER_RC_BOUND_SHIFT { return vm.Segments.Memory.Insert(vm.RunContext.Ap, NewMaybeRelocatableFelt(FeltZero())) } return vm.Segments.Memory.Insert(vm.RunContext.Ap, NewMaybeRelocatableFelt(FeltOne())) @@ -26,7 +26,7 @@ func isNNOutOfRange(ids IdsManager, vm *VirtualMachine) error { if err != nil { return err } - if (FeltZero().Sub(a).Sub(FeltOne())).Bits() < RANGE_CHECK_N_PARTS*INNER_RC_BOUND_SHIFT { + if (FeltZero().Sub(a).Sub(FeltOne())).Bits() < builtins.RANGE_CHECK_N_PARTS*builtins.INNER_RC_BOUND_SHIFT { return vm.Segments.Memory.Insert(vm.RunContext.Ap, NewMaybeRelocatableFelt(FeltZero())) } return vm.Segments.Memory.Insert(vm.RunContext.Ap, NewMaybeRelocatableFelt(FeltOne())) diff --git a/pkg/hints/math_cmp_hints_test.go b/pkg/hints/math_cmp_hints_test.go index c07ff947..6a0e47f2 100644 --- a/pkg/hints/math_cmp_hints_test.go +++ b/pkg/hints/math_cmp_hints_test.go @@ -4,6 +4,7 @@ import ( "testing" . "github.com/lambdaclass/cairo-vm.go/pkg/hints" + . "github.com/lambdaclass/cairo-vm.go/pkg/hints/hint_codes" . "github.com/lambdaclass/cairo-vm.go/pkg/hints/hint_utils" . "github.com/lambdaclass/cairo-vm.go/pkg/lambdaworks" . "github.com/lambdaclass/cairo-vm.go/pkg/vm"