core/vec/growth.ldn
1-- Kept in its own module source so a same-module fixture can exercise the
2-- exact private arithmetic without making the growth strategy public.
3
4capacity_exhausted: atom
5
6grown: (capacity: usize) -> (next: usize) ! capacity_exhausted =
7 if capacity == 0 then
8 next = 8
9 else
10 maximum: usize = 0 -% 1
11 fail capacity_exhausted when capacity > maximum / 2
12 next = capacity * 2
13 end if
14end grown