version 1.4, 2001/11/19 19:02:14 |
version 1.5, 2002/03/25 16:30:55 |
|
|
int probes; |
int probes; |
|
|
probes = 0; |
probes = 0; |
# endif DEBUG |
# endif /* DEBUG */ |
for ( low = 0 , high = nname - 1 ; low != high ; ) { |
for ( low = 0 , high = nname - 1 ; low != high ; ) { |
# ifdef DEBUG |
# ifdef DEBUG |
probes += 1; |
probes += 1; |
# endif DEBUG |
# endif /* DEBUG */ |
middle = ( high + low ) >> 1; |
middle = ( high + low ) >> 1; |
if ( nl[ middle ].value <= address && nl[ middle+1 ].value > address ) { |
if ( nl[ middle ].value <= address && nl[ middle+1 ].value > address ) { |
# ifdef DEBUG |
# ifdef DEBUG |
if ( debug & LOOKUPDEBUG ) { |
if ( debug & LOOKUPDEBUG ) { |
printf( "[nllookup] %d (%d) probes\n" , probes , nname-1 ); |
printf( "[nllookup] %d (%d) probes\n" , probes , nname-1 ); |
} |
} |
# endif DEBUG |
# endif /* DEBUG */ |
return &nl[ middle ]; |
return &nl[ middle ]; |
} |
} |
if ( nl[ middle ].value > address ) { |
if ( nl[ middle ].value > address ) { |
|
|
# ifdef DEBUG |
# ifdef DEBUG |
if ( debug & LOOKUPDEBUG ) |
if ( debug & LOOKUPDEBUG ) |
warnx("[nllookup] (%d) binary search fails", nname - 1); |
warnx("[nllookup] (%d) binary search fails", nname - 1); |
# endif DEBUG |
# endif /* DEBUG */ |
return 0; |
return 0; |
} |
} |
|
|
|
|
printf( "[arclookup] parent %s child %s\n" , |
printf( "[arclookup] parent %s child %s\n" , |
parentp -> name , childp -> name ); |
parentp -> name , childp -> name ); |
} |
} |
# endif DEBUG |
# endif /* DEBUG */ |
for ( arcp = parentp -> children ; arcp ; arcp = arcp -> arc_childlist ) { |
for ( arcp = parentp -> children ; arcp ; arcp = arcp -> arc_childlist ) { |
# ifdef DEBUG |
# ifdef DEBUG |
if ( debug & LOOKUPDEBUG ) { |
if ( debug & LOOKUPDEBUG ) { |
|
|
arcp -> arc_parentp -> name , |
arcp -> arc_parentp -> name , |
arcp -> arc_childp -> name ); |
arcp -> arc_childp -> name ); |
} |
} |
# endif DEBUG |
# endif /* DEBUG */ |
if ( arcp -> arc_childp == childp ) { |
if ( arcp -> arc_childp == childp ) { |
return arcp; |
return arcp; |
} |
} |