Chromium Code Reviews| Index: webrtc/base/ipaddress.cc |
| diff --git a/webrtc/base/ipaddress.cc b/webrtc/base/ipaddress.cc |
| index c92f33c74d8baaa9b947da93e7fa1e7099d17982..8696773b8ef7dfc0b09e12fc307311b5ebdaf221 100644 |
| --- a/webrtc/base/ipaddress.cc |
| +++ b/webrtc/base/ipaddress.cc |
| @@ -412,7 +412,7 @@ int CountIPMaskBits(IPAddress mask) { |
| // http://graphics.stanford.edu/~seander/bithacks.html |
| // Counts the trailing 0s in the word. |
| unsigned int zeroes = 32; |
| - word_to_count &= -static_cast<int32_t>(word_to_count); |
| + word_to_count &= ~word_to_count + 1; // Isolate lowest set bit. |
|
torbjorng (webrtc)
2016/03/01 13:26:43
Surely valid code, but perhaps mention (in the com
|
| if (word_to_count) zeroes--; |
| if (word_to_count & 0x0000FFFF) zeroes -= 16; |
| if (word_to_count & 0x00FF00FF) zeroes -= 8; |
| @@ -522,4 +522,4 @@ IPAddress GetAnyIP(int family) { |
| return rtc::IPAddress(); |
| } |
| -} // Namespace rtc |
| +} // namespace rtc |