Commit 0c19418e authored by Max Kellermann's avatar Max Kellermann

tag/Settings: convert to bit mask

parent 60c077c7
...@@ -39,7 +39,7 @@ TagLoadConfig() ...@@ -39,7 +39,7 @@ TagLoadConfig()
if (value == nullptr) if (value == nullptr)
return; return;
std::fill_n(ignore_tag_items, size_t(TAG_NUM_OF_ITEM_TYPES), true); global_tag_mask = 0;
if (StringEqualsCaseASCII(value, "none")) if (StringEqualsCaseASCII(value, "none"))
return; return;
...@@ -62,7 +62,7 @@ TagLoadConfig() ...@@ -62,7 +62,7 @@ TagLoadConfig()
FormatFatalError("error parsing metadata item \"%s\"", FormatFatalError("error parsing metadata item \"%s\"",
c); c);
ignore_tag_items[type] = false; global_tag_mask |= tag_mask_t(1) << unsigned(type);
s++; s++;
c = s; c = s;
......
...@@ -19,7 +19,4 @@ ...@@ -19,7 +19,4 @@
#include "TagSettings.h" #include "TagSettings.h"
bool ignore_tag_items[TAG_NUM_OF_ITEM_TYPES] = { tag_mask_t global_tag_mask = (tag_mask_t)-1 & ~(1 << TAG_COMMENT);
/* ignore comments by default */
[TAG_COMMENT] = true,
};
...@@ -23,9 +23,11 @@ ...@@ -23,9 +23,11 @@
#include "TagType.h" #include "TagType.h"
#include "Compiler.h" #include "Compiler.h"
#include <stdbool.h> #include <stdint.h>
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 #ifdef __cplusplus
...@@ -33,7 +35,7 @@ gcc_const ...@@ -33,7 +35,7 @@ gcc_const
static inline bool static inline bool
IsTagEnabled(unsigned tag) IsTagEnabled(unsigned tag)
{ {
return !ignore_tag_items[tag]; return global_tag_mask & (1u << tag);
} }
gcc_const gcc_const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment