summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-10-08 17:23:59 +0000
committerJens Arnold <amiconn@rockbox.org>2008-10-08 17:23:59 +0000
commita0c91ae4e2c4870eefed0a3ef7f1eb6caa862010 (patch)
tree687caed6d249fa87830616f6dbb129d7a9c0705f /apps
parent48b52aec468309ef00fc4bfee3b3fff969969661 (diff)
downloadrockbox-a0c91ae4e2c4870eefed0a3ef7f1eb6caa862010.tar.gz
rockbox-a0c91ae4e2c4870eefed0a3ef7f1eb6caa862010.tar.bz2
rockbox-a0c91ae4e2c4870eefed0a3ef7f1eb6caa862010.zip
Make the array static const char, and use it for direct lookup, saving binsize this way.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18743 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/playlist.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 6768ac8708..9cbda3f991 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -1483,23 +1483,18 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion)
tc->sort_dir = global_settings.sort_dir;
if (!is_forward)
{
- /* Sort options, indices of forward/reverse options differ in bit 0 */
- const int sortpairs[] =
+ static const char sortpairs[] =
{
- SORT_ALPHA, SORT_ALPHA_REVERSED,
- SORT_DATE, SORT_DATE_REVERSED,
- SORT_TYPE, SORT_TYPE_REVERSED,
- -1
+ [SORT_ALPHA] = SORT_ALPHA_REVERSED,
+ [SORT_DATE] = SORT_DATE_REVERSED,
+ [SORT_TYPE] = SORT_TYPE_REVERSED,
+ [SORT_ALPHA_REVERSED] = SORT_ALPHA,
+ [SORT_DATE_REVERSED] = SORT_DATE,
+ [SORT_TYPE_REVERSED] = SORT_TYPE,
};
-
- for (i = 0; sortpairs[i] >= 0; i++)
- {
- if (sortpairs[i] == global_settings.sort_dir)
- {
- tc->sort_dir = sortpairs[i^1];
- break;
- }
- }
+
+ if ((unsigned)tc->sort_dir < sizeof(sortpairs))
+ tc->sort_dir = sortpairs[tc->sort_dir];
}
while (!exit)