summaryrefslogtreecommitdiff
path: root/apps/tagcache.h
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2009-06-03 08:19:32 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2009-06-03 08:19:32 +0000
commit1248a0dc1fe970951fdba063b88d8ad8c96db912 (patch)
tree1d544c2bf20d01eb4861b82df78f4a9ed904840a /apps/tagcache.h
parent2bedde17b6d841ee8910a71cf5343ec8c8fed98b (diff)
downloadrockbox-1248a0dc1fe970951fdba063b88d8ad8c96db912.tar.gz
rockbox-1248a0dc1fe970951fdba063b88d8ad8c96db912.zip
Replace arrays of tags that are numeric/sorted/uniqued with bitfields flagging each tag that is a member of the set, and replace the membership tests with a shift and bitwise and. The test is still done inside a function on SH, as this saves some space vs the macro used on other targets.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21175 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tagcache.h')
-rw-r--r--apps/tagcache.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/apps/tagcache.h b/apps/tagcache.h
index e995784742..8863ecb7df 100644
--- a/apps/tagcache.h
+++ b/apps/tagcache.h
@@ -94,6 +94,21 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title,
94/* Serialized DB. */ 94/* Serialized DB. */
95#define TAGCACHE_STATEFILE ROCKBOX_DIR "/database_state.tcd" 95#define TAGCACHE_STATEFILE ROCKBOX_DIR "/database_state.tcd"
96 96
97/* Numeric tags (we can use these tags with conditional clauses). */
98#define TAGCACHE_NUMERIC_TAGS ((1LU << tag_year) | (1LU << tag_discnumber) | \
99 (1LU << tag_tracknumber) | (1LU << tag_length) | (1LU << tag_bitrate) | \
100 (1LU << tag_playcount) | (1LU << tag_rating) | (1LU << tag_playtime) | \
101 (1LU << tag_lastplayed) | (1LU << tag_commitid) | (1LU << tag_mtime) | \
102 (1LU << tag_virt_length_min) | (1LU << tag_virt_length_sec) | \
103 (1LU << tag_virt_playtime_min) | (1LU << tag_virt_playtime_sec) | \
104 (1LU << tag_virt_entryage) | (1LU << tag_virt_autoscore))
105
106#ifdef CPU_SH
107#define TAGCACHE_IS_NUMERIC(tag) (tagcache_is_numeric_tag(tag))
108#else
109#define TAGCACHE_IS_NUMERIC(tag) ((1LU << tag) & TAGCACHE_NUMERIC_TAGS)
110#endif
111
97/* Flags */ 112/* Flags */
98#define FLAG_DELETED 0x0001 /* Entry has been removed from db */ 113#define FLAG_DELETED 0x0001 /* Entry has been removed from db */
99#define FLAG_DIRCACHE 0x0002 /* Filename is a dircache pointer */ 114#define FLAG_DIRCACHE 0x0002 /* Filename is a dircache pointer */
@@ -183,9 +198,9 @@ void tagcache_reverse_scan(void);
183 198
184const char* tagcache_tag_to_str(int tag); 199const char* tagcache_tag_to_str(int tag);
185 200
201#ifdef CPU_SH
186bool tagcache_is_numeric_tag(int type); 202bool tagcache_is_numeric_tag(int type);
187bool tagcache_is_unique_tag(int type); 203#endif
188bool tagcache_is_sorted_tag(int type);
189bool tagcache_find_index(struct tagcache_search *tcs, const char *filename); 204bool tagcache_find_index(struct tagcache_search *tcs, const char *filename);
190bool tagcache_check_clauses(struct tagcache_search *tcs, 205bool tagcache_check_clauses(struct tagcache_search *tcs,
191 struct tagcache_search_clause **clause, int count); 206 struct tagcache_search_clause **clause, int count);