forked from enlightenment/efl
Eo: optimised eo_op_class_get a bit. Can still make it better.
SVN revision: 75960
This commit is contained in:
parent
76fc983dc9
commit
b9e11cf26e
|
@ -203,20 +203,24 @@ static const Eo_Class *
|
||||||
_eo_op_class_get(Eo_Op op)
|
_eo_op_class_get(Eo_Op op)
|
||||||
{
|
{
|
||||||
/* FIXME: Make it fast. */
|
/* FIXME: Make it fast. */
|
||||||
const Eo_Class *klass = NULL;
|
|
||||||
Eo_Class **itr = _eo_classes;
|
Eo_Class **itr = _eo_classes;
|
||||||
Eo_Class_Id i;
|
int mid, max, min;
|
||||||
for (i = 0 ; i < _eo_classes_last_id ; i++, itr++)
|
|
||||||
|
min = 0;
|
||||||
|
max = _eo_classes_last_id - 1;
|
||||||
|
while (min <= max)
|
||||||
{
|
{
|
||||||
if (*itr && ((*itr)->base_id <= op) &&
|
mid = (min + max) / 2;
|
||||||
(op <= (*itr)->base_id + (*itr)->desc->ops.count))
|
|
||||||
{
|
if (itr[mid]->base_id + itr[mid]->desc->ops.count < op)
|
||||||
klass = *itr;
|
min = mid + 1;
|
||||||
return klass;
|
else if (itr[mid]->base_id > op)
|
||||||
}
|
max = mid - 1;
|
||||||
|
else
|
||||||
|
return itr[mid];
|
||||||
}
|
}
|
||||||
|
|
||||||
return klass;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Eo_Op_Description *
|
static const Eo_Op_Description *
|
||||||
|
|
Loading…
Reference in New Issue