Two branches that each promote their own diverging tail into the same root slot must not overwrite each other.
96 shared elements put the base at a 64 element tree plus a full tail; 33 pushes per branch force two promotions each, the second landing in the same fringe slot of a root that used to be shared.
170 {
173
174 int *vals =
ALLOCN(ctx,
int, 96);
176 for (int i = 0; i < 96; i++) {
177 vals[i] = i;
179 }
180
181 int *b1_vals =
ALLOCN(ctx,
int, 33);
182 int *b2_vals =
ALLOCN(ctx,
int, 33);
185 for (int i = 0; i < 33; i++) {
186 b1_vals[i] = 1000 + i;
187 b2_vals[i] = 2000 + i;
190 }
191
195
196
197 for (int i = 0; i < 96; i++) {
201 }
202
203
204 for (int i = 0; i < 33; i++) {
207 }
208
211}
#define RELEASE_CONTEXT(x)
#define SHUTDOWN_ENGINE(mm, engine)
#define MAKE_ENGINE(mm, engine)
#define MAKE_CONTEXT(engine, x)
#define ALLOCN(ctx, T, N)
seq_t seq_empty(const srn_context_t *ctx)
Create an empty seq pinned to ctx.
seq_lookup_result_t seq_get(const seq_t *seq, size_t n)
Negative index is not supported.
seq_t seq_push(const seq_t *seq, seq_elem_t x)
void * seq_elem_t
We use generic pointers to refer to internal nodes, leaf nodes and even elements.
size_t len
logical length.