summaryrefslogtreecommitdiffstats
path: root/firmware/font_cache.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-02-06 17:24:47 +0000
committerJens Arnold <amiconn@rockbox.org>2006-02-06 17:24:47 +0000
commit85c0440ae93430d2c3e42442f9ac1be965ccb804 (patch)
tree7f5a59d7ba5aadc89e9da1e15ce54e4459ba058c /firmware/font_cache.c
parente6e8aa95197040d5f9e7125819a0a7f047a83f24 (diff)
downloadrockbox-85c0440ae93430d2c3e42442f9ac1be965ccb804.tar.gz
rockbox-85c0440ae93430d2c3e42442f9ac1be965ccb804.zip
Font cache now uses memmove().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8603 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/font_cache.c')
-rw-r--r--firmware/font_cache.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/firmware/font_cache.c b/firmware/font_cache.c
index 34a14e0551..f816635161 100644
--- a/firmware/font_cache.c
+++ b/firmware/font_cache.c
@@ -181,31 +181,20 @@ struct font_cache_entry* font_cache_get(
if (insertion_point < index_to_replace)
{
- /* shift memory down */
- int dest = insertion_point+2;
- int src = insertion_point+1;
- int len = index_to_replace - insertion_point - 1;
-
- int desti = dest + len - 1;
- int srci = src + len - 1;
-
- int i;
- for (i = 0; i < len; i++)
- fcache->_index[desti--] = fcache->_index[srci--];
+ /* shift memory up */
+ memmove(fcache->_index + insertion_point + 2,
+ fcache->_index + insertion_point + 1,
+ (index_to_replace - insertion_point - 1) * sizeof(short));
/* add to index */
fcache->_index[insertion_point + 1] = lru_handle_to_replace;
}
else if (insertion_point > index_to_replace)
{
- /* shift memory up */
- int dest = index_to_replace;
- int src = index_to_replace + 1;
- int len = insertion_point - index_to_replace;
-
- int i;
- for (i=0; i < len; i++)
- fcache->_index[dest++] = fcache->_index[src++];
+ /* shift memory down */
+ memmove(fcache->_index + index_to_replace,
+ fcache->_index + index_to_replace + 1,
+ (insertion_point - index_to_replace) * sizeof(short));
/* add to index */
fcache->_index[insertion_point] = lru_handle_to_replace;