7 * Routines to manage a dynamic random access array of int64_ts which
8 * may grow in size to be more than the largest single malloc'able
12 #define RAA_BLKSHIFT 15 /* 2**this many longs allocated at once */
13 #define RAA_BLKSIZE (1 << RAA_BLKSHIFT)
14 #define RAA_LAYERSHIFT 15 /* 2**this many _pointers_ allocated */
15 #define RAA_LAYERSIZE (1 << RAA_LAYERSHIFT)
17 typedef struct RAA RAA
;
18 typedef union RAA_UNION RAA_UNION
;
19 typedef struct RAA_LEAF RAA_LEAF
;
20 typedef struct RAA_BRANCH RAA_BRANCH
;
24 * Number of layers below this one to get to the real data. 0
25 * means this structure is a leaf, holding RAA_BLKSIZE real
26 * data items; 1 and above mean it's a branch, holding
27 * RAA_LAYERSIZE pointers to the next level branch or leaf
33 * Number of real data items spanned by one position in the
34 * `data' array at this level. This number is 0 trivially, for
35 * a leaf (level 0): for a level 1 branch it should be
36 * RAA_BLKSHIFT, and for a level 2 branch it's
37 * RAA_LAYERSHIFT+RAA_BLKSHIFT.
43 int64_t data
[RAA_BLKSIZE
];
46 struct RAA
*data
[RAA_LAYERSIZE
];
51 struct RAA
*raa_init(void);
52 void raa_free(struct RAA
*);
53 int64_t raa_read(struct RAA
*, int32_t);
54 struct RAA
*raa_write(struct RAA
*r
, int32_t posn
, int64_t value
);
56 #endif /* NASM_RAA_H */