From 8b1cd3753b184341e837b30383832645135d3d73 Mon Sep 17 00:00:00 2001
From: Cory Fields <cory-nospam-@coryfields.com>
Date: Mon, 31 Jul 2017 11:58:25 -0400
Subject: [PATCH] fixup define checks. Cleans up some oopses from #5.

- use "#if defined(foo)" rather than "#if foo"
- Use the same guard for the cpuid header and the function
---
 port/port_posix.cc | 4 ++--
 port/port_win.cc   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/port/port_posix.cc b/port/port_posix.cc
index 6e55cca8bcb2a4..ec39e921957f65 100644
--- a/port/port_posix.cc
+++ b/port/port_posix.cc
@@ -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
 
@@ -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;
diff --git a/port/port_win.cc b/port/port_win.cc
index 62e19d41038831..1be9e8d5b0b41e 100644
--- a/port/port_win.cc
+++ b/port/port_win.cc
@@ -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;