diff --git a/libcorpus2/tag.h b/libcorpus2/tag.h index c700216b62e974a991c564b8c0bb9a1679abefed..6fc8f8c1dabd97c1d8766a5e3aaf1cb810d2d2a1 100644 --- a/libcorpus2/tag.h +++ b/libcorpus2/tag.h @@ -92,8 +92,9 @@ public: void add_values_masked(mask_t value, mask_t mask) { - assert(mask & value); - values_ = (values_ & ~mask) | value; + //values_ = (values_ & ~mask) | (value & mask); + //see http://graphics.stanford.edu/~seander/bithacks.html#MaskedMerge + values_ = values_ ^ ((values_ ^ value) & mask); } Tag& combine_with(const Tag& other) {