From 60c8b999620dcf4e200865e2c0b44f8a3af77dae Mon Sep 17 00:00:00 2001
From: ilor <kailoran@gmail.com>
Date: Wed, 20 Oct 2010 13:21:25 +0200
Subject: [PATCH] remove assert from add_values_masked to allow clearing an
 attribute

---
 libcorpus2/tag.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libcorpus2/tag.h b/libcorpus2/tag.h
index c700216..6fc8f8c 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) {
-- 
GitLab