In search(): eliminate an unnecessary test.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30784 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
03a8325a2d
commit
0ab2c1b4c4
1 changed files with 5 additions and 4 deletions
|
@ -52,6 +52,8 @@ void font_cache_create(
|
||||||
|
|
||||||
fcache->_size = 1;
|
fcache->_size = 1;
|
||||||
fcache->_capacity = cache_size;
|
fcache->_capacity = cache_size;
|
||||||
|
fcache->_prev_result = 0;
|
||||||
|
fcache->_prev_char_code = 0;
|
||||||
|
|
||||||
/* set up index */
|
/* set up index */
|
||||||
fcache->_index = buf;
|
fcache->_index = buf;
|
||||||
|
@ -84,11 +86,10 @@ int search( struct font_cache* fcache,
|
||||||
right = fcache->_size - 1;
|
right = fcache->_size - 1;
|
||||||
|
|
||||||
/* go for a lucky guess */
|
/* go for a lucky guess */
|
||||||
if ( fcache->_prev_char_code != -1 )
|
mid = char_code +
|
||||||
mid = char_code +
|
fcache->_prev_result - fcache->_prev_char_code;
|
||||||
fcache->_prev_result - fcache->_prev_char_code;
|
|
||||||
|
|
||||||
/* check bounds or unset */
|
/* check bounds */
|
||||||
if ( mid < 0 || mid > right )
|
if ( mid < 0 || mid > right )
|
||||||
mid = ( left + right ) / 2;
|
mid = ( left + right ) / 2;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue