Skip to content

Commit 1c7cd0c

Browse files
committed
fix
1 parent a2ca289 commit 1c7cd0c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

clickhouse/columns/ip6.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@
55
#include <stdexcept>
66

77
bool operator==(const in6_addr& l, const in6_addr& r) {
8-
return l.__u6_addr.__u6_addr32[0] == r.__u6_addr.__u6_addr32[0]
9-
&& l.__u6_addr.__u6_addr32[1] == r.__u6_addr.__u6_addr32[1]
10-
&& l.__u6_addr.__u6_addr32[2] == r.__u6_addr.__u6_addr32[2]
11-
&& l.__u6_addr.__u6_addr32[3] == r.__u6_addr.__u6_addr32[3];
8+
const uint64_t* const l_array = reinterpret_cast<const uint64_t*>(&l);
9+
const uint64_t* const r_array = reinterpret_cast<const uint64_t*>(&r);
10+
return l_array[0] == r_array[0] && l_array[1] == r_array[1];
1211
}
1312

1413
bool operator!=(const in6_addr& l, const in6_addr& r) {
15-
return l.__u6_addr.__u6_addr32[0] != r.__u6_addr.__u6_addr32[0]
16-
|| l.__u6_addr.__u6_addr32[1] != r.__u6_addr.__u6_addr32[1]
17-
|| l.__u6_addr.__u6_addr32[2] != r.__u6_addr.__u6_addr32[2]
18-
|| l.__u6_addr.__u6_addr32[3] != r.__u6_addr.__u6_addr32[3];
14+
const uint64_t* const l_array = reinterpret_cast<const uint64_t*>(&l);
15+
const uint64_t* const r_array = reinterpret_cast<const uint64_t*>(&r);
16+
return l_array[0] != r_array[0] || l_array[1] != r_array[1];
1917
}
2018

2119
namespace clickhouse {

0 commit comments

Comments
 (0)