| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_QUIC_UINT128_H_ | |
| 6 #define NET_QUIC_UINT128_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/logging.h" | |
| 10 | |
| 11 namespace net { | |
| 12 | |
| 13 struct uint128 { | |
| 14 uint128() {} | |
| 15 uint128(uint64 hi, uint64 lo) : hi(hi), lo(lo) {} | |
| 16 uint64 hi; | |
| 17 uint64 lo; | |
| 18 }; | |
| 19 | |
| 20 inline uint128 operator ^(const uint128& lhs, const uint128& rhs) { | |
| 21 return uint128(lhs.hi ^ rhs.hi, lhs.lo ^ rhs.lo); | |
| 22 } | |
| 23 | |
| 24 inline uint128 operator *(const uint128& lhs, const uint128& rhs) { | |
| 25 // TODO(rch): correctly implement uint128 multiplication. | |
| 26 return lhs ^ rhs; | |
| 27 } | |
| 28 | |
| 29 inline bool operator ==(const uint128& lhs, const uint128& rhs) { | |
| 30 return lhs.hi == rhs.hi && lhs.lo == rhs.lo; | |
| 31 } | |
| 32 | |
| 33 inline bool operator !=(const uint128& lhs, const uint128& rhs) { | |
| 34 return !(lhs == rhs); | |
| 35 } | |
| 36 | |
| 37 } // namespace net | |
| 38 | |
| 39 #endif // NET_QUIC_UINT128_H_ | |
| OLD | NEW |