diff options
| author | 2014-10-08 19:15:21 +0000 | |
|---|---|---|
| committer | 2014-10-08 19:15:21 +0000 | |
| commit | 175b2732f7e55a07094c30aa08d946189b4af97e (patch) | |
| tree | 79d5ee5444a5be70130d9a75dd51831c4b15687b /runtime/mirror/array-inl.h | |
| parent | edc34c88b8f8abd04f9c4668787403608cf0b2d4 (diff) | |
| parent | 7e70b002c4552347ed1af8c002a0e13f08864f20 (diff) | |
Merge "Header file clean up."
Diffstat (limited to 'runtime/mirror/array-inl.h')
| -rw-r--r-- | runtime/mirror/array-inl.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/mirror/array-inl.h b/runtime/mirror/array-inl.h index 6582226dd5..13b5a8ba27 100644 --- a/runtime/mirror/array-inl.h +++ b/runtime/mirror/array-inl.h @@ -45,6 +45,14 @@ inline size_t Array::SizeOf() { return header_size + data_size; } +inline MemberOffset Array::DataOffset(size_t component_size) { + DCHECK(IsPowerOfTwo(component_size)) << component_size; + size_t data_offset = RoundUp(OFFSETOF_MEMBER(Array, first_element_), component_size); + DCHECK_EQ(RoundUp(data_offset, component_size), data_offset) + << "Array data offset isn't aligned with component size"; + return MemberOffset(data_offset); +} + template<VerifyObjectFlags kVerifyFlags> inline bool Array::CheckIsValidIndex(int32_t index) { if (UNLIKELY(static_cast<uint32_t>(index) >= |