version 1.5.2.2, 2012/03/29 12:23:00
|
version 1.5.2.3, 2012/03/29 13:16:24
|
Line 616 ait_val_t *
|
Line 616 ait_val_t *
|
io_findKeyVars(array_t * __restrict vars, u_short key) |
io_findKeyVars(array_t * __restrict vars, u_short key) |
{ |
{ |
array_t *tmp; |
array_t *tmp; |
ait_val_t **v = NULL; | ait_val_t **vv, *v = NULL; |
register int i; |
register int i; |
const u_char *p; |
const u_char *p; |
|
|
Line 630 io_findKeyVars(array_t * __restrict vars, u_short key)
|
Line 630 io_findKeyVars(array_t * __restrict vars, u_short key)
|
|
|
/* binary search */ |
/* binary search */ |
for (p = (const u_char*) tmp->arr_data, i = io_arraySize(tmp); i; i >>= 1) { |
for (p = (const u_char*) tmp->arr_data, i = io_arraySize(tmp); i; i >>= 1) { |
v = (ait_val_t**) (p + (i >> 1) * sizeof(void*)); | vv = (ait_val_t**) (p + (i >> 1) * sizeof(void*)); |
if (!(key - AIT_KEY(*v))) { /* found! */ | if (!(key - AIT_KEY(*vv))) { /* found! */ |
io_arrayDestroy(&tmp); | v = *vv; |
return *v; | break; |
} |
} |
if ((key - AIT_KEY(*v)) > 0) { /* move right key > current */ | if ((key - AIT_KEY(*vv)) > 0) { /* move right key > current */ |
p = (const u_char*) v + sizeof(void*); | p = (const u_char*) vv + sizeof(void*); |
i--; |
i--; |
} /* else move left */ |
} /* else move left */ |
} |
} |
|
|
io_arrayDestroy(&tmp); |
io_arrayDestroy(&tmp); |
return NULL; | return v; |
} |
} |