diff options
Diffstat (limited to 'tensorflow/core/lib')
-rw-r--r-- | tensorflow/core/lib/bfloat16/bfloat16.h | 4 | ||||
-rw-r--r-- | tensorflow/core/lib/gtl/manual_constructor.h | 2 | ||||
-rw-r--r-- | tensorflow/core/lib/strings/stringprintf.cc | 10 | ||||
-rw-r--r-- | tensorflow/core/lib/strings/stringprintf_test.cc | 4 |
4 files changed, 6 insertions, 14 deletions
diff --git a/tensorflow/core/lib/bfloat16/bfloat16.h b/tensorflow/core/lib/bfloat16/bfloat16.h index e7c24387a4..2c0576ff10 100644 --- a/tensorflow/core/lib/bfloat16/bfloat16.h +++ b/tensorflow/core/lib/bfloat16/bfloat16.h @@ -88,15 +88,13 @@ struct bfloat16 { : bfloat16(static_cast<float>(val)) {} B16_DEVICE_FUNC explicit operator float() const { - float result; + float result = 0; uint16_t* q = reinterpret_cast<uint16_t*>(&result); #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ q[0] = value; - q[1] = 0; #else - q[0] = 0; q[1] = value; #endif return result; diff --git a/tensorflow/core/lib/gtl/manual_constructor.h b/tensorflow/core/lib/gtl/manual_constructor.h index 0a76e0962e..0176cdc94d 100644 --- a/tensorflow/core/lib/gtl/manual_constructor.h +++ b/tensorflow/core/lib/gtl/manual_constructor.h @@ -53,7 +53,7 @@ template <int size> struct AlignType<0, size> { typedef char result[size]; }; -#if defined(COMPILER_MSVC) +#if defined(_MSC_VER) #define TF_LIB_GTL_ALIGN_ATTRIBUTE(X) __declspec(align(X)) #define TF_LIB_GTL_ALIGN_OF(T) __alignof(T) #elif defined(COMPILER_GCC3) || __GNUC__ >= 3 || defined(__APPLE__) || \ diff --git a/tensorflow/core/lib/strings/stringprintf.cc b/tensorflow/core/lib/strings/stringprintf.cc index 03eba4c851..bbffa062a9 100644 --- a/tensorflow/core/lib/strings/stringprintf.cc +++ b/tensorflow/core/lib/strings/stringprintf.cc @@ -22,12 +22,6 @@ limitations under the License. namespace tensorflow { namespace strings { -#ifdef COMPILER_MSVC -enum { IS_COMPILER_MSVC = 1 }; -#else -enum { IS_COMPILER_MSVC = 0 }; -#endif - void Appendv(string* dst, const char* format, va_list ap) { // First try with a small fixed size buffer static const int kSpaceLength = 1024; @@ -48,13 +42,13 @@ void Appendv(string* dst, const char* format, va_list ap) { return; } - if (IS_COMPILER_MSVC) { +#ifdef _MSC_VER // Error or MSVC running out of space. MSVC 8.0 and higher // can be asked about space needed with the special idiom below: va_copy(backup_ap, ap); result = vsnprintf(nullptr, 0, format, backup_ap); va_end(backup_ap); - } +#endif if (result < 0) { // Just an error. diff --git a/tensorflow/core/lib/strings/stringprintf_test.cc b/tensorflow/core/lib/strings/stringprintf_test.cc index d61a1a945a..02cf4cbcad 100644 --- a/tensorflow/core/lib/strings/stringprintf_test.cc +++ b/tensorflow/core/lib/strings/stringprintf_test.cc @@ -30,9 +30,9 @@ TEST(PrintfTest, Empty) { TEST(PrintfTest, Misc) { // MSVC does not support $ format specifier. -#if !defined(COMPILER_MSVC) +#if !defined(_MSC_VER) EXPECT_EQ("123hello w", Printf("%3$d%2$s %1$c", 'w', "hello", 123)); -#endif // !COMPILER_MSVC +#endif // !_MSC_VER } TEST(AppendfTest, Empty) { |