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)
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,
/* Serialized DB. */
#define TAGCACHE_STATEFILE ROCKBOX_DIR "/database_state.tcd"
+/* Numeric tags (we can use these tags with conditional clauses). */
+#define TAGCACHE_NUMERIC_TAGS ((1LU << tag_year) | (1LU << tag_discnumber) | \
+ (1LU << tag_tracknumber) | (1LU << tag_length) | (1LU << tag_bitrate) | \
+ (1LU << tag_playcount) | (1LU << tag_rating) | (1LU << tag_playtime) | \
+ (1LU << tag_lastplayed) | (1LU << tag_commitid) | (1LU << tag_mtime) | \
+ (1LU << tag_virt_length_min) | (1LU << tag_virt_length_sec) | \
+ (1LU << tag_virt_playtime_min) | (1LU << tag_virt_playtime_sec) | \
+ (1LU << tag_virt_entryage) | (1LU << tag_virt_autoscore))
+
+#ifdef CPU_SH
+#define TAGCACHE_IS_NUMERIC(tag) (tagcache_is_numeric_tag(tag))
+#else
+#define TAGCACHE_IS_NUMERIC(tag) ((1LU << tag) & TAGCACHE_NUMERIC_TAGS)
+#endif
+
/* Flags */
#define FLAG_DELETED 0x0001 /* Entry has been removed from db */
#define FLAG_DIRCACHE 0x0002 /* Filename is a dircache pointer */
@@ -183,9 +198,9 @@ void tagcache_reverse_scan(void);
const char* tagcache_tag_to_str(int tag);
+#ifdef CPU_SH
bool tagcache_is_numeric_tag(int type);
-bool tagcache_is_unique_tag(int type);
-bool tagcache_is_sorted_tag(int type);
+#endif
bool tagcache_find_index(struct tagcache_search *tcs, const char *filename);
bool tagcache_check_clauses(struct tagcache_search *tcs,
struct tagcache_search_clause **clause, int count);