diff options
author | Ian Rogers <irogers@google.com> | 2014-10-30 15:13:22 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2014-10-30 15:13:22 -0700 |
commit | 5a2e4ccabf4cda7050c63685be23339eac8779df (patch) | |
tree | ffa58c9c51de081b0f8e0916f12a025eaa223ed4 /runtime/base/bit_vector.cc | |
parent | a8825e4b38ae01fa77d255ca423ab2f2b77c6097 (diff) | |
download | android_art-5a2e4ccabf4cda7050c63685be23339eac8779df.tar.gz android_art-5a2e4ccabf4cda7050c63685be23339eac8779df.tar.bz2 android_art-5a2e4ccabf4cda7050c63685be23339eac8779df.zip |
Fix mixed signed/unsigned arithmetic in BitVector.
Change-Id: I59c7f5a26e42689f77b067f4c73b086335e9273d
Diffstat (limited to 'runtime/base/bit_vector.cc')
-rw-r--r-- | runtime/base/bit_vector.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/base/bit_vector.cc b/runtime/base/bit_vector.cc index 71dec7aa5b..63e9355d2d 100644 --- a/runtime/base/bit_vector.cc +++ b/runtime/base/bit_vector.cc @@ -16,6 +16,7 @@ #include "bit_vector.h" +#include <limits> #include <sstream> #include "allocator.h" @@ -218,13 +219,13 @@ void BitVector::SetInitialBits(uint32_t num_bits) { uint32_t idx; // We can set every storage element with -1. for (idx = 0; idx < WordIndex(num_bits); idx++) { - storage_[idx] = -1; + storage_[idx] = std::numeric_limits<uint32_t>::max(); } // Handle the potentially last few bits. uint32_t rem_num_bits = num_bits & 0x1f; if (rem_num_bits != 0) { - storage_[idx] = (1 << rem_num_bits) - 1; + storage_[idx] = (1U << rem_num_bits) - 1; ++idx; } |