2 * Copyright (c) 1983 Regents of the University of California.
5 * Redistribution and use in source and binary forms are permitted
6 * provided that: (1) source distributions retain this entire copyright
7 * notice and comment, and (2) distributions including binaries display
8 * the following acknowledgement: ``This product includes software
9 * developed by the University of California, Berkeley and its contributors''
10 * in the documentation or other materials provided with the distribution
11 * and in all advertising materials mentioning features or use of this
12 * software. Neither the name of the University nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 static char sccsid
[] = "@(#)lookup.c 5.4 (Berkeley) 6/1/90";
27 * look up an address in a sorted-by-address namelist
28 * this deals with misses by mapping them to the next lower
33 unsigned long address
;
43 for ( low
= 0 , high
= nname
- 1 ; low
!= high
; ) {
47 middle
= ( high
+ low
) >> 1;
48 if ( nl
[ middle
].value
<= address
&& nl
[ middle
+1 ].value
> address
) {
50 if ( debug
& LOOKUPDEBUG
) {
51 printf( "[nllookup] %d (%d) probes\n" , probes
, nname
-1 );
56 if ( nl
[ middle
].value
> address
) {
62 fprintf( stderr
, "[nllookup] binary search fails???\n" );
67 arclookup( parentp
, childp
)
73 if ( parentp
== 0 || childp
== 0 ) {
74 fprintf( "[arclookup] parentp == 0 || childp == 0\n" );
78 if ( debug
& LOOKUPDEBUG
) {
79 printf( "[arclookup] parent %s child %s\n" ,
80 parentp
-> name
, childp
-> name
);
83 for ( arcp
= parentp
-> children
; arcp
; arcp
= arcp
-> arc_childlist
) {
85 if ( debug
& LOOKUPDEBUG
) {
86 printf( "[arclookup]\t arc_parent %s arc_child %s\n" ,
87 arcp
-> arc_parentp
-> name
,
88 arcp
-> arc_childp
-> name
);
91 if ( arcp
-> arc_childp
== childp
) {
This page took 0.033319 seconds and 4 git commands to generate.