Skip to content

Commit 8c5fed2

Browse files
committed
correct remaining to_biguint().to_bigint() pattern
1 parent 5ec5319 commit 8c5fed2

File tree

3 files changed

+7
-31
lines changed

3 files changed

+7
-31
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#### Upcoming Changes
44

5+
* Use to_signed_felt as function for felt252 as BigInt within [-P/2, P/2] range and use to_bigint as function for representation as BigInt. [#1100](https://github.com/lambdaclass/cairo-rs/pull/1100)
6+
57
* Implement hint on field_arithmetic lib [#1090](https://github.com/lambdaclass/cairo-rs/pull/1090)
68

79
`BuiltinHintProcessor` now supports the following hints:

src/hint_processor/builtin_hint_processor/math_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ pub fn signed_div_rem(
483483
#[allow(deprecated)]
484484
let int_div = div.to_signed_felt();
485485
#[allow(deprecated)]
486-
let int_bound = bound.to_bigint();
486+
let int_bound = bound.to_signed_felt();
487487
let (q, r) = int_value.div_mod_floor(&int_div);
488488

489489
if int_bound.abs() < q.abs() {

src/vm/runners/builtin_runner/ec_op.rs

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::vm::errors::runner_errors::RunnerError;
1010
use crate::vm::vm_memory::memory::Memory;
1111
use crate::vm::vm_memory::memory_segments::MemorySegmentManager;
1212
use felt::Felt252;
13-
use num_bigint::{BigInt, ToBigInt};
13+
use num_bigint::BigInt;
1414
use num_integer::{div_ceil, Integer};
1515
use num_traits::{Num, One, Pow, Zero};
1616

@@ -65,35 +65,9 @@ impl EcOpBuiltinRunner {
6565
prime: &BigInt,
6666
height: u32,
6767
) -> Result<(BigInt, BigInt), RunnerError> {
68-
let mut slope = m
69-
.clone()
70-
.to_biguint()
71-
.to_bigint()
72-
.ok_or(RunnerError::FoundNonInt)?;
73-
let mut partial_sum_b = (
74-
partial_sum
75-
.0
76-
.to_biguint()
77-
.to_bigint()
78-
.ok_or(RunnerError::FoundNonInt)?,
79-
partial_sum
80-
.1
81-
.to_biguint()
82-
.to_bigint()
83-
.ok_or(RunnerError::FoundNonInt)?,
84-
);
85-
let mut doubled_point_b = (
86-
doubled_point
87-
.0
88-
.to_biguint()
89-
.to_bigint()
90-
.ok_or(RunnerError::FoundNonInt)?,
91-
doubled_point
92-
.1
93-
.to_biguint()
94-
.to_bigint()
95-
.ok_or(RunnerError::FoundNonInt)?,
96-
);
68+
let mut slope = m.clone().to_bigint();
69+
let mut partial_sum_b = (partial_sum.0.to_bigint(), partial_sum.1.to_bigint());
70+
let mut doubled_point_b = (doubled_point.0.to_bigint(), doubled_point.1.to_bigint());
9771
for _ in 0..height {
9872
if (doubled_point_b.0.clone() - partial_sum_b.0.clone()).is_zero() {
9973
#[allow(deprecated)]

0 commit comments

Comments
 (0)