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

Unified Diff: src/compiler-intrinsics.h

Issue 7277038: make gc branch compile on Win32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Addressed review comments Created 9 years, 6 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 | « no previous file | src/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler-intrinsics.h
diff --git a/src/compiler-intrinsics.h b/src/compiler-intrinsics.h
index bce5d56e25ef91a2b8af5dcf6b68e0596548609e..79ddac8720664af9986e441c177068955e7ddd04 100644
--- a/src/compiler-intrinsics.h
+++ b/src/compiler-intrinsics.h
@@ -50,6 +50,24 @@ int CompilerIntrinsics::CountTrailingZeros(uint32_t value) {
int CompilerIntrinsics::CountLeadingZeros(uint32_t value) {
return __builtin_clz(value);
}
+
+#elif defined(_MSC_VER)
+
+#pragma intrinsic(_BitScanForward)
+#pragma intrinsic(_BitScanReverse)
+
+int CompilerIntrinsics::CountTrailingZeros(uint32_t value) {
+ unsigned long result;
+ _BitScanForward(&result, static_cast<long>(value));
+ return static_cast<int>(result);
+}
+
+int CompilerIntrinsics::CountLeadingZeros(uint32_t value) {
+ unsigned long result;
+ _BitScanReverse(&result, static_cast<long>(value));
+ return 31 - static_cast<int>(result);
+}
+
#else
#error Unsupported compiler
#endif
« no previous file with comments | « no previous file | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698