diff options
author | 2017-02-14 15:43:22 +0000 | |
---|---|---|
committer | 2017-02-14 15:43:23 +0000 | |
commit | 2d98ba68f13dc219c088a12f369c5778bf398f14 (patch) | |
tree | af94d7fc529953701e1231a8ddc453221c414596 /runtime/mirror/string-inl.h | |
parent | 582fc0501bbdbb538cafdf36aec3e142e390688f (diff) | |
parent | e39f14ff4e0d7c70016874cff24863b912d40bf1 (diff) |
Merge "ARM64: Improve String.equals() intrinsic for const strings."
Diffstat (limited to 'runtime/mirror/string-inl.h')
-rw-r--r-- | runtime/mirror/string-inl.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/mirror/string-inl.h b/runtime/mirror/string-inl.h index 9b8445dc9e..c2407d7772 100644 --- a/runtime/mirror/string-inl.h +++ b/runtime/mirror/string-inl.h @@ -308,7 +308,7 @@ inline int32_t String::GetHashCode() { } template<typename MemoryType> -bool String::AllASCII(const MemoryType* const chars, const int length) { +inline bool String::AllASCII(const MemoryType* chars, const int length) { static_assert(std::is_unsigned<MemoryType>::value, "Expecting unsigned MemoryType"); for (int i = 0; i < length; ++i) { // Valid ASCII characters are in range 1..0x7f. Zero is not considered ASCII @@ -320,6 +320,13 @@ bool String::AllASCII(const MemoryType* const chars, const int length) { return true; } +inline bool String::DexFileStringAllASCII(const char* chars, const int length) { + // For strings from the dex file we just need to check that + // the terminating character is at the right position. + DCHECK_EQ(AllASCII(reinterpret_cast<const uint8_t*>(chars), length), chars[length] == 0); + return chars[length] == 0; +} + } // namespace mirror } // namespace art |