Chromium Code Reviews| 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 LOG(INFO) << "rhs: " << rhs.hi << " " << rhs.lo; | |
|
jar (doing other things)
2012/10/14 23:04:38
nit: DLOG
Ryan Hamilton
2012/10/15 21:22:08
Removed.
| |
| 31 LOG(INFO) << "lhs: " << lhs.hi << " " << lhs.lo; | |
| 32 return lhs.hi == rhs.hi && lhs.lo == rhs.lo; | |
| 33 } | |
| 34 | |
| 35 inline bool operator !=(const uint128& lhs, const uint128& rhs) { | |
| 36 LOG(INFO) << "rhs: " << rhs.hi << " " << rhs.lo; | |
| 37 LOG(INFO) << "lhs: " << lhs.hi << " " << lhs.lo; | |
| 38 return !(lhs == rhs); | |
| 39 } | |
| 40 | |
| 41 } // namespace net | |
| 42 | |
| 43 #endif // NET_QUIC_UINT128_H_ | |
| OLD | NEW |