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

Unified Diff: Source/wtf/BitVector.h

Issue 20300002: Fix trailing whitespace in .cpp, .h, and .idl files (ex. Source/core) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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/wtf/BitArray.h ('k') | Source/wtf/BitVector.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/BitVector.h
diff --git a/Source/wtf/BitVector.h b/Source/wtf/BitVector.h
index 6d386b0de096821e98ba43c4d9883c6407863853..556dff090c6f035a55a369c93c31bc425fd91c70 100644
--- a/Source/wtf/BitVector.h
+++ b/Source/wtf/BitVector.h
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BitVector_h
@@ -56,32 +56,32 @@ namespace WTF {
// space.
class WTF_EXPORT BitVector {
-public:
+public:
BitVector()
: m_bitsOrPointer(makeInlineBits(0))
{
}
-
+
explicit BitVector(size_t numBits)
: m_bitsOrPointer(makeInlineBits(0))
{
ensureSize(numBits);
}
-
+
BitVector(const BitVector& other)
: m_bitsOrPointer(makeInlineBits(0))
{
(*this) = other;
}
-
+
~BitVector()
{
if (isInline())
return;
OutOfLineBits::destroy(outOfLineBits());
}
-
+
BitVector& operator=(const BitVector& other)
{
if (isInline() && other.isInline())
@@ -104,10 +104,10 @@ public:
return;
resizeOutOfLine(numBits);
}
-
+
// Like ensureSize(), but supports reducing the size of the bitvector.
void resize(size_t numBits);
-
+
void clearAll();
bool quickGet(size_t bit) const
@@ -115,19 +115,19 @@ public:
ASSERT_WITH_SECURITY_IMPLICATION(bit < size());
return !!(bits()[bit / bitsInPointer()] & (static_cast<uintptr_t>(1) << (bit & (bitsInPointer() - 1))));
}
-
+
void quickSet(size_t bit)
{
ASSERT_WITH_SECURITY_IMPLICATION(bit < size());
bits()[bit / bitsInPointer()] |= (static_cast<uintptr_t>(1) << (bit & (bitsInPointer() - 1)));
}
-
+
void quickClear(size_t bit)
{
ASSERT_WITH_SECURITY_IMPLICATION(bit < size());
bits()[bit / bitsInPointer()] &= ~(static_cast<uintptr_t>(1) << (bit & (bitsInPointer() - 1)));
}
-
+
void quickSet(size_t bit, bool value)
{
if (value)
@@ -135,14 +135,14 @@ public:
else
quickClear(bit);
}
-
+
bool get(size_t bit) const
{
if (bit >= size())
return false;
return quickGet(bit);
}
-
+
void set(size_t bit)
{
ensureSize(bit + 1);
@@ -161,7 +161,7 @@ public:
return;
quickClear(bit);
}
-
+
void set(size_t bit, bool value)
{
if (value)
@@ -169,9 +169,9 @@ public:
else
clear(bit);
}
-
+
void dump(PrintStream& out);
-
+
private:
static unsigned bitsInPointer()
{
@@ -193,16 +193,16 @@ private:
ASSERT(!(bits & (static_cast<uintptr_t>(1) << maxInlineBits())));
return bits | (static_cast<uintptr_t>(1) << maxInlineBits());
}
-
+
class OutOfLineBits {
public:
size_t numBits() const { return m_numBits; }
size_t numWords() const { return (m_numBits + bitsInPointer() - 1) / bitsInPointer(); }
uintptr_t* bits() { return bitwise_cast<uintptr_t*>(this + 1); }
const uintptr_t* bits() const { return bitwise_cast<const uintptr_t*>(this + 1); }
-
+
static OutOfLineBits* create(size_t numBits);
-
+
static void destroy(OutOfLineBits*);
private:
@@ -210,32 +210,32 @@ private:
: m_numBits(numBits)
{
}
-
+
size_t m_numBits;
};
-
+
bool isInline() const { return m_bitsOrPointer >> maxInlineBits(); }
-
+
const OutOfLineBits* outOfLineBits() const { return bitwise_cast<const OutOfLineBits*>(m_bitsOrPointer << 1); }
OutOfLineBits* outOfLineBits() { return bitwise_cast<OutOfLineBits*>(m_bitsOrPointer << 1); }
-
+
void resizeOutOfLine(size_t numBits);
void setSlow(const BitVector& other);
-
+
uintptr_t* bits()
{
if (isInline())
return &m_bitsOrPointer;
return outOfLineBits()->bits();
}
-
+
const uintptr_t* bits() const
{
if (isInline())
return &m_bitsOrPointer;
return outOfLineBits()->bits();
}
-
+
uintptr_t m_bitsOrPointer;
};
« no previous file with comments | « Source/wtf/BitArray.h ('k') | Source/wtf/BitVector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698