Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(927)

Unified Diff: runtime/platform/utils_win.h

Issue 10805080: Fix the build breakage on MacOS and Windows caused by CountTrailingZeros. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/platform/utils_macos.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/utils_win.h
diff --git a/runtime/platform/utils_win.h b/runtime/platform/utils_win.h
index adb98ba6b4ca07bbb32a2e84aadae507f671bd76..a7e3d6723b4fb50cc4c5161afb1d6878e770e006 100644
--- a/runtime/platform/utils_win.h
+++ b/runtime/platform/utils_win.h
@@ -9,16 +9,17 @@
namespace dart {
-inline int Utils::CountTrailingZeros(uint32_t x) {
- unsigned long result; // NOLINT
+inline int Utils::CountTrailingZeros(uword x) {
+ uword result;
+#if defined(ARCH_IS_32_BIT)
_BitScanReverse(&result, x);
- return reinterpret_cast<int>(result);
-};
-
-inline int Utils::CountTrailingZeros(uint64_t x) {
- unsigned long result; // NOLINT
+ return __builtin_ctzl(x);
+#elif defined(ARCH_IS_64_BIT)
_BitScanReverse64(&result, x);
- return reinterpret_cast<int>(result);
+#else
+#error Architecture is not 32-bit or 64-bit.
+#endif
+ return static_cast<int>(result);
};
} // namespace dart
« no previous file with comments | « runtime/platform/utils_macos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698