diff options
Diffstat (limited to 'src/google')
-rw-r--r-- | src/google/protobuf/stubs/atomicops.h | 35 | ||||
-rw-r--r-- | src/google/protobuf/stubs/port.h | 7 |
2 files changed, 19 insertions, 23 deletions
diff --git a/src/google/protobuf/stubs/atomicops.h b/src/google/protobuf/stubs/atomicops.h index 75aee306..64c838fb 100644 --- a/src/google/protobuf/stubs/atomicops.h +++ b/src/google/protobuf/stubs/atomicops.h @@ -63,28 +63,21 @@ namespace google { namespace protobuf { namespace internal { -#if defined(GOOGLE_PROTOBUF_ARCH_POWER) -#if defined(_LP64) || defined(__LP64__) -typedef int32 Atomic32; -typedef intptr_t Atomic64; +#ifdef GOOGLE_PROTOBUF_ARCH_32_BIT + typedef intptr_t Atomic32; + typedef int64 Atomic64; #else -typedef intptr_t Atomic32; -typedef int64 Atomic64; -#endif -#else -typedef int32 Atomic32; -#ifdef GOOGLE_PROTOBUF_ARCH_64_BIT -// We need to be able to go between Atomic64 and AtomicWord implicitly. This -// means Atomic64 and AtomicWord should be the same type on 64-bit. -#if defined(__ILP32__) || defined(GOOGLE_PROTOBUF_OS_NACL) -// NaCl's intptr_t is not actually 64-bits on 64-bit! -// http://code.google.com/p/nativeclient/issues/detail?id=1162 -// sparcv9's pointer type is 32bits -typedef int64 Atomic64; -#else -typedef intptr_t Atomic64; -#endif -#endif + typedef int32 Atomic32; + // We need to be able to go between Atomic64 and AtomicWord implicitly. This + // means Atomic64 and AtomicWord should be the same type on 64-bit. + #if defined(__ILP32__) || defined(GOOGLE_PROTOBUF_OS_NACL) + // NaCl's intptr_t is not actually 64-bits on 64-bit! + // http://code.google.com/p/nativeclient/issues/detail?id=1162 + // sparcv9's pointer type is 32bits + typedef int64 Atomic64; + #else + typedef intptr_t Atomic64; + #endif #endif // Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h index dbc29861..0f304c6b 100644 --- a/src/google/protobuf/stubs/port.h +++ b/src/google/protobuf/stubs/port.h @@ -256,8 +256,11 @@ static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF); # define GOOGLE_PROTOBUF_USE_UNALIGNED 0 #else // x86 and x86-64 can perform unaligned loads/stores directly. -# define GOOGLE_PROTOBUF_USE_UNALIGNED defined(_M_X64) || \ - defined(__x86_64__) || defined(_M_IX86) || defined(__i386__) +# if defined(_M_X64) || defined(__x86_64__) || defined(_M_IX86) || defined(__i386__) +# define GOOGLE_PROTOBUF_USE_UNALIGNED 1 +# else +# define GOOGLE_PROTOBUF_USE_UNALIGNED 0 +# endif #endif #if GOOGLE_PROTOBUF_USE_UNALIGNED |