Initialize ClassLinker from image
Change-Id: Ibaf47b4181f7c6603a8b37e2eba8fa6509c927ed
diff --git a/src/stringpiece.h b/src/stringpiece.h
index 249b041..1338ed9 100644
--- a/src/stringpiece.h
+++ b/src/stringpiece.h
@@ -200,6 +200,21 @@
extern std::ostream& operator<<(std::ostream& o, const art::StringPiece& piece);
+// BEGIN android-added
+struct StringPieceHash {
+ size_t operator()(const art::StringPiece& string_piece) const {
+ size_t string_size = string_piece.size();
+ const char* string_data = string_piece.data();
+ // this is the java.lang.String hashcode for convenience, not interoperability
+ size_t hash = 0;
+ while (string_size--) {
+ hash = hash * 31 + *string_data++;
+ }
+ return hash;
+ }
+};
+// END android-added
+
} // namespace art
#endif // ART_SRC_STRINGPIECE_H_