Skip to content
Snippets Groups Projects
Commit 788648df authored by ilor's avatar ilor
Browse files

use a.none()/a.any() instead of a == 0/ a != 0 for bitsets

parent c88fce56
Branches
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ int Tag::pos_count() const ...@@ -36,7 +36,7 @@ int Tag::pos_count() const
int Tag::get_pos_index() const int Tag::get_pos_index() const
{ {
if (pos_ == 0) return -1; if (pos_.none()) return -1;
return PwrNlp::lowest_bit(pos_); return PwrNlp::lowest_bit(pos_);
} }
......
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
} }
bool is_null() const { bool is_null() const {
return pos_ == 0 && values_ == 0; return pos_.none() && values_.none();
} }
int pos_count() const; int pos_count() const;
......
...@@ -252,9 +252,9 @@ Tag Tagset::parse_simple_tag(const string_range_vector &ts, ...@@ -252,9 +252,9 @@ Tag Tagset::parse_simple_tag(const string_range_vector &ts,
for (size_t i = 1; i < ts.size(); ++i) { for (size_t i = 1; i < ts.size(); ++i) {
if (!ts[i].empty()) { if (!ts[i].empty()) {
mask_t val = get_value_mask(boost::copy_range<std::string>(ts[i])); mask_t val = get_value_mask(boost::copy_range<std::string>(ts[i]));
if (val == 0) { if (val.none()) {
mask_t a = get_attribute_mask(ts[i]); mask_t a = get_attribute_mask(ts[i]);
if (a != 0) { if (a.any()) {
values &= (~a); values &= (~a);
} else { } else {
throw TagParseError("Unknown attribute value", throw TagParseError("Unknown attribute value",
...@@ -335,7 +335,7 @@ bool Tagset::validate_tag(const Tag &t, bool allow_extra, ...@@ -335,7 +335,7 @@ bool Tagset::validate_tag(const Tag &t, bool allow_extra,
for (idx_t i = 0; i < attribute_count(); ++i) { for (idx_t i = 0; i < attribute_count(); ++i) {
mask_t value = t.get_values_for(get_attribute_mask(i)); mask_t value = t.get_values_for(get_attribute_mask(i));
if (value == 0) { if (value.none()) {
if (required[i]) { if (required[i]) {
if (os) { if (os) {
(*os) << " red attribuite " (*os) << " red attribuite "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment