~ubuntu-branches/ubuntu/precise/judy/precise

« back to all changes in this revision

Viewing changes to src/JudyL/JudyL.h

  • Committer: Bazaar Package Importer
  • Author(s): Troy Heber
  • Date: 2005-03-22 06:55:53 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050322065553-syjpkd48r4re18dn
Tags: 1.0.1-5

* Moving LGPL link in copyright back to LGPL-2.1
* Cleanup of debian/rules: removed explicit refs to 32-bit archs, removed
  unnecessary nostrip, using --man dir to install man pages, moving from
  dh_movefiles to dh_install.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef _JUDYL_INCLUDED
2
 
#define _JUDYL_INCLUDED
 
2
#define _JUDYL_INCLUDED
3
3
// _________________
4
4
//
5
5
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
22
22
// @(#) $Revision: 4.41 $ $Source: /judy/src/JudyL/JudyL.h $
23
23
 
24
24
// ****************************************************************************
25
 
//          JUDYL -- SMALL/LARGE AND/OR CLUSTERED/SPARSE ARRAYS
26
 
//
27
 
//                                    -by-
28
 
//
29
 
//                             Douglas L. Baskins
30
 
//                             doug@sourcejudy.com
 
25
//          JUDYL -- SMALL/LARGE AND/OR CLUSTERED/SPARSE ARRAYS
 
26
//
 
27
//                                    -by-
 
28
//
 
29
//                             Douglas L. Baskins
 
30
//                             doug@sourcejudy.com
31
31
//
32
32
// Judy arrays are designed to be used instead of arrays.  The performance
33
33
// suggests the reason why Judy arrays are thought of as arrays, instead of
45
45
//   except LeafL does not actually appear as such; rather, Leaf1..3 [Leaf1..7]
46
46
//   is used to represent leaf Index sizes, and LeafW refers to a Leaf with
47
47
//   full (Long) word Indexes, which is also a type of linear leaf.  Note that
48
 
//   root-level LeafW (Leaf4 [Leaf8]) leaves are called JAPLEAF.
 
48
//   root-level LeafW (Leaf4 [Leaf8]) leaves are called LEAFW.
49
49
//
50
50
// - BranchB, LeafB1 refer to bitmap branches and leaves (intermediate
51
51
//   populations).
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.
68
68
//
69
 
// - Some preprocessors can't handle single apostrophe characters within
70
 
//   #ifndef code, so here, use '' instead.
71
 
 
72
 
 
73
 
#include "JudyPrivate.h"        // includes Judy.h in turn.
74
 
#include "JudyPrivateBranch.h"  // support for branches.
75
 
 
76
 
 
77
 
// ****************************************************************************
78
 
// JUDYL ARRAY POINTER (JAP) AND JUDYL POINTER (JP) TYPE FIELDS
79
 
// ****************************************************************************
80
 
//
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.
88
 
//
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
93
 
// pointer.
94
 
//
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.
99
 
 
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.
 
71
 
 
72
 
 
73
#include "JudyPrivate.h"        // includes Judy.h in turn.
 
74
#include "JudyPrivateBranch.h"  // support for branches.
 
75
 
 
76
 
 
77
// ****************************************************************************
 
78
// JUDYL ROOT POINTER (JRP) AND JUDYL POINTER (JP) TYPE FIELDS
 
79
// ****************************************************************************
 
80
 
 
81
typedef enum            // uint8_t -- but C does not support this type of enum.
101
82
{
102
83
 
103
 
// JAP TYPE VALUES:
104
 
//
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.
108
 
 
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,
117
 
 
118
 
 
119
84
// JP NULL TYPES:
120
85
//
121
86
// There is a series of cJL_JPNULL* Types because each one pre-records a
125
90
// Note:  These Types must be in sequential order for doing relative
126
91
// calculations between them.
127
92
 
128
 
        cJL_JPNULL1 = J1LAP_NEXTTYPE,
129
 
                                // Index Size 1[1] byte  when 1 Index inserted.
130
 
        cJL_JPNULL2,            // Index Size 2[2] bytes when 1 Index inserted.
131
 
        cJL_JPNULL3,            // Index Size 3[3] bytes when 1 Index inserted.
 
93
        cJL_JPNULL1 = 1,
 
94
                                // Index Size 1[1] byte  when 1 Index inserted.
 
95
        cJL_JPNULL2,            // Index Size 2[2] bytes when 1 Index inserted.
 
96
        cJL_JPNULL3,            // Index Size 3[3] bytes when 1 Index inserted.
132
97
 
133
98
#ifndef JU_64BIT
134
 
#define cJL_JPNULLMAX cJL_JPNULL3
 
99
#define cJL_JPNULLMAX cJL_JPNULL3
135
100
#else
136
 
        cJL_JPNULL4,            // Index Size 4[4] bytes when 1 Index inserted.
137
 
        cJL_JPNULL5,            // Index Size 5[5] bytes when 1 Index inserted.
138
 
        cJL_JPNULL6,            // Index Size 6[6] bytes when 1 Index inserted.
139
 
        cJL_JPNULL7,            // Index Size 7[7] bytes when 1 Index inserted.
140
 
#define cJL_JPNULLMAX cJL_JPNULL7
 
101
        cJL_JPNULL4,            // Index Size 4[4] bytes when 1 Index inserted.
 
102
        cJL_JPNULL5,            // Index Size 5[5] bytes when 1 Index inserted.
 
103
        cJL_JPNULL6,            // Index Size 6[6] bytes when 1 Index inserted.
 
104
        cJL_JPNULL7,            // Index Size 7[7] bytes when 1 Index inserted.
 
105
#define cJL_JPNULLMAX cJL_JPNULL7
141
106
#endif
142
107
 
143
108
 
150
115
// Note:  These Types must be in sequential order for doing relative
151
116
// calculations between them.
152
117
 
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.
155
120
 
156
121
#ifdef JU_64BIT
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.
161
126
#endif
162
127
 
163
 
        cJL_JPBRANCH_L,         // note:  DcdPop0 field not used.
 
128
        cJL_JPBRANCH_L,         // note:  DcdPopO field not used.
164
129
 
165
130
// Bitmap branches:
166
131
//
167
132
// Note:  These Types must be in sequential order for doing relative
168
133
// calculations between them.
169
134
 
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.
172
137
 
173
138
#ifdef JU_64BIT
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.
178
143
#endif
179
144
 
180
 
        cJL_JPBRANCH_B,         // note:  DcdPop0 field not used.
 
145
        cJL_JPBRANCH_B,         // note:  DcdPopO field not used.
181
146
 
182
147
// Uncompressed branches:
183
148
//
184
149
// Note:  These Types must be in sequential order for doing relative
185
150
// calculations between them.
186
151
 
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.
189
154
 
190
155
#ifdef JU_64BIT
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.
195
160
#endif
196
161
 
197
 
        cJL_JPBRANCH_U,         // note:  DcdPop0 field not used.
 
162
        cJL_JPBRANCH_U,         // note:  DcdPopO field not used.
198
163
 
199
164
 
200
165
// JP LEAF TYPES:
206
171
//
207
172
// Note:  There is no full-word (4-byte [8-byte]) Index leaf under a JP because
208
173
// non-root-state leaves only occur under branches that decode at least one
209
 
// byte.  Full-word, root-state leaves are under a JAP, not a JP.  However, in
 
174
// byte.  Full-word, root-state leaves are under a JRP, not a JP.  However, in
210
175
// the code a "fake" JP can be created temporarily above a root-state leaf.
211
176
 
212
 
        cJL_JPLEAF1,            // 1[1] byte  Pop0, 2    bytes Dcd.
213
 
        cJL_JPLEAF2,            // 2[2] bytes Pop0, 1[5] bytes Dcd.
214
 
        cJL_JPLEAF3,            // 3[3] bytes Pop0, 0[4] bytes Dcd.
 
177
        cJL_JPLEAF1,            // 1[1] byte  Pop0, 2    bytes Dcd.
 
178
        cJL_JPLEAF2,            // 2[2] bytes Pop0, 1[5] bytes Dcd.
 
179
        cJL_JPLEAF3,            // 3[3] bytes Pop0, 0[4] bytes Dcd.
215
180
 
216
181
#ifdef JU_64BIT
217
 
        cJL_JPLEAF4,            //  [4] bytes Pop0,  [3] bytes Dcd.
218
 
        cJL_JPLEAF5,            //  [5] bytes Pop0,  [2] bytes Dcd.
219
 
        cJL_JPLEAF6,            //  [6] bytes Pop0,  [1] byte  Dcd.
220
 
        cJL_JPLEAF7,            //  [7] bytes Pop0,  [0] bytes Dcd.
 
182
        cJL_JPLEAF4,            //  [4] bytes Pop0,  [3] bytes Dcd.
 
183
        cJL_JPLEAF5,            //  [5] bytes Pop0,  [2] bytes Dcd.
 
184
        cJL_JPLEAF6,            //  [6] bytes Pop0,  [1] byte  Dcd.
 
185
        cJL_JPLEAF7,            //  [7] bytes Pop0,  [0] bytes Dcd.
221
186
#endif
222
187
 
223
188
// Bitmap leaf; Index Size == 1:
226
191
// bitmap would grow from 256 to 256^2, 256^3, ... bits, which would not be
227
192
// efficient..
228
193
 
229
 
        cJL_JPLEAF_B1,          // 1[1] byte Pop0, 2[6] bytes Dcd.
 
194
        cJL_JPLEAF_B1,          // 1[1] byte Pop0, 2[6] bytes Dcd.
230
195
 
231
196
// Full population; Index Size == 1 virtual leaf:
232
197
//
248
213
//
249
214
// All enums equal or above this point are cJL_JPIMMEDs.
250
215
 
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.
254
219
 
255
220
#ifdef JU_64BIT
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.
260
225
#endif
261
226
 
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.
264
229
 
265
230
#ifdef JU_64BIT
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.
270
 
 
271
 
        cJL_JPIMMED_2_02,       // Index Size = 2, Pop1 = 2.
272
 
        cJL_JPIMMED_2_03,       // Index Size = 2, Pop1 = 3.
273
 
 
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.
 
235
 
 
236
        cJL_JPIMMED_2_02,       // Index Size = 2, Pop1 = 2.
 
237
        cJL_JPIMMED_2_03,       // Index Size = 2, Pop1 = 3.
 
238
 
 
239
        cJL_JPIMMED_3_02,       // Index Size = 3, Pop1 = 2.
275
240
#endif
276
241
 
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.
280
245
 
281
 
        cJL_JPIMMED_CAP
 
246
        cJL_JPIMMED_CAP
282
247
 
283
248
} jpL_Type_t;
284
249
 
287
252
 
288
253
// Index Size (state) for leaf JP, and JP type based on Index Size (state):
289
254
 
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)
292
257
 
293
258
 
294
259
// MAXIMUM POPULATIONS OF LINEAR LEAVES:
295
260
 
296
261
#ifndef JU_64BIT // 32-bit
297
262
 
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.
301
266
 
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.
304
269
 
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))
311
276
 
312
277
#else // 64-bit
313
278
 
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.
317
282
 
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))
328
293
 
329
294
#endif // 64-bit
330
295
 
336
301
// already lists all the immediates in order by state and size, calculate these
337
302
// values from it to avoid redundancy.
338
303
 
339
 
#define cJL_IMMED1_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 1)        // 3 [7].
340
 
#define cJL_IMMED2_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 2)        // 1 [3].
341
 
#define cJL_IMMED3_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 3)        // 1 [2].
 
304
#define cJL_IMMED1_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 1)        // 3 [7].
 
305
#define cJL_IMMED2_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 2)        // 1 [3].
 
306
#define cJL_IMMED3_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 3)        // 1 [2].
342
307
 
343
308
#ifdef JU_64BIT
344
 
#define cJL_IMMED4_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 4)        //   [1].
345
 
#define cJL_IMMED5_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 5)        //   [1].
346
 
#define cJL_IMMED6_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 6)        //   [1].
347
 
#define cJL_IMMED7_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 7)        //   [1].
 
309
#define cJL_IMMED4_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 4)        //   [1].
 
310
#define cJL_IMMED5_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 5)        //   [1].
 
311
#define cJL_IMMED6_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 6)        //   [1].
 
312
#define cJL_IMMED7_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 7)        //   [1].
348
313
#endif
349
314
 
350
315
 
357
322
// series of pointers?  (See 4.27.)  Turns out this wastes a cache fill on
358
323
// systems with smaller cache lines than the assumed value cJU_WORDSPERCL.
359
324
 
360
 
#define JL_JLB_BITMAP(Pjlb, Subexp)  ((Pjlb)->jLlb_jLlbs[Subexp].jLlbs_Bitmap)
361
 
#define JL_JLB_PVALUE(Pjlb, Subexp)  ((Pjlb)->jLlb_jLlbs[Subexp].jLlbs_PValue)
 
325
#define JL_JLB_BITMAP(Pjlb, Subexp)  ((Pjlb)->jLlb_jLlbs[Subexp].jLlbs_Bitmap)
 
326
#define JL_JLB_PVALUE(Pjlb, Subexp)  ((Pjlb)->jLlb_jLlbs[Subexp].jLlbs_PValue)
362
327
 
363
 
typedef struct __JUDYL_LEAF_BITMAP_SUBEXPANSE
 
328
typedef struct J__UDYL_LEAF_BITMAP_SUBEXPANSE
364
329
{
365
 
        BITMAPL_t jLlbs_Bitmap;
366
 
        Pjv_t     jLlbs_PValue;
 
330
        BITMAPL_t jLlbs_Bitmap;
 
331
        Pjv_t     jLlbs_PValue;
367
332
 
368
333
} jLlbs_t;
369
334
 
370
 
typedef struct __JUDYL_LEAF_BITMAP
 
335
typedef struct J__UDYL_LEAF_BITMAP
371
336
{
372
 
        jLlbs_t jLlb_jLlbs[cJU_NUMSUBEXPL];
 
337
        jLlbs_t jLlb_jLlbs[cJU_NUMSUBEXPL];
373
338
 
374
339
} jLlb_t, * PjLlb_t;
375
340
 
376
341
// Words per bitmap leaf:
377
342
 
378
 
#define cJL_WORDSPERLEAFB1  (sizeof(jLlb_t) / cJU_BYTESPERWORD)
 
343
#define cJL_WORDSPERLEAFB1  (sizeof(jLlb_t) / cJU_BYTESPERWORD)
379
344
 
380
345
 
381
346
// ****************************************************************************
385
350
// ARRAY-GLOBAL INFORMATION:
386
351
//
387
352
// At the cost of an occasional additional cache fill, this object, which is
388
 
// pointed at by a JAP and in turn points to a JP_BRANCH*, carries array-global
 
353
// pointed at by a JRP and in turn points to a JP_BRANCH*, carries array-global
389
354
// information about a JudyL array that has sufficient population to amortize
390
355
// the cost.  The jpm_Pop0 field prevents having to add up the total population
391
356
// for the array in insert, delete, and count code.  The jpm_JP field prevents
392
357
// having to build a fake JP for entry to a state machine; however, the
393
 
// jp_DcdPop0 field in jpm_JP, being one byte too small, is not used.
 
358
// jp_DcdPopO field in jpm_JP, being one byte too small, is not used.
394
359
//
395
360
// Note:  Struct fields are ordered to keep "hot" data in the first 8 words
396
361
// (see left-margin comments) for machines with 8-word cache lines, and to keep
397
362
// sub-word fields together for efficient packing.
398
363
 
399
 
typedef struct _JUDYL_POPULATION_AND_MEMORY
 
364
typedef struct J_UDYL_POPULATION_AND_MEMORY
400
365
{
401
 
/* 1 */ Word_t     jpm_Pop0;            // total population-1 in array.
402
 
/* 2 */ jp_t       jpm_JP;              // JP to first branch; see above.
403
 
/* 4 */ Word_t     jpm_LastUPop0;       // last jpm_Pop0 when convert to BranchU
404
 
/* 5 */ jp_t       jpm_LastJP;          // JP pointing to last found index.
405
 
/* 7 */ Pjv_t      jpm_PValue;          // pointer to value to return.
406
 
/* 8 */ uint8_t    jpm_Offset;          // offset into leaf from last lookup.
407
 
/* 8 */ uint8_t    jpm_LastPop0;        // population in jpm_LastJP.
 
366
/* 1 */ Word_t     jpm_Pop0;            // total population-1 in array.
 
367
/* 2 */ jp_t       jpm_JP;              // JP to first branch; see above.
 
368
/* 4 */ Word_t     jpm_LastUPop0;       // last jpm_Pop0 when convert to BranchU
 
369
/* 7 */ Pjv_t      jpm_PValue;          // pointer to value to return.
408
370
// Note:  Field names match PJError_t for convenience in macros:
409
 
/* 8 */ char       je_Errno;            // one of the enums in Judy.h.
410
 
/* 8/9  */ int     je_ErrID;            // often an internal source line number.
411
 
/* 9/10 */ Word_t  jpm_TotalMemWords;   // words allocated in array.
 
371
/* 8 */ char       je_Errno;            // one of the enums in Judy.h.
 
372
/* 8/9  */ int     je_ErrID;            // often an internal source line number.
 
373
/* 9/10 */ Word_t  jpm_TotalMemWords;   // words allocated in array.
412
374
} jLpm_t, *PjLpm_t;
413
375
 
414
376
 
418
380
// object into wasted (rounded-up) memory in the chunk.  Note:  This violates
419
381
// the hiddenness of the JudyMalloc code.
420
382
 
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];
424
386
#ifdef JU_64BIT
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];
429
391
#endif
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[];
432
394
 
433
395
// These tables indicate where value areas start:
434
396
 
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];
438
400
#ifdef JU_64BIT
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];
443
405
#endif
444
 
extern const uint8_t __jL_LeafWOffset    [cJL_JAPLEAF_MAXPOP1 + 1];
 
406
extern const uint8_t j__L_LeafWOffset    [cJL_LEAFW_MAXPOP1 + 1];
445
407
 
446
408
// Also define macros to hide the details in the code using these tables.
447
409
 
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)
454
 
#ifdef JU_64BIT
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)
463
 
#endif
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)
468
 
 
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])
472
 
#ifdef JU_64BIT
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])
477
 
#endif
478
 
#define JL_LEAFWVALUEAREA(Pjv,Pop1)  (((PWord_t)(Pjv)) + __jL_LeafWOffset[Pop1])
479
 
 
480
 
#define JL_LEAF1POPTOWORDS(Pop1)        (__jL_Leaf1PopToWords[Pop1])
481
 
#define JL_LEAF2POPTOWORDS(Pop1)        (__jL_Leaf2PopToWords[Pop1])
482
 
#define JL_LEAF3POPTOWORDS(Pop1)        (__jL_Leaf3PopToWords[Pop1])
483
 
#ifdef JU_64BIT
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])
488
 
#endif
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)
 
416
#ifdef JU_64BIT
 
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)
 
425
#endif
 
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)
 
430
 
 
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])
 
434
#ifdef JU_64BIT
 
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])
 
439
#endif
 
440
#define JL_LEAFWVALUEAREA(Pjv,Pop1)  (((PWord_t)(Pjv)) + j__L_LeafWOffset[Pop1])
 
441
 
 
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])
 
445
#ifdef JU_64BIT
 
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])
 
450
#endif
 
451
#define JL_LEAFWPOPTOWORDS(Pop1)        (j__L_LeafWPopToWords[Pop1])
 
452
#define JL_LEAFVPOPTOWORDS(Pop1)        (j__L_LeafVPopToWords[Pop1])
491
453
 
492
454
 
493
455
// FUNCTIONS TO ALLOCATE OBJECTS:
494
456
 
495
 
PjLpm_t __JudyLAllocJLPM(void);                         // constant size.
496
 
 
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.
501
 
 
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.
 
458
 
 
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.
 
463
 
 
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);
505
467
 
506
468
#ifdef JU_64BIT
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);
511
473
#endif
512
474
 
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);
516
478
 
517
479
 
518
480
// FUNCTIONS TO FREE OBJECTS:
519
481
 
520
 
void    __JudyLFreeJLPM( PjLpm_t,        PjLpm_t);      // constant size.
521
 
 
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.
526
 
 
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);
530
 
 
531
 
#ifdef JU_64BIT
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);
536
 
#endif
537
 
 
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.
542
 
 
543
 
// "Odd" types:
544
 
 
545
 
int __JudySearchLeaf3(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
546
 
 
547
 
#ifdef JU_64BIT
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);
551
 
#endif
552
 
 
553
 
#ifdef JU_NOINLINE
554
 
 
555
 
int __JudySearchLeaf1(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
556
 
int __JudySearchLeaf2(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
557
 
 
558
 
#ifdef JU_64BIT
559
 
int __JudySearchLeaf4(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
560
 
#endif
561
 
int __JudySearchLeafW(Pjlw_t Pjlw, Word_t LeafPop1, Word_t Index);
562
 
 
563
 
#else  // compiler support for inline
564
 
 
565
 
#ifdef JU_FLAVOR_COV
566
 
#pragma C-Cover off     // no metrics for inlines except when requested.
567
 
#endif
568
 
 
569
 
static inline int __JudySearchLeaf1(Pjll_t Pjll, Word_t LeafPop1,
570
 
                                        Word_t Index)
571
 
{ SEARCHLEAFEVEN(uint8_t,  Pjll, LeafPop1, Index, cJL_LEAF1_MAXPOP1); }
572
 
static inline int __JudySearchLeaf2(Pjll_t Pjll, Word_t LeafPop1,
573
 
                                        Word_t Index)
574
 
{ SEARCHLEAFEVEN(uint16_t, Pjll, LeafPop1, Index, cJL_LEAF2_MAXPOP1); }
575
 
#ifdef JU_64BIT
576
 
static inline int __JudySearchLeaf4(Pjll_t Pjll, Word_t LeafPop1,
577
 
                                        Word_t Index)
578
 
{ SEARCHLEAFEVEN(uint32_t, Pjll, LeafPop1, Index, cJL_LEAF4_MAXPOP1); }
579
 
#endif
580
 
static inline int __JudySearchLeafW(Pjlw_t Pjlw, Word_t LeafPop1,
581
 
                                        Word_t Index)
582
 
{ SEARCHLEAFEVEN(Word_t,   Pjlw, LeafPop1, Index, cJL_JAPLEAF_MAXPOP1); }
583
 
 
584
 
#ifdef JU_FLAVOR_COV
585
 
#pragma C-Cover on
586
 
#endif
587
 
 
588
 
#endif // compiler support for inline
 
482
void    j__udyLFreeJLPM( PjLpm_t,        PjLpm_t);      // constant size.
 
483
 
 
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.
 
488
 
 
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);
 
492
 
 
493
#ifdef JU_64BIT
 
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);
 
498
#endif
 
499
 
 
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.
589
504
 
590
505
#endif // ! _JUDYL_INCLUDED