Support folly::assume under MSVC
authorChristopher Dykes <cdykes@fb.com>
Tue, 24 May 2016 00:30:29 +0000 (17:30 -0700)
committerFacebook Github Bot 2 <facebook-github-bot-2-bot@fb.com>
Tue, 24 May 2016 00:38:32 +0000 (17:38 -0700)
Summary: Actually __assume when we assume.

Reviewed By: meyering

Differential Revision: D3336033

fbshipit-source-id: 6c931e9f832dd1d861d03e3ad8e308f612522401

folly/Assume.h

index 7c50a679f0fa6111273ee259fa1873c3c7ee8b32..8f8074333c2db293b4227372fb8976a0037b9130 100644 (file)
@@ -38,6 +38,8 @@ FOLLY_ALWAYS_INLINE void assume(bool cond) {
   __builtin_assume(cond);
 #elif defined(__GNUC__)
   if (!cond) { __builtin_unreachable(); }
+#elif defined(_MSC_VER)
+  __assume(cond);
 #else
   // Do nothing.
 #endif