diff options
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 | ||