Skip to content

Commit

Permalink
Merge #11: fixup define checks. Cleans up some oopses from #5.
Browse files Browse the repository at this point in the history
8b1cd37 fixup define checks. Cleans up some oopses from #5. (Cory Fields)

Pull request description:

  - use "#if defined(foo)" rather than "#if foo"
  - Use the same guard for the cpuid header and the function

Tree-SHA512: fe83895055faf9f5491b9af44262a4dc15d9f56ec8f818e7d66c1002bb6568a90345662828abc7baab0772baa646f9cf13f8ba586ebad5fc3678731b27585885
  • Loading branch information
sipa committed Aug 1, 2017
2 parents 6b1508d + 8b1cd37 commit c521b3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions port/port_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <stdio.h>
#include <string.h>

#if defined(__GNUC__)
#if (defined(__x86_64__) || defined(__i386__)) && defined(__GNUC__)
#include <cpuid.h>
#endif

Expand Down Expand Up @@ -54,7 +54,7 @@ void InitOnce(OnceType* once, void (*initializer)()) {
}

bool HasAcceleratedCRC32C() {
#if (__x86_64__ || __i386__) && defined(__GNUC__)
#if (defined(__x86_64__) || defined(__i386__)) && defined(__GNUC__)
unsigned int eax, ebx, ecx, edx;
__get_cpuid(1, &eax, &ebx, &ecx, &edx);
return (ecx & (1 << 20)) != 0;
Expand Down
2 changes: 1 addition & 1 deletion port/port_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void AtomicPointer::NoBarrier_Store(void* v) {
}

bool HasAcceleratedCRC32C() {
#if (__x86_64__ || __i386__)
#if defined(__x86_64__) || defined(__i386__)
int cpu_info[4];
__cpuid(cpu_info, 1);
return (cpu_info[2] & (1 << 20)) != 0;
Expand Down

0 comments on commit c521b3a

Please sign in to comment.