Fix comparison of integers of different signs

There is a chance of compiling error that the second argument is compiled as "int" while the first one is "unsigned int".
Modify it to "256u" to avoid the potential compiling issue.

Error log (partial):
  ./base/logging.h:592:32: error: comparison of integers of different signs: 'const unsigned int' and 'const int' [-Werror,-Wsign-compare]
  DEFINE_CHECK_OP_IMPL(Check_LT, < )
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
  ./third_party/tensorflow/core/framework/tensor_shape.h:203:5: note: in instantiation of function template specialization 'Check_LTImpl<unsigned int, int>' requested here
      DCHECK_LT(static_cast<uint32>(dt), 256);
      ^
Change: 132219253
This commit is contained in:
A. Unique TensorFlower 2016-09-04 23:50:57 -08:00 committed by TensorFlower Gardener
parent 130a6b924f
commit f4002dd3cb

View File

@ -200,7 +200,7 @@ class TensorShape {
DataType data_type() const { return static_cast<DataType>(buf()[13]); }
void set_data_type(DataType dt) {
// We only have 8 bits available to store DataType, so make sure it fits
DCHECK_LT(static_cast<uint32>(dt), 256);
DCHECK_LT(static_cast<uint32>(dt), 256u);
buf()[13] = static_cast<uint8>(dt);
}