diff options
Diffstat (limited to 'libartbase/base/utils.h')
-rw-r--r-- | libartbase/base/utils.h | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/libartbase/base/utils.h b/libartbase/base/utils.h index 9c7105599c..11472a8017 100644 --- a/libartbase/base/utils.h +++ b/libartbase/base/utils.h @@ -172,30 +172,6 @@ constexpr PointerSize ConvertToPointerSize(T any) { } } -// Returns a type cast pointer if object pointed to is within the provided bounds. -// Otherwise returns nullptr. -template <typename T> -inline static T BoundsCheckedCast(const void* pointer, - const void* lower, - const void* upper) { - const uint8_t* bound_begin = static_cast<const uint8_t*>(lower); - const uint8_t* bound_end = static_cast<const uint8_t*>(upper); - DCHECK(bound_begin <= bound_end); - - T result = reinterpret_cast<T>(pointer); - const uint8_t* begin = static_cast<const uint8_t*>(pointer); - const uint8_t* end = begin + sizeof(*result); - if (begin < bound_begin || end > bound_end || begin > end) { - return nullptr; - } - return result; -} - -template <typename T, size_t size> -constexpr size_t ArrayCount(const T (&)[size]) { - return size; -} - // Return -1 if <, 0 if ==, 1 if >. template <typename T> inline static int32_t Compare(T lhs, T rhs) { |