Skip to content

Commit

Permalink
updating for 1.0.4 release
Browse files Browse the repository at this point in the history
git-svn-id: https://judy.svn.sourceforge.net/svnroot/judy/trunk@49 6390f24f-2af0-0310-aa40-fab754e6522e
  • Loading branch information
troyhebe committed May 14, 2007
1 parent 015e509 commit 76115e2
Show file tree
Hide file tree
Showing 6 changed files with 787 additions and 521 deletions.
4 changes: 3 additions & 1 deletion ChangeLog
@@ -1,5 +1,7 @@
1.0.4 Version (Unreleased) by (twh)
1.0.4 Version (May 2007) by (twh)
o fixed the Checkit problem "error Judy1PrevEmpty Rcode != 1 = 0"
o Fixed memory allignment in JudyMallocIF.c (doug)
o Fixed messages from "make check" (doug).

1.0.3 Version (Feb 2006 ) by (twh)
o fixed make files to break out each copy element
Expand Down
134 changes: 7 additions & 127 deletions src/Judy.h
Expand Up @@ -220,7 +220,6 @@ typedef struct J_UDY_ERROR_STRUCT
// ****************************************************************************
// JUDY1 FUNCTIONS:

extern int j__udy1Test( Pvoid_t Pjpm, Word_t Index);
extern int Judy1Test( Pcvoid_t PArray, Word_t Index, P_JE);
extern int Judy1Set( PPvoid_t PPArray, Word_t Index, P_JE);
extern int Judy1SetArray( PPvoid_t PPArray, Word_t Count,
Expand All @@ -236,15 +235,13 @@ extern Word_t Judy1MemUsed( Pcvoid_t PArray);
extern Word_t Judy1MemActive( Pcvoid_t PArray);
extern int Judy1First( Pcvoid_t PArray, Word_t * PIndex, P_JE);
extern int Judy1Next( Pcvoid_t PArray, Word_t * PIndex, P_JE);
extern int j__udy1Next( Pvoid_t Pjpm, Word_t * PIndex);
extern int Judy1Last( Pcvoid_t PArray, Word_t * PIndex, P_JE);
extern int Judy1Prev( Pcvoid_t PArray, Word_t * PIndex, P_JE);
extern int Judy1FirstEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE);
extern int Judy1NextEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE);
extern int Judy1LastEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE);
extern int Judy1PrevEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE);

extern PPvoid_t j__udyLGet( Pvoid_t Pjpm, Word_t Index);
extern PPvoid_t JudyLGet( Pcvoid_t PArray, Word_t Index, P_JE);
extern PPvoid_t JudyLIns( PPvoid_t PPArray, Word_t Index, P_JE);
extern int JudyLInsArray( PPvoid_t PPArray, Word_t Count,
Expand All @@ -264,7 +261,6 @@ extern Word_t JudyLMemUsed( Pcvoid_t PArray);
extern Word_t JudyLMemActive( Pcvoid_t PArray);
extern PPvoid_t JudyLFirst( Pcvoid_t PArray, Word_t * PIndex, P_JE);
extern PPvoid_t JudyLNext( Pcvoid_t PArray, Word_t * PIndex, P_JE);
extern PPvoid_t j__udyLNext( Pvoid_t Pjpm, Word_t * PIndex);
extern PPvoid_t JudyLLast( Pcvoid_t PArray, Word_t * PIndex, P_JE);
extern PPvoid_t JudyLPrev( Pcvoid_t PArray, Word_t * PIndex, P_JE);
extern int JudyLFirstEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE);
Expand Down Expand Up @@ -520,69 +516,9 @@ extern void JudyFreeVirtual(Pvoid_t, Word_t); // free, size in words.
// with root-level leaves:

// This is a slower version with current processors, but in the future...
#ifdef notdef
#define J1T(Rc,PArray,Index) \
{ \
PWord_t P_L = (PWord_t)(PArray); \
(Rc) = 0; \
if (P_L) /* cannot be a NULL pointer */ \
{ \
if (P_L[0] < 31) /* is a LeafL */ \
{ \
Word_t _pop1 = P_L[0] + 1; \
PWord_t P_LE = P_L + _pop1; \
Word_t _index = 0; \
int ii = 0; \
P_L++; \
while (_pop1 > 4) \
{ \
_pop1 /=2; \
_index = P_L[_pop1]; \
if ((Index) > _index) P_L += _pop1 + 1; \
} \
while (P_L <= P_LE) \
{ \
ii++; \
_index = P_L[0]; \
if (_index >= (Index)) break; \
P_L++; \
} \
if (_index == (Index)) (Rc) = 1; \
} \
else \
{ \
(Rc) = j__udy1Test((Pvoid_t)P_L, (Index)); \
} \
} \
}
#endif // notdef

#define J1T(Rc,PArray,Index) \
{ \
PWord_t P_L = (PWord_t)(PArray); \
(Rc) = 0; \
if (P_L) /* cannot be a NULL pointer */ \
{ \
if (P_L[0] < 31) /* is a LeafL */ \
{ \
Word_t _pop1 = P_L[0] + 1; \
Word_t _EIndex = P_L[_pop1]; \
if (_pop1 >= 16) \
{ \
if ((Index) > P_L[_pop1/2]) P_L += _pop1/2; \
} \
if ((Index) <= _EIndex) \
{ \
while((Index) > *(++P_L)); \
if (*P_L == (Index)) (Rc) = 1; \
} \
} \
else \
{ \
(Rc) = j__udy1Test((Pvoid_t)P_L, Index); \
} \
} \
}

#define J1T(Rc,PArray,Index) \
(Rc) = Judy1Test((Pvoid_t)(PArray), Index, PJE0)

#define J1S( Rc, PArray, Index) \
J_1I(Rc, (&(PArray)), Index, Judy1Set, "Judy1Set")
Expand Down Expand Up @@ -615,34 +551,8 @@ extern void JudyFreeVirtual(Pvoid_t, Word_t); // free, size in words.
#define J1MU(Rc, PArray) \
(Rc) = Judy1MemUsed(PArray)

#define JLG(PV,PArray,Index) \
{ \
extern const uint8_t j__L_LeafWOffset[]; \
PWord_t P_L = (PWord_t)(PArray); \
(PV) = (Pvoid_t) NULL; \
if (P_L) /* cannot be a NULL pointer */ \
{ \
if (P_L[0] < 31) /* is a LeafL */ \
{ \
Word_t _pop1 = P_L[0] + 1; \
Word_t _EIndex = P_L[_pop1]; \
Word_t _off = j__L_LeafWOffset[_pop1] - 1; \
if (_pop1 >= 16) \
{ \
if ((Index) > P_L[_pop1/2]) P_L += _pop1/2; \
} \
if ((Index) <= _EIndex) \
{ \
while((Index) > *(++P_L)); \
if (*P_L == (Index)) (PV) = (Pvoid_t)(P_L+_off);\
} \
} \
else \
{ \
(PV) = (Pvoid_t)j__udyLGet((Pvoid_t)P_L, Index); \
} \
} \
}
#define JLG(PV,PArray,Index) \
(PV) = (Pvoid_t)JudyLGet((Pvoid_t)PArray, Index, PJE0)

#define JLI( PV, PArray, Index) \
J_1P(PV, (&(PArray)), Index, JudyLIns, "JudyLIns")
Expand All @@ -656,38 +566,8 @@ extern void JudyFreeVirtual(Pvoid_t, Word_t); // free, size in words.
#define JLF( PV, PArray, Index) \
J_1P(PV, PArray, &(Index), JudyLFirst, "JudyLFirst")

#define JLN(PV,PArray,Index) \
{ \
extern const uint8_t j__L_LeafWOffset[]; \
PWord_t P_L = (PWord_t) (PArray); \
\
(PV) = (Pvoid_t) NULL; \
\
if (P_L) /* cannot be a NULL pointer */ \
{ \
if (P_L[0] < 31) /* is a LeafL */ \
{ \
Word_t _pop1 = P_L[0] + 1; \
Word_t _off = j__L_LeafWOffset[_pop1] -1; \
if ((Index) < P_L[_pop1]) \
{ \
while(1) \
{ \
if ((Index) < *(++P_L)) \
{ \
(Index) = *P_L; \
(PV) = (Pvoid_t) (P_L + _off); \
break; \
} \
} \
} \
} \
else \
{ \
(PV) = (Pvoid_t)JudyLNext((Pvoid_t) PArray, &(Index), PJE0); \
} \
} \
}
#define JLN( PV, PArray, Index) \
J_1P(PV, PArray, &(Index), JudyLNext, "JudyLNext")

#define JLL( PV, PArray, Index) \
J_1P(PV, PArray, &(Index), JudyLLast, "JudyLLast")
Expand Down
4 changes: 2 additions & 2 deletions src/JudyCommon/JudyMallocIF.c
Expand Up @@ -182,7 +182,7 @@ static Word_t j__udyMemSequence = 0L; // event sequence number.

FUNCTION Pjpm_t j__udyAllocJPM(void)
{
Word_t Words = sizeof(jpm_t) / cJU_BYTESPERWORD;
Word_t Words = (sizeof(jpm_t) + cJU_BYTESPERWORD - 1) / cJU_BYTESPERWORD;
Pjpm_t Pjpm = (Pjpm_t) MALLOC(JudyMalloc, Words, Words);

assert((Words * cJU_BYTESPERWORD) == sizeof(jpm_t));
Expand Down Expand Up @@ -524,7 +524,7 @@ FUNCTION Pjv_t j__udyLAllocJV(Word_t Pop1, Pjpm_t Pjpm)

FUNCTION void j__udyFreeJPM(Pjpm_t PjpmFree, Pjpm_t PjpmStats)
{
Word_t Words = sizeof(jpm_t) / cJU_BYTESPERWORD;
Word_t Words = (sizeof(jpm_t) + cJU_BYTESPERWORD - 1) / cJU_BYTESPERWORD;

// MALLOCBITS_TEST(Pjpm_t, PjpmFree); // see above.
JudyFree((Pvoid_t) PjpmFree, Words);
Expand Down
31 changes: 20 additions & 11 deletions test/Checkit
Expand Up @@ -16,25 +16,32 @@ echo "$CC -O SLcompare.c -DSPLAYMETHOD -o SL_Splay"
echo "$CC -O SLcompare.c -DREDBLACKMETHOD -o SL_Redblack"
$CC -O SLcompare.c -DREDBLACKMETHOD -o SL_Redblack


echo
echo Compiling with Judy library: $LIBJUDY
echo

echo "$CC -O -I../src SLcompare.c -DJUDYMETHOD -o SL_Judy $LIBJUDY -lm"
$CC -O -I../src SLcompare.c -DJUDYMETHOD -o SL_Judy $LIBJUDY -lm
if [ $? -ne 0 ] ; then
RET=$?
if [ $RET -ne 0 ] ; then
echo "=== $? Failed: $CC SLcompare.c -DJUDYMETHOD"
echo "=== $? Failed: $CC -O -I../src SLcompare.c -DJUDYMETHOD -o SL_Judy $LIBJUDY -lm"
exit $?
fi

echo "$CC -O -I../src Judy1LHCheck.c -o Judy1LHCheck $LIBJUDY -lm"
$CC -O -I../src Judy1LHCheck.c -o Judy1LHCheck $LIBJUDY -lm
if [ $? -ne 0 ] ; then
RET=$?
if [ $RET -ne 0 ] ; then
echo "=== $? Failed: $CC Judy1LHCheck.c"
exit $?
fi


echo "$CC -O -I../src Judy1LHTime.c -DNOINLINE -o Judy1LHTime $LIBJUDY -lm"
$CC -O -I../src Judy1LHTime.c -DNOINLINE -o Judy1LHTime $LIBJUDY -lm
if [ $? -ne 0 ] ; then
RET=$?
if [ $RET -ne 0 ] ; then
echo "=== $? Failed: $CC Judy1LHTime.c"
exit $?
fi
Expand All @@ -47,8 +54,9 @@ echo "=== Pass: Compile of tests"

echo
echo " Validate Judy1/JudyL/JudyHS functions (except Judy*ByCount)"
./Judy1LHCheck -n 300000 -B21 > /dev/null
if [ $? -ne 0 ] ; then
./Judy1LHCheck -n 300000 -B20 > /dev/null
RET=$?
if [ $RET -ne 0 ] ; then
echo "=== $? Failed: Judy1/JudyL/JudyHS validate program"
exit $?
fi
Expand Down Expand Up @@ -83,11 +91,12 @@ echo
# lookup/ln is: average lookup time in same order as inserts
# ADT is: Abstract Data Type method
echo " lines avg_linelen getline StoreD RAMused/line store/ln lookup/ln ADT"
./SL_Hash ../Makefile | grep HASH
./SL_Splay ../Makefile | grep SPLAY
./SL_Redblack ../Makefile | grep REDBLACK
./SL_Judy ../Makefile | grep JUDY
if [ $? -ne 0 ] ; then
./SL_Hash StringCompare.c | grep HASH
./SL_Splay StringCompare.c | grep SPLAY
./SL_Redblack StringCompare.c | grep REDBLACK
./SL_Judy StringCompare.c | grep JUDY
RET=$?
if [ $RET -ne 0 ] ; then
echo "=== $? Failed: JudySL if StoreD numbers are all the same"
exit $?
fi
Expand Down

0 comments on commit 76115e2

Please sign in to comment.