Skip to content

Commit e4120e4

Browse files
committed
chore: debug assertions
1 parent 89c35da commit e4120e4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

crates/primitives/src/sol/encoder.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ impl<'enc> Encoder<'enc> {
9494

9595
/// Segments the buffer into a head and tail, with the head taking the next `n` words.
9696
pub fn segment(&mut self, n_words: usize) -> Encoder<'_> {
97+
debug_assert_eq!(self.head_offset % 32, 0);
9798
let (_, buffer) = self.head.split_at_mut(self.head_offset);
9899
let (head, tail) = buffer.split_at_mut(n_words.checked_mul(32).unwrap());
99100
Encoder {
@@ -120,6 +121,7 @@ impl<'enc> Encoder<'enc> {
120121
let (target, rest) = tail.split_at_mut(len);
121122
self.tail = Some(rest);
122123
self.tail_offset = self.tail_offset.checked_add(len).unwrap();
124+
debug_assert_eq!(self.tail_offset % 32, 0);
123125
Encoder::new(target)
124126
}
125127

0 commit comments

Comments
 (0)