diff options
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 |