Provide 64-bit support for ORG directive
[nasm/avx512.git] / rdoff / collectn.c
blobad43d85644e8b3c66a445d1f519c446769d82fca
1 /*
2 * collectn.c - implements variable length pointer arrays [collections].
4 * This file is public domain.
5 */
7 #include "collectn.h"
8 #include <stdlib.h>
10 void collection_init(Collection * c)
12 int i;
14 for (i = 0; i < 32; i++)
15 c->p[i] = NULL;
16 c->next = NULL;
19 void **colln(Collection * c, int index)
21 while (index >= 32) {
22 index -= 32;
23 if (c->next == NULL) {
24 c->next = malloc(sizeof(Collection));
25 collection_init(c->next);
27 c = c->next;
29 return &(c->p[index]);
32 void collection_reset(Collection * c)
34 int i;
36 if (c->next) {
37 collection_reset(c->next);
38 free(c->next);
41 c->next = NULL;
42 for (i = 0; i < 32; i++)
43 c->p[i] = NULL;