summaryrefslogtreecommitdiffstats
path: root/runtime/base/array_slice.h
diff options
context:
space:
mode:
authorDan Pasanen <invisiblek@cyanogenmod.org>2016-12-06 19:30:12 -0600
committerDan Pasanen <invisiblek@cyanogenmod.org>2016-12-06 19:32:30 -0600
commit58d4793f8bd82b9daab5bf4fa40d5b68204e71eb (patch)
tree449265cbacbf925f37ed0bd201e68f080e2537cc /runtime/base/array_slice.h
parent20af13267def46b2e5f9a6fa6e94ac69056ef16f (diff)
parent12eb0c532e33ca5d5e98addd580b5ad0a4b71be4 (diff)
downloadandroid_art-cm-14.1_prerebase.tar.gz
android_art-cm-14.1_prerebase.tar.bz2
android_art-cm-14.1_prerebase.zip
Merge tag 'android-7.1.1_r4' into cm-14.1cm-14.1_prerebase
Android 7.1.1 release 4 Change-Id: I14b36666b5a478024f3a9ffab90fd675a6157461
Diffstat (limited to 'runtime/base/array_slice.h')
-rw-r--r--runtime/base/array_slice.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/base/array_slice.h b/runtime/base/array_slice.h
index 19ad302c9d..32283d0a0a 100644
--- a/runtime/base/array_slice.h
+++ b/runtime/base/array_slice.h
@@ -129,6 +129,10 @@ class ArraySlice {
return element_size_;
}
+ bool Contains(const T* element) const {
+ return &AtUnchecked(0) <= element && element < &AtUnchecked(size_);
+ }
+
private:
T& AtUnchecked(size_t index) {
return *reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(array_) + index * element_size_);