| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PLATFORM_UTILS_WIN_H_ | 5 #ifndef PLATFORM_UTILS_WIN_H_ |
| 6 #define PLATFORM_UTILS_WIN_H_ | 6 #define PLATFORM_UTILS_WIN_H_ |
| 7 | 7 |
| 8 #include <intrin.h> | 8 #include <intrin.h> |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 inline int Utils::CountTrailingZeros(uword x) { | 12 inline int Utils::CountTrailingZeros(uword x) { |
| 13 uword result; | 13 unsigned long result; // NOLINT |
| 14 #if defined(ARCH_IS_32_BIT) | 14 #if defined(ARCH_IS_32_BIT) |
| 15 _BitScanReverse(&result, x); | 15 _BitScanReverse(&result, x); |
| 16 return __builtin_ctzl(x); | |
| 17 #elif defined(ARCH_IS_64_BIT) | 16 #elif defined(ARCH_IS_64_BIT) |
| 18 _BitScanReverse64(&result, x); | 17 _BitScanReverse64(&result, x); |
| 19 #else | 18 #else |
| 20 #error Architecture is not 32-bit or 64-bit. | 19 #error Architecture is not 32-bit or 64-bit. |
| 21 #endif | 20 #endif |
| 22 return static_cast<int>(result); | 21 return static_cast<int>(result); |
| 23 }; | 22 }; |
| 24 | 23 |
| 25 } // namespace dart | 24 } // namespace dart |
| 26 | 25 |
| 27 #endif // PLATFORM_UTILS_WIN_H_ | 26 #endif // PLATFORM_UTILS_WIN_H_ |
| OLD | NEW |