Skip to content

Commit

Permalink
Refactor segment_size method
Browse files Browse the repository at this point in the history
  • Loading branch information
entropidelic committed Dec 6, 2023
1 parent 17c5b1b commit 65b8e09
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions provers/cairo/src/air.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,18 @@ pub struct Segment {

impl Segment {
pub fn new(begin_addr: u64, stop_ptr: u64) -> Self {
let begin_addr = begin_addr.try_into().unwrap();
let stop_ptr = stop_ptr.try_into().unwrap();
let begin_addr: usize = begin_addr.try_into().unwrap();
let stop_ptr: usize = stop_ptr.try_into().unwrap();

stop_ptr.checked_sub(begin_addr).unwrap();

Self {
begin_addr,
stop_ptr,
}
}
pub fn segment_size(&self) -> Option<usize> {
self.stop_ptr.checked_sub(self.begin_addr - 1)
pub fn segment_size(&self) -> usize {
self.stop_ptr - self.begin_addr - 1
}
}

Expand Down

0 comments on commit 65b8e09

Please sign in to comment.