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

Unified Diff: runtime/platform/utils_win.h

Issue 10806078: Improve the performance of bit set searches with a compiler intrinsic. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments 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') | runtime/vm/bit_set.h » ('j') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..adb98ba6b4ca07bbb32a2e84aadae507f671bd76
--- /dev/null
+++ b/runtime/platform/utils_win.h
@@ -0,0 +1,26 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef PLATFORM_UTILS_WIN_H_
+#define PLATFORM_UTILS_WIN_H_
+
+#include <intrin.h>
+
+namespace dart {
+
+inline int Utils::CountTrailingZeros(uint32_t x) {
+ unsigned long result; // NOLINT
+ _BitScanReverse(&result, x);
+ return reinterpret_cast<int>(result);
+};
+
+inline int Utils::CountTrailingZeros(uint64_t x) {
+ unsigned long result; // NOLINT
+ _BitScanReverse64(&result, x);
+ return reinterpret_cast<int>(result);
+};
+
+} // namespace dart
+
+#endif // PLATFORM_UTILS_WIN_H_
« no previous file with comments | « runtime/platform/utils_macos.h ('k') | runtime/vm/bit_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698