From 7e70b002c4552347ed1af8c002a0e13f08864f20 Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Wed, 8 Oct 2014 11:47:24 -0700 Subject: Header file clean up. Remove runtime.h from object.h. Move TypeStaticIf to its own header file to avoid bringing utils.h into allocator.h. Move Array::DataOffset into -inl.h as it now has a utils.h dependency. Fix include issues arising from this. Change-Id: I4605b1aa4ff5f8dc15706a0132e15df03c7c8ba0 --- runtime/mirror/array-inl.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'runtime/mirror/array-inl.h') 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 inline bool Array::CheckIsValidIndex(int32_t index) { if (UNLIKELY(static_cast(index) >= -- cgit v1.2.3-59-g8ed1b