|
|
|
@ -14,6 +14,8 @@ |
|
|
|
|
|
|
|
|
|
#include <cstdint> |
|
|
|
|
|
|
|
|
|
#include "absl/base/config.h" |
|
|
|
|
|
|
|
|
|
// Must be included last.
|
|
|
|
|
#include "google/protobuf/port_def.inc" |
|
|
|
|
|
|
|
|
@ -22,8 +24,8 @@ namespace protobuf { |
|
|
|
|
namespace internal { |
|
|
|
|
|
|
|
|
|
inline uint64_t BSwap64(uint64_t host_int) { |
|
|
|
|
#if defined(PROTOBUF_BUILTIN_BSWAP64) |
|
|
|
|
return PROTOBUF_BUILTIN_BSWAP64(host_int); |
|
|
|
|
#if defined(__GNUC__) || ABSL_HAVE_BUILTIN(__builtin_bswap64) |
|
|
|
|
return __builtin_bswap64(host_int); |
|
|
|
|
#elif defined(_MSC_VER) |
|
|
|
|
return _byteswap_uint64(host_int); |
|
|
|
|
#else |
|
|
|
@ -39,8 +41,8 @@ inline uint64_t BSwap64(uint64_t host_int) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline uint32_t BSwap32(uint32_t host_int) { |
|
|
|
|
#if defined(PROTOBUF_BUILTIN_BSWAP32) |
|
|
|
|
return PROTOBUF_BUILTIN_BSWAP32(host_int); |
|
|
|
|
#if defined(__GNUC__) || ABSL_HAVE_BUILTIN(__builtin_bswap32) |
|
|
|
|
return __builtin_bswap32(host_int); |
|
|
|
|
#elif defined(_MSC_VER) |
|
|
|
|
return _byteswap_ulong(host_int); |
|
|
|
|
#else |
|
|
|
@ -52,8 +54,8 @@ inline uint32_t BSwap32(uint32_t host_int) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline uint16_t BSwap16(uint16_t host_int) { |
|
|
|
|
#if defined(PROTOBUF_BUILTIN_BSWAP16) |
|
|
|
|
return PROTOBUF_BUILTIN_BSWAP16(host_int); |
|
|
|
|
#if defined(__GNUC__) || ABSL_HAVE_BUILTIN(__builtin_bswap16) |
|
|
|
|
return __builtin_bswap16(host_int); |
|
|
|
|
#elif defined(_MSC_VER) |
|
|
|
|
return _byteswap_ushort(host_int); |
|
|
|
|
#else |
|
|
|
|