Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Unified Diff: Source/wtf/BitArray.h

Issue 290793004: Use a BitArray in RuntimeCSSEnabled instead of a Vector<bool> (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix bug in clear() Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/RuntimeCSSEnabled.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/BitArray.h
diff --git a/Source/wtf/BitArray.h b/Source/wtf/BitArray.h
index f1095150619cbfc883317af20f6deb9312ced487..54b84b46d37a682021e525779dedf0bdf8ab774a 100644
--- a/Source/wtf/BitArray.h
+++ b/Source/wtf/BitArray.h
@@ -34,9 +34,9 @@ namespace WTF {
template<unsigned arraySize>
class BitArray {
public:
- BitArray()
+ BitArray(bool value = false)
{
- memset(m_data, 0, sizeof(m_data));
+ memset(m_data, value ? 0xFF : 0, sizeof(m_data));
}
void set(unsigned index)
@@ -45,6 +45,12 @@ public:
m_data[index / 8] |= 1 << (index & 7);
}
+ void clear(unsigned index)
+ {
+ ASSERT_WITH_SECURITY_IMPLICATION(index < arraySize);
+ m_data[index / 8] &= ~(1 << (index & 7));
+ }
+
bool get(unsigned index) const
{
ASSERT_WITH_SECURITY_IMPLICATION(index < arraySize);
« no previous file with comments | « Source/core/css/RuntimeCSSEnabled.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698