Apply comment suggestions

This commit is contained in:
Sidong-Wei 2020-11-24 22:25:22 -05:00
parent 8c87484fc0
commit 78d22273ad
2 changed files with 4 additions and 2 deletions
tensorflow/lite

View File

@ -38,8 +38,9 @@ constexpr int kOutputTensor = 0;
TfLiteStatus ResizeOutput(TfLiteContext* context, const TfLiteTensor* input,
const TfLiteTensor* axis, TfLiteTensor* output) {
int axis_value;
// Retrive all 8 bytes when axis type is kTfLiteInt64 to avoid data loss.
if (axis->type == kTfLiteInt64) {
axis_value = *GetTensorData<int64_t>(axis);
axis_value = static_cast<int>(*GetTensorData<int64_t>(axis));
} else {
axis_value = *GetTensorData<int>(axis);
}

View File

@ -51,7 +51,8 @@ void ReportError(ErrorReporter* error_reporter, const char* format, ...) {
}
// Returns the int32_t value pointed by ptr.
const uint32_t GetIntPtr(const char* ptr) {
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
return flatbuffers::EndianScalar(*reinterpret_cast<const uint32_t*>(ptr));
#else
return *reinterpret_cast<const uint32_t*>(ptr);