diff options
-rw-r--r-- | apps/tagcache.c | 43 | ||||
-rw-r--r-- | apps/tagcache.h | 3 |
2 files changed, 23 insertions, 23 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c index 4a542fb702..3d0ab7fbd3 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -107,24 +107,40 @@ static long tempbuf_size; /* Buffer size (TEMPBUF_SIZE). */ | |||
107 | static long tempbuf_left; /* Buffer space left. */ | 107 | static long tempbuf_left; /* Buffer space left. */ |
108 | static long tempbuf_pos; | 108 | static long tempbuf_pos; |
109 | 109 | ||
110 | #ifdef CPU_SH | 110 | #define SORTED_TAGS_COUNT 8 |
111 | #define TAGCACHE_IS_UNIQUE(tag) (tagcache_is_unique_tag(tag)) | 111 | #ifdef CPU_SH /* SH lacks a variable shift instruction */ |
112 | #define TAGCACHE_IS_SORTED(tag) (tagcache_is_sorted_tag(tag)) | 112 | /* Numeric tags (we can use these tags with conditional clauses). */ |
113 | const char tagcache_numeric_tags[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, | ||
114 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, | ||
115 | 1, 1, 1, 1, 1 }; | ||
116 | |||
117 | /* Uniqued tags (we can use these tags with filters and conditional clauses). */ | ||
118 | static const char tagcache_unique_tags[] = { 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, | ||
119 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
120 | 0, 0, 0, 0, 0 }; | ||
121 | |||
122 | /* Tags we want to get sorted (loaded to the tempbuf). */ | ||
123 | static const char tagcache_sorted_tags[] = { 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, | ||
124 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
125 | 0, 0, 0, 0, 0 }; | ||
126 | |||
127 | #define TAGCACHE_IS_UNIQUE(tag) ((bool)tagcache_unique_tags[tag]) | ||
128 | #define TAGCACHE_IS_SORTED(tag) ((bool)tagcache_sorted_tags[tag]) | ||
129 | |||
113 | #else | 130 | #else |
114 | #define TAGCACHE_IS_UNIQUE(tag) ((1LU << tag) & TAGCACHE_UNIQUE_TAGS) | 131 | #define TAGCACHE_IS_UNIQUE(tag) ((1LU << tag) & TAGCACHE_UNIQUE_TAGS) |
115 | #define TAGCACHE_IS_SORTED(tag) ((1LU << tag) & TAGCACHE_SORTED_TAGS) | 132 | #define TAGCACHE_IS_SORTED(tag) ((1LU << tag) & TAGCACHE_SORTED_TAGS) |
116 | #endif | ||
117 | 133 | ||
118 | /* Tags we want to get sorted (loaded to the tempbuf). */ | 134 | /* Tags we want to get sorted (loaded to the tempbuf). */ |
119 | #define TAGCACHE_SORTED_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \ | 135 | #define TAGCACHE_SORTED_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \ |
120 | (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \ | 136 | (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \ |
121 | (1LU << tag_albumartist) | (1LU << tag_grouping) | (1LU << tag_title)) | 137 | (1LU << tag_albumartist) | (1LU << tag_grouping) | (1LU << tag_title)) |
122 | #define SORTED_TAGS_COUNT 8 | ||
123 | 138 | ||
124 | /* Uniqued tags (we can use these tags with filters and conditional clauses). */ | 139 | /* Uniqued tags (we can use these tags with filters and conditional clauses). */ |
125 | #define TAGCACHE_UNIQUE_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \ | 140 | #define TAGCACHE_UNIQUE_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \ |
126 | (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \ | 141 | (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \ |
127 | (1LU << tag_albumartist) | (1LU << tag_grouping)) | 142 | (1LU << tag_albumartist) | (1LU << tag_grouping)) |
143 | #endif | ||
128 | 144 | ||
129 | /* String presentation of the tags defined in tagcache.h. Must be in correct order! */ | 145 | /* String presentation of the tags defined in tagcache.h. Must be in correct order! */ |
130 | static const char *tags_str[] = { "artist", "album", "genre", "title", | 146 | static const char *tags_str[] = { "artist", "album", "genre", "title", |
@@ -268,23 +284,6 @@ const char* tagcache_tag_to_str(int tag) | |||
268 | return tags_str[tag]; | 284 | return tags_str[tag]; |
269 | } | 285 | } |
270 | 286 | ||
271 | #ifdef CPU_SH | ||
272 | bool tagcache_is_numeric_tag(int type) | ||
273 | { | ||
274 | return (1LU << type) & TAGCACHE_NUMERIC_TAGS; | ||
275 | } | ||
276 | |||
277 | static bool tagcache_is_unique_tag(int type) | ||
278 | { | ||
279 | return (1LU << type) & TAGCACHE_UNIQUE_TAGS; | ||
280 | } | ||
281 | |||
282 | static bool tagcache_is_sorted_tag(int type) | ||
283 | { | ||
284 | return (1LU << type) & TAGCACHE_UNIQUE_TAGS; | ||
285 | } | ||
286 | #endif | ||
287 | |||
288 | #ifdef HAVE_DIRCACHE | 287 | #ifdef HAVE_DIRCACHE |
289 | /** | 288 | /** |
290 | * Returns true if specified flag is still present, i.e., dircache | 289 | * Returns true if specified flag is still present, i.e., dircache |
diff --git a/apps/tagcache.h b/apps/tagcache.h index 8863ecb7df..d7047178e1 100644 --- a/apps/tagcache.h +++ b/apps/tagcache.h | |||
@@ -104,7 +104,8 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title, | |||
104 | (1LU << tag_virt_entryage) | (1LU << tag_virt_autoscore)) | 104 | (1LU << tag_virt_entryage) | (1LU << tag_virt_autoscore)) |
105 | 105 | ||
106 | #ifdef CPU_SH | 106 | #ifdef CPU_SH |
107 | #define TAGCACHE_IS_NUMERIC(tag) (tagcache_is_numeric_tag(tag)) | 107 | extern const char tagcache_numeric_tags[]; |
108 | #define TAGCACHE_IS_NUMERIC(tag) ((bool)tagcache_numeric_tags[tag]) | ||
108 | #else | 109 | #else |
109 | #define TAGCACHE_IS_NUMERIC(tag) ((1LU << tag) & TAGCACHE_NUMERIC_TAGS) | 110 | #define TAGCACHE_IS_NUMERIC(tag) ((1LU << tag) & TAGCACHE_NUMERIC_TAGS) |
110 | #endif | 111 | #endif |