247 |
|
|
248 |
|
|
249 |
|
mergeclists(cdest, cl1, n1, cl2, n2) /* merge two sorted lists */ |
250 |
< |
PACKHEAD *cdest; |
251 |
< |
PACKHEAD *cl1, *cl2; |
250 |
> |
register PACKHEAD *cdest; |
251 |
> |
register PACKHEAD *cl1, *cl2; |
252 |
|
int n1, n2; |
253 |
|
{ |
254 |
< |
int cmp; |
254 |
> |
register int cmp; |
255 |
|
|
256 |
|
while (n1 | n2) { |
257 |
|
if (!n1) cmp = 1; |
316 |
|
* list and start again from the beginning. Since |
317 |
|
* a merge sort is used, the sorting costs are minimal. |
318 |
|
*/ |
319 |
< |
next_packet(p) /* prepare packet for computation */ |
319 |
> |
next_packet(p, n) /* prepare packet for computation */ |
320 |
|
register PACKET *p; |
321 |
+ |
int n; |
322 |
|
{ |
323 |
|
register int i; |
324 |
|
|
332 |
|
p->nr = complist[listpos].nr - p->nc; |
333 |
|
if (p->nr <= 0) |
334 |
|
return(0); |
335 |
< |
if (p->nr > RPACKSIZ) |
336 |
< |
p->nr = RPACKSIZ; |
335 |
> |
#ifdef DEBUG |
336 |
> |
if (n < 1 | n > RPACKSIZ) |
337 |
> |
error(CONSISTENCY, "next_packet called with bad n value"); |
338 |
> |
#endif |
339 |
> |
if (p->nr > n) |
340 |
> |
p->nr = n; |
341 |
|
complist[listpos].nc += p->nr; /* find where this one would go */ |
342 |
|
while (lastin > listpos && |
343 |
|
beamcmp(complist+lastin, complist+listpos) > 0) |