diff options
Diffstat (limited to 'runtime/utils.h')
| -rw-r--r-- | runtime/utils.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/runtime/utils.h b/runtime/utils.h index 789498ce09..443b0cc398 100644 --- a/runtime/utils.h +++ b/runtime/utils.h @@ -67,12 +67,6 @@ static inline uint32_t PointerToLowMemUInt32(const void* p) { return intp & 0xFFFFFFFFU; } -std::string PrintableChar(uint16_t ch); - -// Returns an ASCII string corresponding to the given UTF-8 string. -// Java escapes are used for non-ASCII characters. -std::string PrintableString(const char* utf8); - // Used to implement PrettyClass, PrettyField, PrettyMethod, and PrettyTypeOf, // one of which is probably more useful to you. // Returns a human-readable equivalent of 'descriptor'. So "I" would be "int", @@ -82,10 +76,6 @@ void AppendPrettyDescriptor(const char* descriptor, std::string* result); std::string PrettyDescriptor(const char* descriptor); std::string PrettyDescriptor(Primitive::Type type); -// Returns a human-readable version of the Java part of the access flags, e.g., "private static " -// (note the trailing whitespace). -std::string PrettyJavaAccessFlags(uint32_t access_flags); - // Returns a human-readable size string such as "1MB". std::string PrettySize(int64_t size_in_bytes); @@ -289,6 +279,20 @@ static inline void CheckedCall(const Func& function, const char* what, Args... a } } +// Hash bytes using a relatively fast hash. +static inline size_t HashBytes(const uint8_t* data, size_t len) { + size_t hash = 0x811c9dc5; + for (uint32_t i = 0; i < len; ++i) { + hash = (hash * 16777619) ^ data[i]; + } + hash += hash << 13; + hash ^= hash >> 7; + hash += hash << 3; + hash ^= hash >> 17; + hash += hash << 5; + return hash; +} + } // namespace art #endif // ART_RUNTIME_UTILS_H_ |