summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ryan Prichard <rprichard@google.com> 2023-10-18 08:29:54 +0000
committer Android Build Cherrypicker Worker <android-build-cherrypicker-worker@google.com> 2023-10-18 08:29:54 +0000
commit18efdb7009cd65011180827c353ccc799ece61d1 (patch)
treefb530da06a3081113c0a694df8c8b8e566c4230d
parent9160050592c5ce8936e875d11c091835d101a62a (diff)
TFLite: Accommodate change in std::span size type
The WIP version of std::span in external/libcxx uses a ptrdiff_t size, but the finalized C++20 std::span uses a size_t size instead. Comparing the size_t size() against a signed integer causes a -Werror,-Wsign-compare build error. Cast the size() expression so that the code compiles with both the old and the new libc++. Bug: 175635923 Test: m MODULES-IN-frameworks-native (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a119a69b066f7bb03d51665a35bef17cecacbe95) Merged-In: I50cc5354b6205b62918157b69df6cf1aa7bad6cc Change-Id: I50cc5354b6205b62918157b69df6cf1aa7bad6cc
-rw-r--r--libs/input/tests/TfLiteMotionPredictor_test.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/libs/input/tests/TfLiteMotionPredictor_test.cpp b/libs/input/tests/TfLiteMotionPredictor_test.cpp
index b5ed9e4430..c3ac0b7cfb 100644
--- a/libs/input/tests/TfLiteMotionPredictor_test.cpp
+++ b/libs/input/tests/TfLiteMotionPredictor_test.cpp
@@ -130,19 +130,19 @@ TEST(TfLiteMotionPredictorTest, ModelInputOutputLength) {
std::unique_ptr<TfLiteMotionPredictorModel> model = TfLiteMotionPredictorModel::create();
ASSERT_GT(model->inputLength(), 0u);
- const int inputLength = model->inputLength();
- ASSERT_EQ(inputLength, model->inputR().size());
- ASSERT_EQ(inputLength, model->inputPhi().size());
- ASSERT_EQ(inputLength, model->inputPressure().size());
- ASSERT_EQ(inputLength, model->inputOrientation().size());
- ASSERT_EQ(inputLength, model->inputTilt().size());
+ const size_t inputLength = model->inputLength();
+ ASSERT_EQ(inputLength, static_cast<size_t>(model->inputR().size()));
+ ASSERT_EQ(inputLength, static_cast<size_t>(model->inputPhi().size()));
+ ASSERT_EQ(inputLength, static_cast<size_t>(model->inputPressure().size()));
+ ASSERT_EQ(inputLength, static_cast<size_t>(model->inputOrientation().size()));
+ ASSERT_EQ(inputLength, static_cast<size_t>(model->inputTilt().size()));
ASSERT_TRUE(model->invoke());
- const int outputLength = model->outputLength();
- ASSERT_EQ(outputLength, model->outputR().size());
- ASSERT_EQ(outputLength, model->outputPhi().size());
- ASSERT_EQ(outputLength, model->outputPressure().size());
+ const size_t outputLength = model->outputLength();
+ ASSERT_EQ(outputLength, static_cast<size_t>(model->outputR().size()));
+ ASSERT_EQ(outputLength, static_cast<size_t>(model->outputPhi().size()));
+ ASSERT_EQ(outputLength, static_cast<size_t>(model->outputPressure().size()));
}
TEST(TfLiteMotionPredictorTest, ModelOutput) {