File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -223,10 +223,8 @@ impl<T> TypedArena<T> {
223223 // If the previous chunk's len is less than HUGE_PAGE
224224 // bytes, then this chunk will be least double the previous
225225 // chunk's size.
226- new_cap = last_chunk. storage . len ( ) ;
227- if new_cap < HUGE_PAGE / elem_size {
228- new_cap = new_cap. checked_mul ( 2 ) . unwrap ( ) ;
229- }
226+ new_cap = last_chunk. storage . len ( ) . min ( HUGE_PAGE / elem_size / 2 ) ;
227+ new_cap = new_cap * 2 ;
230228 } else {
231229 new_cap = PAGE / elem_size;
232230 }
@@ -343,10 +341,8 @@ impl DroplessArena {
343341 // If the previous chunk's len is less than HUGE_PAGE
344342 // bytes, then this chunk will be least double the previous
345343 // chunk's size.
346- new_cap = last_chunk. storage . len ( ) ;
347- if new_cap < HUGE_PAGE {
348- new_cap = new_cap. checked_mul ( 2 ) . unwrap ( ) ;
349- }
344+ new_cap = last_chunk. storage . len ( ) . min ( HUGE_PAGE / 2 ) ;
345+ new_cap = new_cap * 2 ;
350346 } else {
351347 new_cap = PAGE ;
352348 }
You can’t perform that action at this time.
0 commit comments