Commit 297bb0ca authored by bmeurer's avatar bmeurer Committed by Commit bot

[clusterfuzz] Length 0 is perfectly fine for BitVector.

BUG=chromium:485952
LOG=n
R=jarin@chromium.org

Review URL: https://codereview.chromium.org/1124223006

Cr-Commit-Position: refs/heads/master@{#28316}
parent 1fbe587b
...@@ -66,7 +66,7 @@ class BitVector : public ZoneObject { ...@@ -66,7 +66,7 @@ class BitVector : public ZoneObject {
: length_(length), : length_(length),
data_length_(SizeFor(length)), data_length_(SizeFor(length)),
data_(zone->NewArray<uintptr_t>(data_length_)) { data_(zone->NewArray<uintptr_t>(data_length_)) {
DCHECK(length > 0); DCHECK_LE(0, length);
Clear(); Clear();
} }
...@@ -77,7 +77,10 @@ class BitVector : public ZoneObject { ...@@ -77,7 +77,10 @@ class BitVector : public ZoneObject {
CopyFrom(other); CopyFrom(other);
} }
static int SizeFor(int length) { return 1 + ((length - 1) / kDataBits); } static int SizeFor(int length) {
if (length == 0) return 1;
return 1 + ((length - 1) / kDataBits);
}
void CopyFrom(const BitVector& other) { void CopyFrom(const BitVector& other) {
DCHECK(other.length() <= length()); DCHECK(other.length() <= length());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment