From 0c19418e84a4db3f1e5a9ca143d5986a104a5675 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 24 Aug 2015 11:10:15 +0200 Subject: tag/Settings: convert to bit mask --- src/tag/TagConfig.cxx | 4 ++-- src/tag/TagSettings.c | 5 +---- src/tag/TagSettings.h | 8 +++++--- 3 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/tag/TagConfig.cxx b/src/tag/TagConfig.cxx index e4d40696d..de5faff32 100644 --- a/src/tag/TagConfig.cxx +++ b/src/tag/TagConfig.cxx @@ -39,7 +39,7 @@ TagLoadConfig() if (value == nullptr) return; - std::fill_n(ignore_tag_items, size_t(TAG_NUM_OF_ITEM_TYPES), true); + global_tag_mask = 0; if (StringEqualsCaseASCII(value, "none")) return; @@ -62,7 +62,7 @@ TagLoadConfig() FormatFatalError("error parsing metadata item \"%s\"", c); - ignore_tag_items[type] = false; + global_tag_mask |= tag_mask_t(1) << unsigned(type); s++; c = s; diff --git a/src/tag/TagSettings.c b/src/tag/TagSettings.c index 4582bd3c0..905265913 100644 --- a/src/tag/TagSettings.c +++ b/src/tag/TagSettings.c @@ -19,7 +19,4 @@ #include "TagSettings.h" -bool ignore_tag_items[TAG_NUM_OF_ITEM_TYPES] = { - /* ignore comments by default */ - [TAG_COMMENT] = true, -}; +tag_mask_t global_tag_mask = (tag_mask_t)-1 & ~(1 << TAG_COMMENT); diff --git a/src/tag/TagSettings.h b/src/tag/TagSettings.h index a58bd8915..708517a08 100644 --- a/src/tag/TagSettings.h +++ b/src/tag/TagSettings.h @@ -23,9 +23,11 @@ #include "TagType.h" #include "Compiler.h" -#include +#include -extern bool ignore_tag_items[TAG_NUM_OF_ITEM_TYPES]; +typedef uint_least32_t tag_mask_t; + +extern tag_mask_t global_tag_mask; #ifdef __cplusplus @@ -33,7 +35,7 @@ gcc_const static inline bool IsTagEnabled(unsigned tag) { - return !ignore_tag_items[tag]; + return global_tag_mask & (1u << tag); } gcc_const -- cgit v1.2.3