Fixed preprocessor conditional for tstring on big endian.

H/T to @cdavoudian for the discovery.

PiperOrigin-RevId: 314429629
Change-Id: If405159e8d75f73af13d59b80ead92185144d5c1
This commit is contained in:
Dero Gharibian 2020-06-02 16:44:29 -07:00 committed by TensorFlower Gardener
parent 397c70b8a2
commit 206dc37a33

View File

@ -145,7 +145,7 @@ extern inline TF_TString_Type TF_TString_GetType(const TF_TString *str) {
// and always byte-swapping on big endian, resulting in a simple 'bswap'+'shr'
// (for architectures that have a bswap op).
static inline size_t TF_TString_ToActualSizeT(size_t size) {
#ifdef TF_TSTRING_LITTLE_ENDIAN
#if TF_TSTRING_LITTLE_ENDIAN
return size >> 2;
#else // TF_TSTRING_LITTLE_ENDIAN
// 0xFF000000 or 0xFF00000000000000 depending on platform
@ -157,7 +157,7 @@ static inline size_t TF_TString_ToActualSizeT(size_t size) {
static inline size_t TF_TString_ToInternalSizeT(size_t size,
TF_TString_Type type) {
#ifdef TF_TSTRING_LITTLE_ENDIAN
#if TF_TSTRING_LITTLE_ENDIAN
return (size << 2) | type;
#else // TF_TSTRING_LITTLE_ENDIAN
// 0xFF000000 or 0xFF00000000000000 depending on platform