diff options
Diffstat (limited to 'libartbase/base/bit_table.h')
-rw-r--r-- | libartbase/base/bit_table.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libartbase/base/bit_table.h b/libartbase/base/bit_table.h index 8036db1a16..ef2cf21e1f 100644 --- a/libartbase/base/bit_table.h +++ b/libartbase/base/bit_table.h @@ -139,14 +139,14 @@ class BitTableAccessor { static constexpr uint32_t kNumColumns = NumColumns; static constexpr uint32_t kNoValue = BitTableBase<kNumColumns>::kNoValue; - BitTableAccessor() {} BitTableAccessor(const BitTableBase<kNumColumns>* table, uint32_t row) : table_(table), row_(row) { + DCHECK(table_ != nullptr); } ALWAYS_INLINE uint32_t Row() const { return row_; } - ALWAYS_INLINE bool IsValid() const { return table_ != nullptr && row_ < table_->NumRows(); } + ALWAYS_INLINE bool IsValid() const { return row_ < table_->NumRows(); } ALWAYS_INLINE bool Equals(const BitTableAccessor& other) { return this->table_ == other.table_ && this->row_ == other.row_; @@ -228,6 +228,10 @@ class BitTable : public BitTableBase<Accessor::kNumColumns> { ALWAYS_INLINE Accessor GetRow(uint32_t row) const { return Accessor(this, row); } + + ALWAYS_INLINE Accessor GetInvalidRow() const { + return Accessor(this, static_cast<uint32_t>(-1)); + } }; template<typename Accessor> |