mirror of
https://github.com/google/sentencepiece.git
synced 2024-09-19 06:40:00 +03:00
fixes IS_BIGENDIAN macro places
This commit is contained in:
parent
e58bb684d0
commit
2b0713791a
14
src/common.h
14
src/common.h
@ -69,6 +69,20 @@ char (&ArraySizeHelper(const T (&array)[N]))[N];
|
||||
|
||||
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
|
||||
|
||||
#if defined(_FREEBSD)
|
||||
#include <sys/endian.h>
|
||||
#endif
|
||||
#if !defined(__APPLE__) && !defined(_WIN32) && !defined(_FREEBSD)
|
||||
#include <endian.h>
|
||||
#if BYTE_ORDER == __BIG_ENDIAN
|
||||
#define IS_BIG_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef IS_BIG_ENDIAN
|
||||
inline uint32 Swap32(uint32 x) { return __builtin_bswap32(x); }
|
||||
#endif
|
||||
|
||||
namespace sentencepiece {
|
||||
#ifdef OS_WIN
|
||||
namespace win32 {
|
||||
|
14
src/util.h
14
src/util.h
@ -36,16 +36,6 @@
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if defined(_FREEBSD)
|
||||
#include <sys/endian.h>
|
||||
#endif
|
||||
#if !defined(__APPLE__) && !defined(_WIN32) && !defined(_FREEBSD)
|
||||
#include <endian.h>
|
||||
#if BYTE_ORDER == __BIG_ENDIAN
|
||||
#define IS_BIG_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace sentencepiece {
|
||||
template <typename T>
|
||||
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
|
||||
@ -411,10 +401,6 @@ class StatusBuilder {
|
||||
#define CHECK_GT_OR_RETURN(a, b) CHECK_OR_RETURN((a) > (b))
|
||||
#define CHECK_LT_OR_RETURN(a, b) CHECK_OR_RETURN((a) < (b))
|
||||
|
||||
#ifdef IS_BIG_ENDIAN
|
||||
inline uint32 Swap32(uint32 x) { return __builtin_bswap32(x); }
|
||||
#endif
|
||||
|
||||
} // namespace util
|
||||
|
||||
namespace port {
|
||||
|
Loading…
Reference in New Issue
Block a user