Programming with Judy
Using Judy
Using Judy1
Chapter 3 31
if (Index1 > Index2)
{
Index2 = Index1;
Judy_rv = Judy1First(PSet2, &Index2, PJError);
}
else
{
// do the AND
Judy_rv = Judy1Set(&PnewJArray, Index1, PJError);
if (Judy_rv == JERR) return JERR;
// bump to the next bits
Judy_rv = Judy1Next(PSet1, &Index1, PJError);
Judy_rv += Judy1Next(PSet2, &Index2, PJError);
}
}
*PPDest = PnewJArray;
break;
case JUDY1OP_OR:
/* Set all the bits from PSet1 */
for (Index1 = 0L, Judy_rv = Judy1First(PSet1, &Index1, PJError);
Judy_rv == 1;
Judy_rv = Judy1Next(PSet1, &Index1, PJError))
{
if (Judy1Set(&PnewJArray, Index1, PJError) == JERR)
return JERR;
}
/* Set all the bits from PSet2 */
for (Index1 = 0L, Judy_rv = Judy1First(PSet2, &Index1, PJError);
Judy_rv == 1;