X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2FCpuId.h;h=4a70e1464dca70a664992d421aefeeb26e257d96;hb=9b4749fd47c605c27b6973f317d7c4f3a0e101e9;hp=ab4eb27ff48c763e5834a8250437238f7d342c9c;hpb=ae95c1d54ad1c3da2954673e2eb1ac24ad9d2320;p=folly.git diff --git a/folly/CpuId.h b/folly/CpuId.h index ab4eb27f..4a70e146 100644 --- a/folly/CpuId.h +++ b/folly/CpuId.h @@ -1,5 +1,5 @@ /* - * Copyright 2013 Facebook, Inc. + * Copyright 2014 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ #define FOLLY_CPUID_H_ #include +#include namespace folly { @@ -29,7 +30,14 @@ namespace folly { class CpuId { public: CpuId() { -#if defined(__x86_64__) || defined(__i386__) +#ifdef _MSC_VER + int reg[4]; + + __cpuid((int *)reg, 1); + c_ = reg[2]; + d_ = reg[3]; + +#elif FOLLY_X64 || defined(__i386__) __asm__("cpuid" : "=c"(c_), "=d"(d_) : "a"(1) : "ebx"); #else // On non-Intel, none of these features exist; at least not in the same form