forked from len0rd/rockbox
Font cache now uses memmove().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8603 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e6e8aa9519
commit
85c0440ae9
1 changed files with 8 additions and 19 deletions
|
|
@ -181,31 +181,20 @@ struct font_cache_entry* font_cache_get(
|
||||||
|
|
||||||
if (insertion_point < index_to_replace)
|
if (insertion_point < index_to_replace)
|
||||||
{
|
{
|
||||||
/* shift memory down */
|
/* shift memory up */
|
||||||
int dest = insertion_point+2;
|
memmove(fcache->_index + insertion_point + 2,
|
||||||
int src = insertion_point+1;
|
fcache->_index + insertion_point + 1,
|
||||||
int len = index_to_replace - insertion_point - 1;
|
(index_to_replace - insertion_point - 1) * sizeof(short));
|
||||||
|
|
||||||
int desti = dest + len - 1;
|
|
||||||
int srci = src + len - 1;
|
|
||||||
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < len; i++)
|
|
||||||
fcache->_index[desti--] = fcache->_index[srci--];
|
|
||||||
|
|
||||||
/* add to index */
|
/* add to index */
|
||||||
fcache->_index[insertion_point + 1] = lru_handle_to_replace;
|
fcache->_index[insertion_point + 1] = lru_handle_to_replace;
|
||||||
}
|
}
|
||||||
else if (insertion_point > index_to_replace)
|
else if (insertion_point > index_to_replace)
|
||||||
{
|
{
|
||||||
/* shift memory up */
|
/* shift memory down */
|
||||||
int dest = index_to_replace;
|
memmove(fcache->_index + index_to_replace,
|
||||||
int src = index_to_replace + 1;
|
fcache->_index + index_to_replace + 1,
|
||||||
int len = insertion_point - index_to_replace;
|
(insertion_point - index_to_replace) * sizeof(short));
|
||||||
|
|
||||||
int i;
|
|
||||||
for (i=0; i < len; i++)
|
|
||||||
fcache->_index[dest++] = fcache->_index[src++];
|
|
||||||
|
|
||||||
/* add to index */
|
/* add to index */
|
||||||
fcache->_index[insertion_point] = lru_handle_to_replace;
|
fcache->_index[insertion_point] = lru_handle_to_replace;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue