File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed
crates/primitives/src/sol Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ impl<'enc> Encoder<'enc> {
94
94
95
95
/// Segments the buffer into a head and tail, with the head taking the next `n` words.
96
96
pub fn segment ( & mut self , n_words : usize ) -> Encoder < ' _ > {
97
+ debug_assert_eq ! ( self . head_offset % 32 , 0 ) ;
97
98
let ( _, buffer) = self . head . split_at_mut ( self . head_offset ) ;
98
99
let ( head, tail) = buffer. split_at_mut ( n_words. checked_mul ( 32 ) . unwrap ( ) ) ;
99
100
Encoder {
@@ -120,6 +121,7 @@ impl<'enc> Encoder<'enc> {
120
121
let ( target, rest) = tail. split_at_mut ( len) ;
121
122
self . tail = Some ( rest) ;
122
123
self . tail_offset = self . tail_offset . checked_add ( len) . unwrap ( ) ;
124
+ debug_assert_eq ! ( self . tail_offset % 32 , 0 ) ;
123
125
Encoder :: new ( target)
124
126
}
125
127
You can’t perform that action at this time.
0 commit comments