diff options
author | Fred Bauer <fred.w.bauer@gmail.com> | 2011-10-18 17:02:24 +0000 |
---|---|---|
committer | Fred Bauer <fred.w.bauer@gmail.com> | 2011-10-18 17:02:24 +0000 |
commit | 0ab2c1b4c4455454d0639c8604417f026fbfd895 (patch) | |
tree | f0a57b6ec9e765c516031085886b9556f0de46f1 /firmware/font_cache.c | |
parent | 03a8325a2d907719c27011472b0a1ee73bec7c8e (diff) | |
download | rockbox-0ab2c1b4c4455454d0639c8604417f026fbfd895.tar.gz rockbox-0ab2c1b4c4455454d0639c8604417f026fbfd895.zip |
In search(): eliminate an unnecessary test.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30784 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/font_cache.c')
-rw-r--r-- | firmware/font_cache.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/firmware/font_cache.c b/firmware/font_cache.c index 72a96bfb23..24a5faf385 100644 --- a/firmware/font_cache.c +++ b/firmware/font_cache.c | |||
@@ -52,6 +52,8 @@ void font_cache_create( | |||
52 | 52 | ||
53 | fcache->_size = 1; | 53 | fcache->_size = 1; |
54 | fcache->_capacity = cache_size; | 54 | fcache->_capacity = cache_size; |
55 | fcache->_prev_result = 0; | ||
56 | fcache->_prev_char_code = 0; | ||
55 | 57 | ||
56 | /* set up index */ | 58 | /* set up index */ |
57 | fcache->_index = buf; | 59 | fcache->_index = buf; |
@@ -84,11 +86,10 @@ int search( struct font_cache* fcache, | |||
84 | right = fcache->_size - 1; | 86 | right = fcache->_size - 1; |
85 | 87 | ||
86 | /* go for a lucky guess */ | 88 | /* go for a lucky guess */ |
87 | if ( fcache->_prev_char_code != -1 ) | 89 | mid = char_code + |
88 | mid = char_code + | 90 | fcache->_prev_result - fcache->_prev_char_code; |
89 | fcache->_prev_result - fcache->_prev_char_code; | ||
90 | 91 | ||
91 | /* check bounds or unset */ | 92 | /* check bounds */ |
92 | if ( mid < 0 || mid > right ) | 93 | if ( mid < 0 || mid > right ) |
93 | mid = ( left + right ) / 2; | 94 | mid = ( left + right ) / 2; |
94 | 95 | ||