aboutsummaryrefslogtreecommitdiff
path: root/gd/common
diff options
context:
space:
mode:
authorJack He <siyuanh@google.com>2019-08-20 10:59:18 -0700
committerJack He <siyuanh@google.com>2019-08-20 22:08:15 -0700
commitb3e44e2140f0e7a5c01ac92694128b78ea1a231c (patch)
tree2fffbe915e88f44e97714155f548323f49ca86c6 /gd/common
parentb93e57cda20865e46010d46e1e570b8daf29deae (diff)
downloadbt-b3e44e2140f0e7a5c01ac92694128b78ea1a231c.tar.gz
Address: Add static assert to make sure kLength is <= sizeof(uint64_t)
Test: make Change-Id: I16432253233a504c47c302433b743f421ded02b9
Diffstat (limited to 'gd/common')
-rw-r--r--gd/common/address.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/gd/common/address.h b/gd/common/address.h
index 58d331fb4..f62464c3c 100644
--- a/gd/common/address.h
+++ b/gd/common/address.h
@@ -84,6 +84,7 @@ namespace std {
template <>
struct hash<bluetooth::common::Address> {
std::size_t operator()(const bluetooth::common::Address& val) const {
+ static_assert(sizeof(uint64_t) >= bluetooth::common::Address::kLength);
uint64_t int_addr = 0;
memcpy(reinterpret_cast<uint8_t*>(&int_addr), val.address, bluetooth::common::Address::kLength);
return std::hash<uint64_t>{}(int_addr);