Reviewers: ,

Message:
Committed patchset #1 manually as 23123 (tree was closed).

Description:
Fix MSVC build.

And while we are at it, use the stupid MSVC compiler intrinsics.

TEST=base-unittests/BitTest
[email protected]

Committed: https://code.google.com/p/v8/source/detail?r=23123

Please review this at https://codereview.chromium.org/473773003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+24, -1 lines):
  M src/base/bits.h
  M src/base/win32-headers.h


Index: src/base/bits.h
diff --git a/src/base/bits.h b/src/base/bits.h
index e16eed1b67c9da5c45cec66892da4ed33852c7ad..2cfce1edc2be934a30bc0965cf20c32119c9f871 100644
--- a/src/base/bits.h
+++ b/src/base/bits.h
@@ -6,22 +6,43 @@
 #define V8_BASE_BITS_H_

 #include "include/v8stdint.h"
+#if V8_OS_WIN32
+#include "src/base/win32-headers.h"
+#endif

 namespace v8 {
 namespace base {
 namespace bits {

+#if V8_CC_MSVC
+
+#pragma intrinsic(_rotr)
+#pragma intrinsic(_rotr64)
+
+inline uint32_t RotateRight32(uint32_t value, uint32_t shift) {
+  return _rotr(value, shift);
+}
+
+
+inline uint64_t RotateRight64(uint64_t value, uint32_t shift) {
+  return _rotr64(value, shift);
+}
+
+#else  // V8_CC_MSVC
+
 inline uint32_t RotateRight32(uint32_t value, uint32_t shift) {
   if (shift == 0) return value;
   return (value >> shift) | (value << (32 - shift));
 }


-inline uint64_t RotateRight64(uint64_t value, uint64_t shift) {
+inline uint64_t RotateRight64(uint64_t value, uint32_t shift) {
   if (shift == 0) return value;
   return (value >> shift) | (value << (64 - shift));
 }

+#endif  // V8_CC_MSVC
+
 }  // namespace bits
 }  // namespace base
 }  // namespace v8
Index: src/base/win32-headers.h
diff --git a/src/base/win32-headers.h b/src/base/win32-headers.h
index e6b88bb2ff10bc56b2efc021a8407dee37cdd8af..2d94abd41708d635367f9012a347f451e96b740b 100644
--- a/src/base/win32-headers.h
+++ b/src/base/win32-headers.h
@@ -75,5 +75,7 @@
 #undef GetObject
 #undef CreateSemaphore
 #undef Yield
+#undef RotateRight32
+#undef RotateRight64

 #endif  // V8_BASE_WIN32_HEADERS_H_


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to