OSDN Git Service

Remove dependency on base::Hash
authorChristopher Wiley <wiley@google.com>
Fri, 18 Dec 2015 23:57:36 +0000 (15:57 -0800)
committerChristopher Wiley <wiley@google.com>
Fri, 18 Dec 2015 23:57:36 +0000 (15:57 -0800)
This function is changing to just use std::hash anyway.  This is
slightly less efficient because of the copies, but doing it inline
makes the cost more explicit to bluetooth authors.

Bug: 26253162
Change-Id: I940ea8ce8aa27808cef8a8b9398a7756db3b5ca3
Test: Compiles

service/common/bluetooth/uuid.h

index ec89f1e..569687b 100644 (file)
@@ -19,7 +19,8 @@
 #include <array>
 #include <string>
 
-#include <base/hash.h>
+// TODO: Find places that break include what you use and remove this.
+#include <base/logging.h>
 #include <hardware/bluetooth.h>
 
 namespace bluetooth {
@@ -101,9 +102,8 @@ template<>
 struct hash<bluetooth::UUID> {
   std::size_t operator()(const bluetooth::UUID& key) const {
     const auto& uuid_bytes = key.GetFullBigEndian();
-
-    return base::Hash(reinterpret_cast<const char*>(uuid_bytes.data()),
-                      uuid_bytes.size());
+    std::hash<std::string> hash_fn;
+    return hash_fn(std::string((char *)uuid_bytes.data(), uuid_bytes.size()));
   }
 };