66
66
// - The representation of many numbers as hex is a relatively safe and
67
67
// portable way to get desired bitpatterns as unsigned longs.
69
// - Some preprocessors can't handle single apostrophe characters within
70
// #ifndef code, so here, use '' instead.
73
#include "JudyPrivate.h" // includes Judy.h in turn.
74
#include "JudyPrivateBranch.h" // support for branches.
77
// ****************************************************************************
78
// JUDYL ARRAY POINTER (JAP) AND JUDYL POINTER (JP) TYPE FIELDS
79
// ****************************************************************************
81
// The following enum lists all possible JAP and JP Type fields. In an earlier
82
// version (see 4.11) there were fewer JP Type values, but then Doug realized
83
// that some information previously contained in separate Decode Size and Index
84
// Size fields was redundant and/or could be rolled into enumerated Type fields
85
// to produce much simpler code. Also, merging JAP and JP Type values into a
86
// common namespace yields simpler code that can handle root-state branches
87
// (JPs) and other-state branches equally well.
89
// A pointer (JAP) to a non-empty JudyL array is at least 8-byte [16-byte]
90
// aligned, never just 4-byte [8-byte] aligned, so the least 3 bits [4 bits]
91
// that would otherwise be all zeroes are used to encode type information.
92
// This feature can be used to determine that a pointer is NOT a JudyL array
95
// TBD: As noted below, Types must be sequential in each group; but the groups
96
// are currently listed in logical order. Consider rearranging the groups if
97
// it helps "squeeze out" unused (defaulted) cases in switch statements that do
98
// not switch on every Type, so the switch tables are smaller.
100
typedef enum // uint8_t -- but C does not support this type of enum.
69
// - Some preprocessors cant handle single apostrophe characters within
70
// #ifndef code, so here, delete all instead.
73
#include "JudyPrivate.h" // includes Judy.h in turn.
74
#include "JudyPrivateBranch.h" // support for branches.
77
// ****************************************************************************
78
// JUDYL ROOT POINTER (JRP) AND JUDYL POINTER (JP) TYPE FIELDS
79
// ****************************************************************************
81
typedef enum // uint8_t -- but C does not support this type of enum.
105
// Note: The JAP values are carefully coordinated with Judy1.h to minimize
106
// overlap and maximize the chances of detecting a Judy1 array pointer passed
107
// to a JudyL function, or vice versa.
109
cJL_JAPNULL = JLAPNULL, // = 0x0, must be == 0.
110
cJL_JAPLEAF = JLAPLEAF, // = 0x1, leafW Pop0 in word 0.
111
// cJL_JAPLEAF_POPU2 = JLAPLEAF_POPU2, // = 0x2, leafW with Pop1 == 2.
112
cJL_JAPBRANCH = JLAPBRANCH, // = 0x3, == Pjpm_t.
113
cJL_JAPINVALID = JAP_INVALID, // = 0x4, not a JAP.
114
// cJL_JAPLEAF_POPU1 = JLAPLEAF_POPU1, // = 0x5, leafW with Pop1 == 1.
115
// cJ1_JAPLEAF = 0x6,
116
// cJ1_JAPBRANCH = 0x7,
121
86
// There is a series of cJL_JPNULL* Types because each one pre-records a
150
115
// Note: These Types must be in sequential order for doing relative
151
116
// calculations between them.
153
cJL_JPBRANCH_L2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
154
cJL_JPBRANCH_L3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
118
cJL_JPBRANCH_L2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
119
cJL_JPBRANCH_L3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
157
cJL_JPBRANCH_L4, // [4] bytes Pop0, [3] bytes Dcd.
158
cJL_JPBRANCH_L5, // [5] bytes Pop0, [2] bytes Dcd.
159
cJL_JPBRANCH_L6, // [6] bytes Pop0, [1] byte Dcd.
160
cJL_JPBRANCH_L7, // [7] bytes Pop0, [0] bytes Dcd.
122
cJL_JPBRANCH_L4, // [4] bytes Pop0, [3] bytes Dcd.
123
cJL_JPBRANCH_L5, // [5] bytes Pop0, [2] bytes Dcd.
124
cJL_JPBRANCH_L6, // [6] bytes Pop0, [1] byte Dcd.
125
cJL_JPBRANCH_L7, // [7] bytes Pop0, [0] bytes Dcd.
163
cJL_JPBRANCH_L, // note: DcdPop0 field not used.
128
cJL_JPBRANCH_L, // note: DcdPopO field not used.
165
130
// Bitmap branches:
167
132
// Note: These Types must be in sequential order for doing relative
168
133
// calculations between them.
170
cJL_JPBRANCH_B2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
171
cJL_JPBRANCH_B3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
135
cJL_JPBRANCH_B2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
136
cJL_JPBRANCH_B3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
174
cJL_JPBRANCH_B4, // [4] bytes Pop0, [3] bytes Dcd.
175
cJL_JPBRANCH_B5, // [5] bytes Pop0, [2] bytes Dcd.
176
cJL_JPBRANCH_B6, // [6] bytes Pop0, [1] byte Dcd.
177
cJL_JPBRANCH_B7, // [7] bytes Pop0, [0] bytes Dcd.
139
cJL_JPBRANCH_B4, // [4] bytes Pop0, [3] bytes Dcd.
140
cJL_JPBRANCH_B5, // [5] bytes Pop0, [2] bytes Dcd.
141
cJL_JPBRANCH_B6, // [6] bytes Pop0, [1] byte Dcd.
142
cJL_JPBRANCH_B7, // [7] bytes Pop0, [0] bytes Dcd.
180
cJL_JPBRANCH_B, // note: DcdPop0 field not used.
145
cJL_JPBRANCH_B, // note: DcdPopO field not used.
182
147
// Uncompressed branches:
184
149
// Note: These Types must be in sequential order for doing relative
185
150
// calculations between them.
187
cJL_JPBRANCH_U2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
188
cJL_JPBRANCH_U3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
152
cJL_JPBRANCH_U2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
153
cJL_JPBRANCH_U3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
191
cJL_JPBRANCH_U4, // [4] bytes Pop0, [3] bytes Dcd.
192
cJL_JPBRANCH_U5, // [5] bytes Pop0, [2] bytes Dcd.
193
cJL_JPBRANCH_U6, // [6] bytes Pop0, [1] byte Dcd.
194
cJL_JPBRANCH_U7, // [7] bytes Pop0, [0] bytes Dcd.
156
cJL_JPBRANCH_U4, // [4] bytes Pop0, [3] bytes Dcd.
157
cJL_JPBRANCH_U5, // [5] bytes Pop0, [2] bytes Dcd.
158
cJL_JPBRANCH_U6, // [6] bytes Pop0, [1] byte Dcd.
159
cJL_JPBRANCH_U7, // [7] bytes Pop0, [0] bytes Dcd.
197
cJL_JPBRANCH_U, // note: DcdPop0 field not used.
162
cJL_JPBRANCH_U, // note: DcdPopO field not used.
200
165
// JP LEAF TYPES:
249
214
// All enums equal or above this point are cJL_JPIMMEDs.
251
cJL_JPIMMED_1_01, // Index Size = 1, Pop1 = 1.
252
cJL_JPIMMED_2_01, // Index Size = 2, Pop1 = 1.
253
cJL_JPIMMED_3_01, // Index Size = 3, Pop1 = 1.
216
cJL_JPIMMED_1_01, // Index Size = 1, Pop1 = 1.
217
cJL_JPIMMED_2_01, // Index Size = 2, Pop1 = 1.
218
cJL_JPIMMED_3_01, // Index Size = 3, Pop1 = 1.
256
cJL_JPIMMED_4_01, // Index Size = 4, Pop1 = 1.
257
cJL_JPIMMED_5_01, // Index Size = 5, Pop1 = 1.
258
cJL_JPIMMED_6_01, // Index Size = 6, Pop1 = 1.
259
cJL_JPIMMED_7_01, // Index Size = 7, Pop1 = 1.
221
cJL_JPIMMED_4_01, // Index Size = 4, Pop1 = 1.
222
cJL_JPIMMED_5_01, // Index Size = 5, Pop1 = 1.
223
cJL_JPIMMED_6_01, // Index Size = 6, Pop1 = 1.
224
cJL_JPIMMED_7_01, // Index Size = 7, Pop1 = 1.
262
cJL_JPIMMED_1_02, // Index Size = 1, Pop1 = 2.
263
cJL_JPIMMED_1_03, // Index Size = 1, Pop1 = 3.
227
cJL_JPIMMED_1_02, // Index Size = 1, Pop1 = 2.
228
cJL_JPIMMED_1_03, // Index Size = 1, Pop1 = 3.
266
cJL_JPIMMED_1_04, // Index Size = 1, Pop1 = 4.
267
cJL_JPIMMED_1_05, // Index Size = 1, Pop1 = 5.
268
cJL_JPIMMED_1_06, // Index Size = 1, Pop1 = 6.
269
cJL_JPIMMED_1_07, // Index Size = 1, Pop1 = 7.
271
cJL_JPIMMED_2_02, // Index Size = 2, Pop1 = 2.
272
cJL_JPIMMED_2_03, // Index Size = 2, Pop1 = 3.
274
cJL_JPIMMED_3_02, // Index Size = 3, Pop1 = 2.
231
cJL_JPIMMED_1_04, // Index Size = 1, Pop1 = 4.
232
cJL_JPIMMED_1_05, // Index Size = 1, Pop1 = 5.
233
cJL_JPIMMED_1_06, // Index Size = 1, Pop1 = 6.
234
cJL_JPIMMED_1_07, // Index Size = 1, Pop1 = 7.
236
cJL_JPIMMED_2_02, // Index Size = 2, Pop1 = 2.
237
cJL_JPIMMED_2_03, // Index Size = 2, Pop1 = 3.
239
cJL_JPIMMED_3_02, // Index Size = 3, Pop1 = 2.
277
242
// This special Type is merely a sentinel for doing relative calculations.
278
243
// This value should not be used in switch statements (to avoid allocating code
279
244
// for it), which is also why it appears at the end of the enum list.
288
253
// Index Size (state) for leaf JP, and JP type based on Index Size (state):
290
#define JL_LEAFINDEXSIZE(jpType) ((jpType) - cJL_JPLEAF1 + 1)
291
#define JL_LEAFTYPE(IndexSize) ((IndexSize) + cJL_JPLEAF1 - 1)
255
#define JL_LEAFINDEXSIZE(jpType) ((jpType) - cJL_JPLEAF1 + 1)
256
#define JL_LEAFTYPE(IndexSize) ((IndexSize) + cJL_JPLEAF1 - 1)
294
259
// MAXIMUM POPULATIONS OF LINEAR LEAVES:
296
261
#ifndef JU_64BIT // 32-bit
298
#define _JL_MAXB (sizeof(Word_t) * 64)
299
#define ALLOCSIZES { 3, 5, 7, 11, 15, 23, 32, 47, 64, TERMINATOR } // in words.
300
#define cJL_LEAF1_MAXWORDS (32) // max Leaf1 size in words.
263
#define J_L_MAXB (sizeof(Word_t) * 64)
264
#define ALLOCSIZES { 3, 5, 7, 11, 15, 23, 32, 47, 64, TERMINATOR } // in words.
265
#define cJL_LEAF1_MAXWORDS (32) // max Leaf1 size in words.
302
267
// Note: cJL_LEAF1_MAXPOP1 is chosen such that the index portion is less than
303
268
// 32 bytes -- the number of bytes the index takes in a bitmap leaf.
305
#define cJL_LEAF1_MAXPOP1 \
270
#define cJL_LEAF1_MAXPOP1 \
306
271
((cJL_LEAF1_MAXWORDS * cJU_BYTESPERWORD)/(1 + cJU_BYTESPERWORD))
307
#define cJL_LEAF2_MAXPOP1 (_JL_MAXB / (2 + cJU_BYTESPERWORD))
308
#define cJL_LEAF3_MAXPOP1 (_JL_MAXB / (3 + cJU_BYTESPERWORD))
309
#define cJL_JAPLEAF_MAXPOP1 \
310
((_JL_MAXB - cJU_BYTESPERWORD) / (2 * cJU_BYTESPERWORD))
272
#define cJL_LEAF2_MAXPOP1 (J_L_MAXB / (2 + cJU_BYTESPERWORD))
273
#define cJL_LEAF3_MAXPOP1 (J_L_MAXB / (3 + cJU_BYTESPERWORD))
274
#define cJL_LEAFW_MAXPOP1 \
275
((J_L_MAXB - cJU_BYTESPERWORD) / (2 * cJU_BYTESPERWORD))
314
#define _JL_MAXB (sizeof(Word_t) * 64)
315
#define ALLOCSIZES { 3, 5, 7, 11, 15, 23, 32, 47, 64, TERMINATOR } // in words.
316
#define cJL_LEAF1_MAXWORDS (15) // max Leaf1 size in words.
279
#define J_L_MAXB (sizeof(Word_t) * 64)
280
#define ALLOCSIZES { 3, 5, 7, 11, 15, 23, 32, 47, 64, TERMINATOR } // in words.
281
#define cJL_LEAF1_MAXWORDS (15) // max Leaf1 size in words.
318
#define cJL_LEAF1_MAXPOP1 \
283
#define cJL_LEAF1_MAXPOP1 \
319
284
((cJL_LEAF1_MAXWORDS * cJU_BYTESPERWORD)/(1 + cJU_BYTESPERWORD))
320
#define cJL_LEAF2_MAXPOP1 (_JL_MAXB / (2 + cJU_BYTESPERWORD))
321
#define cJL_LEAF3_MAXPOP1 (_JL_MAXB / (3 + cJU_BYTESPERWORD))
322
#define cJL_LEAF4_MAXPOP1 (_JL_MAXB / (4 + cJU_BYTESPERWORD))
323
#define cJL_LEAF5_MAXPOP1 (_JL_MAXB / (5 + cJU_BYTESPERWORD))
324
#define cJL_LEAF6_MAXPOP1 (_JL_MAXB / (6 + cJU_BYTESPERWORD))
325
#define cJL_LEAF7_MAXPOP1 (_JL_MAXB / (7 + cJU_BYTESPERWORD))
326
#define cJL_JAPLEAF_MAXPOP1 \
327
((_JL_MAXB - cJU_BYTESPERWORD) / (2 * cJU_BYTESPERWORD))
285
#define cJL_LEAF2_MAXPOP1 (J_L_MAXB / (2 + cJU_BYTESPERWORD))
286
#define cJL_LEAF3_MAXPOP1 (J_L_MAXB / (3 + cJU_BYTESPERWORD))
287
#define cJL_LEAF4_MAXPOP1 (J_L_MAXB / (4 + cJU_BYTESPERWORD))
288
#define cJL_LEAF5_MAXPOP1 (J_L_MAXB / (5 + cJU_BYTESPERWORD))
289
#define cJL_LEAF6_MAXPOP1 (J_L_MAXB / (6 + cJU_BYTESPERWORD))
290
#define cJL_LEAF7_MAXPOP1 (J_L_MAXB / (7 + cJU_BYTESPERWORD))
291
#define cJL_LEAFW_MAXPOP1 \
292
((J_L_MAXB - cJU_BYTESPERWORD) / (2 * cJU_BYTESPERWORD))
418
380
// object into wasted (rounded-up) memory in the chunk. Note: This violates
419
381
// the hiddenness of the JudyMalloc code.
421
extern const uint8_t __jL_Leaf1PopToWords[cJL_LEAF1_MAXPOP1 + 1];
422
extern const uint8_t __jL_Leaf2PopToWords[cJL_LEAF2_MAXPOP1 + 1];
423
extern const uint8_t __jL_Leaf3PopToWords[cJL_LEAF3_MAXPOP1 + 1];
383
extern const uint8_t j__L_Leaf1PopToWords[cJL_LEAF1_MAXPOP1 + 1];
384
extern const uint8_t j__L_Leaf2PopToWords[cJL_LEAF2_MAXPOP1 + 1];
385
extern const uint8_t j__L_Leaf3PopToWords[cJL_LEAF3_MAXPOP1 + 1];
425
extern const uint8_t __jL_Leaf4PopToWords[cJL_LEAF4_MAXPOP1 + 1];
426
extern const uint8_t __jL_Leaf5PopToWords[cJL_LEAF5_MAXPOP1 + 1];
427
extern const uint8_t __jL_Leaf6PopToWords[cJL_LEAF6_MAXPOP1 + 1];
428
extern const uint8_t __jL_Leaf7PopToWords[cJL_LEAF7_MAXPOP1 + 1];
387
extern const uint8_t j__L_Leaf4PopToWords[cJL_LEAF4_MAXPOP1 + 1];
388
extern const uint8_t j__L_Leaf5PopToWords[cJL_LEAF5_MAXPOP1 + 1];
389
extern const uint8_t j__L_Leaf6PopToWords[cJL_LEAF6_MAXPOP1 + 1];
390
extern const uint8_t j__L_Leaf7PopToWords[cJL_LEAF7_MAXPOP1 + 1];
430
extern const uint8_t __jL_LeafWPopToWords[cJL_JAPLEAF_MAXPOP1 + 1];
431
extern const uint8_t __jL_LeafVPopToWords[];
392
extern const uint8_t j__L_LeafWPopToWords[cJL_LEAFW_MAXPOP1 + 1];
393
extern const uint8_t j__L_LeafVPopToWords[];
433
395
// These tables indicate where value areas start:
435
extern const uint8_t __jL_Leaf1Offset [cJL_LEAF1_MAXPOP1 + 1];
436
extern const uint8_t __jL_Leaf2Offset [cJL_LEAF2_MAXPOP1 + 1];
437
extern const uint8_t __jL_Leaf3Offset [cJL_LEAF3_MAXPOP1 + 1];
397
extern const uint8_t j__L_Leaf1Offset [cJL_LEAF1_MAXPOP1 + 1];
398
extern const uint8_t j__L_Leaf2Offset [cJL_LEAF2_MAXPOP1 + 1];
399
extern const uint8_t j__L_Leaf3Offset [cJL_LEAF3_MAXPOP1 + 1];
439
extern const uint8_t __jL_Leaf4Offset [cJL_LEAF4_MAXPOP1 + 1];
440
extern const uint8_t __jL_Leaf5Offset [cJL_LEAF5_MAXPOP1 + 1];
441
extern const uint8_t __jL_Leaf6Offset [cJL_LEAF6_MAXPOP1 + 1];
442
extern const uint8_t __jL_Leaf7Offset [cJL_LEAF7_MAXPOP1 + 1];
401
extern const uint8_t j__L_Leaf4Offset [cJL_LEAF4_MAXPOP1 + 1];
402
extern const uint8_t j__L_Leaf5Offset [cJL_LEAF5_MAXPOP1 + 1];
403
extern const uint8_t j__L_Leaf6Offset [cJL_LEAF6_MAXPOP1 + 1];
404
extern const uint8_t j__L_Leaf7Offset [cJL_LEAF7_MAXPOP1 + 1];
444
extern const uint8_t __jL_LeafWOffset [cJL_JAPLEAF_MAXPOP1 + 1];
406
extern const uint8_t j__L_LeafWOffset [cJL_LEAFW_MAXPOP1 + 1];
446
408
// Also define macros to hide the details in the code using these tables.
448
#define JL_LEAF1GROWINPLACE(Pop1) \
449
__JU_GROWCK(Pop1, cJL_LEAF1_MAXPOP1, __jL_Leaf1PopToWords)
450
#define JL_LEAF2GROWINPLACE(Pop1) \
451
__JU_GROWCK(Pop1, cJL_LEAF2_MAXPOP1, __jL_Leaf2PopToWords)
452
#define JL_LEAF3GROWINPLACE(Pop1) \
453
__JU_GROWCK(Pop1, cJL_LEAF3_MAXPOP1, __jL_Leaf3PopToWords)
455
#define JL_LEAF4GROWINPLACE(Pop1) \
456
__JU_GROWCK(Pop1, cJL_LEAF4_MAXPOP1, __jL_Leaf4PopToWords)
457
#define JL_LEAF5GROWINPLACE(Pop1) \
458
__JU_GROWCK(Pop1, cJL_LEAF5_MAXPOP1, __jL_Leaf5PopToWords)
459
#define JL_LEAF6GROWINPLACE(Pop1) \
460
__JU_GROWCK(Pop1, cJL_LEAF6_MAXPOP1, __jL_Leaf6PopToWords)
461
#define JL_LEAF7GROWINPLACE(Pop1) \
462
__JU_GROWCK(Pop1, cJL_LEAF7_MAXPOP1, __jL_Leaf7PopToWords)
464
#define JL_LEAFWGROWINPLACE(Pop1) \
465
__JU_GROWCK(Pop1, cJL_JAPLEAF_MAXPOP1, __jL_LeafWPopToWords)
466
#define JL_LEAFVGROWINPLACE(Pop1) \
467
__JU_GROWCK(Pop1, cJU_BITSPERSUBEXPL, __jL_LeafVPopToWords)
469
#define JL_LEAF1VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + __jL_Leaf1Offset[Pop1])
470
#define JL_LEAF2VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + __jL_Leaf2Offset[Pop1])
471
#define JL_LEAF3VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + __jL_Leaf3Offset[Pop1])
473
#define JL_LEAF4VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + __jL_Leaf4Offset[Pop1])
474
#define JL_LEAF5VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + __jL_Leaf5Offset[Pop1])
475
#define JL_LEAF6VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + __jL_Leaf6Offset[Pop1])
476
#define JL_LEAF7VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + __jL_Leaf7Offset[Pop1])
478
#define JL_LEAFWVALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + __jL_LeafWOffset[Pop1])
480
#define JL_LEAF1POPTOWORDS(Pop1) (__jL_Leaf1PopToWords[Pop1])
481
#define JL_LEAF2POPTOWORDS(Pop1) (__jL_Leaf2PopToWords[Pop1])
482
#define JL_LEAF3POPTOWORDS(Pop1) (__jL_Leaf3PopToWords[Pop1])
484
#define JL_LEAF4POPTOWORDS(Pop1) (__jL_Leaf4PopToWords[Pop1])
485
#define JL_LEAF5POPTOWORDS(Pop1) (__jL_Leaf5PopToWords[Pop1])
486
#define JL_LEAF6POPTOWORDS(Pop1) (__jL_Leaf6PopToWords[Pop1])
487
#define JL_LEAF7POPTOWORDS(Pop1) (__jL_Leaf7PopToWords[Pop1])
489
#define JL_LEAFWPOPTOWORDS(Pop1) (__jL_LeafWPopToWords[Pop1])
490
#define JL_LEAFVPOPTOWORDS(Pop1) (__jL_LeafVPopToWords[Pop1])
410
#define JL_LEAF1GROWINPLACE(Pop1) \
411
J__U_GROWCK(Pop1, cJL_LEAF1_MAXPOP1, j__L_Leaf1PopToWords)
412
#define JL_LEAF2GROWINPLACE(Pop1) \
413
J__U_GROWCK(Pop1, cJL_LEAF2_MAXPOP1, j__L_Leaf2PopToWords)
414
#define JL_LEAF3GROWINPLACE(Pop1) \
415
J__U_GROWCK(Pop1, cJL_LEAF3_MAXPOP1, j__L_Leaf3PopToWords)
417
#define JL_LEAF4GROWINPLACE(Pop1) \
418
J__U_GROWCK(Pop1, cJL_LEAF4_MAXPOP1, j__L_Leaf4PopToWords)
419
#define JL_LEAF5GROWINPLACE(Pop1) \
420
J__U_GROWCK(Pop1, cJL_LEAF5_MAXPOP1, j__L_Leaf5PopToWords)
421
#define JL_LEAF6GROWINPLACE(Pop1) \
422
J__U_GROWCK(Pop1, cJL_LEAF6_MAXPOP1, j__L_Leaf6PopToWords)
423
#define JL_LEAF7GROWINPLACE(Pop1) \
424
J__U_GROWCK(Pop1, cJL_LEAF7_MAXPOP1, j__L_Leaf7PopToWords)
426
#define JL_LEAFWGROWINPLACE(Pop1) \
427
J__U_GROWCK(Pop1, cJL_LEAFW_MAXPOP1, j__L_LeafWPopToWords)
428
#define JL_LEAFVGROWINPLACE(Pop1) \
429
J__U_GROWCK(Pop1, cJU_BITSPERSUBEXPL, j__L_LeafVPopToWords)
431
#define JL_LEAF1VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf1Offset[Pop1])
432
#define JL_LEAF2VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf2Offset[Pop1])
433
#define JL_LEAF3VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf3Offset[Pop1])
435
#define JL_LEAF4VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf4Offset[Pop1])
436
#define JL_LEAF5VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf5Offset[Pop1])
437
#define JL_LEAF6VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf6Offset[Pop1])
438
#define JL_LEAF7VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf7Offset[Pop1])
440
#define JL_LEAFWVALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_LeafWOffset[Pop1])
442
#define JL_LEAF1POPTOWORDS(Pop1) (j__L_Leaf1PopToWords[Pop1])
443
#define JL_LEAF2POPTOWORDS(Pop1) (j__L_Leaf2PopToWords[Pop1])
444
#define JL_LEAF3POPTOWORDS(Pop1) (j__L_Leaf3PopToWords[Pop1])
446
#define JL_LEAF4POPTOWORDS(Pop1) (j__L_Leaf4PopToWords[Pop1])
447
#define JL_LEAF5POPTOWORDS(Pop1) (j__L_Leaf5PopToWords[Pop1])
448
#define JL_LEAF6POPTOWORDS(Pop1) (j__L_Leaf6PopToWords[Pop1])
449
#define JL_LEAF7POPTOWORDS(Pop1) (j__L_Leaf7PopToWords[Pop1])
451
#define JL_LEAFWPOPTOWORDS(Pop1) (j__L_LeafWPopToWords[Pop1])
452
#define JL_LEAFVPOPTOWORDS(Pop1) (j__L_LeafVPopToWords[Pop1])
493
455
// FUNCTIONS TO ALLOCATE OBJECTS:
495
PjLpm_t __JudyLAllocJLPM(void); // constant size.
497
Pjbl_t __JudyLAllocJBL( PjLpm_t); // constant size.
498
Pjbb_t __JudyLAllocJBB( PjLpm_t); // constant size.
499
Pjp_t __JudyLAllocJBBJP(Word_t, PjLpm_t);
500
Pjbu_t __JudyLAllocJBU( PjLpm_t); // constant size.
502
Pjll_t __JudyLAllocJLL1( Word_t, PjLpm_t);
503
Pjll_t __JudyLAllocJLL2( Word_t, PjLpm_t);
504
Pjll_t __JudyLAllocJLL3( Word_t, PjLpm_t);
457
PjLpm_t j__udyLAllocJLPM(void); // constant size.
459
Pjbl_t j__udyLAllocJBL( PjLpm_t); // constant size.
460
Pjbb_t j__udyLAllocJBB( PjLpm_t); // constant size.
461
Pjp_t j__udyLAllocJBBJP(Word_t, PjLpm_t);
462
Pjbu_t j__udyLAllocJBU( PjLpm_t); // constant size.
464
Pjll_t j__udyLAllocJLL1( Word_t, PjLpm_t);
465
Pjll_t j__udyLAllocJLL2( Word_t, PjLpm_t);
466
Pjll_t j__udyLAllocJLL3( Word_t, PjLpm_t);
507
Pjll_t __JudyLAllocJLL4( Word_t, PjLpm_t);
508
Pjll_t __JudyLAllocJLL5( Word_t, PjLpm_t);
509
Pjll_t __JudyLAllocJLL6( Word_t, PjLpm_t);
510
Pjll_t __JudyLAllocJLL7( Word_t, PjLpm_t);
469
Pjll_t j__udyLAllocJLL4( Word_t, PjLpm_t);
470
Pjll_t j__udyLAllocJLL5( Word_t, PjLpm_t);
471
Pjll_t j__udyLAllocJLL6( Word_t, PjLpm_t);
472
Pjll_t j__udyLAllocJLL7( Word_t, PjLpm_t);
513
Pjlw_t __JudyLAllocJLW( Word_t ); // no PjLpm_t needed.
514
PjLlb_t __JudyLAllocJLB1( PjLpm_t); // constant size.
515
Pjv_t __JudyLAllocJV( Word_t, PjLpm_t);
475
Pjlw_t j__udyLAllocJLW( Word_t ); // no PjLpm_t needed.
476
PjLlb_t j__udyLAllocJLB1( PjLpm_t); // constant size.
477
Pjv_t j__udyLAllocJV( Word_t, PjLpm_t);
518
480
// FUNCTIONS TO FREE OBJECTS:
520
void __JudyLFreeJLPM( PjLpm_t, PjLpm_t); // constant size.
522
void __JudyLFreeJBL( Pjbl_t, PjLpm_t); // constant size.
523
void __JudyLFreeJBB( Pjbb_t, PjLpm_t); // constant size.
524
void __JudyLFreeJBBJP(Pjp_t, Word_t, PjLpm_t);
525
void __JudyLFreeJBU( Pjbu_t, PjLpm_t); // constant size.
527
void __JudyLFreeJLL1( Pjll_t, Word_t, PjLpm_t);
528
void __JudyLFreeJLL2( Pjll_t, Word_t, PjLpm_t);
529
void __JudyLFreeJLL3( Pjll_t, Word_t, PjLpm_t);
532
void __JudyLFreeJLL4( Pjll_t, Word_t, PjLpm_t);
533
void __JudyLFreeJLL5( Pjll_t, Word_t, PjLpm_t);
534
void __JudyLFreeJLL6( Pjll_t, Word_t, PjLpm_t);
535
void __JudyLFreeJLL7( Pjll_t, Word_t, PjLpm_t);
538
void __JudyLFreeJLW( Pjlw_t, Word_t, PjLpm_t);
539
void __JudyLFreeJLB1( PjLlb_t, PjLpm_t); // constant size.
540
void __JudyLFreeJV( Pjv_t, Word_t, PjLpm_t);
541
void __JudyLFreeSM( Pjp_t, PjLpm_t); // everything below Pjp.
545
int __JudySearchLeaf3(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
548
int __JudySearchLeaf5(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
549
int __JudySearchLeaf6(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
550
int __JudySearchLeaf7(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
555
int __JudySearchLeaf1(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
556
int __JudySearchLeaf2(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
559
int __JudySearchLeaf4(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
561
int __JudySearchLeafW(Pjlw_t Pjlw, Word_t LeafPop1, Word_t Index);
563
#else // compiler support for inline
566
#pragma C-Cover off // no metrics for inlines except when requested.
569
static inline int __JudySearchLeaf1(Pjll_t Pjll, Word_t LeafPop1,
571
{ SEARCHLEAFEVEN(uint8_t, Pjll, LeafPop1, Index, cJL_LEAF1_MAXPOP1); }
572
static inline int __JudySearchLeaf2(Pjll_t Pjll, Word_t LeafPop1,
574
{ SEARCHLEAFEVEN(uint16_t, Pjll, LeafPop1, Index, cJL_LEAF2_MAXPOP1); }
576
static inline int __JudySearchLeaf4(Pjll_t Pjll, Word_t LeafPop1,
578
{ SEARCHLEAFEVEN(uint32_t, Pjll, LeafPop1, Index, cJL_LEAF4_MAXPOP1); }
580
static inline int __JudySearchLeafW(Pjlw_t Pjlw, Word_t LeafPop1,
582
{ SEARCHLEAFEVEN(Word_t, Pjlw, LeafPop1, Index, cJL_JAPLEAF_MAXPOP1); }
588
#endif // compiler support for inline
482
void j__udyLFreeJLPM( PjLpm_t, PjLpm_t); // constant size.
484
void j__udyLFreeJBL( Pjbl_t, PjLpm_t); // constant size.
485
void j__udyLFreeJBB( Pjbb_t, PjLpm_t); // constant size.
486
void j__udyLFreeJBBJP(Pjp_t, Word_t, PjLpm_t);
487
void j__udyLFreeJBU( Pjbu_t, PjLpm_t); // constant size.
489
void j__udyLFreeJLL1( Pjll_t, Word_t, PjLpm_t);
490
void j__udyLFreeJLL2( Pjll_t, Word_t, PjLpm_t);
491
void j__udyLFreeJLL3( Pjll_t, Word_t, PjLpm_t);
494
void j__udyLFreeJLL4( Pjll_t, Word_t, PjLpm_t);
495
void j__udyLFreeJLL5( Pjll_t, Word_t, PjLpm_t);
496
void j__udyLFreeJLL6( Pjll_t, Word_t, PjLpm_t);
497
void j__udyLFreeJLL7( Pjll_t, Word_t, PjLpm_t);
500
void j__udyLFreeJLW( Pjlw_t, Word_t, PjLpm_t);
501
void j__udyLFreeJLB1( PjLlb_t, PjLpm_t); // constant size.
502
void j__udyLFreeJV( Pjv_t, Word_t, PjLpm_t);
503
void j__udyLFreeSM( Pjp_t, PjLpm_t); // everything below Pjp.
590
505
#endif // ! _JUDYL_INCLUDED