aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi Kong <yikong@google.com>2022-03-15 07:02:14 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-15 07:02:14 +0000
commit59ab09a93f1ed0b47542f088ae33adbd1db8d1e8 (patch)
treecd151a070655a67c7a532721bdb95e2801179667
parenta90c8148010cdc1ab59c656d8f653590baf609e1 (diff)
parentf1ce4bab25ba1f7f85d890c0d48e7cf17a662883 (diff)
downloadaidl-59ab09a93f1ed0b47542f088ae33adbd1db8d1e8.tar.gz
Fix int-in-bool-context warning am: 7a83f40120 am: 80bd0e9569 am: f1ce4bab25
Original change: https://android-review.googlesource.com/c/platform/system/tools/aidl/+/2001930 Change-Id: I421cc056d907ca69a2d8273f36225b147faee91c
-rw-r--r--aidl_const_expressions.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/aidl_const_expressions.cpp b/aidl_const_expressions.cpp
index 0288a603..afab3a21 100644
--- a/aidl_const_expressions.cpp
+++ b/aidl_const_expressions.cpp
@@ -89,14 +89,14 @@ class OverflowGuard {
mOverflowed = true;
return 0;
}
- return mValue / o;
+ return static_cast<T>(mValue / o);
}
T operator%(T o) {
if (o == 0 || (isMin() && o == -1)) {
mOverflowed = true;
return 0;
}
- return mValue % o;
+ return static_cast<T>(mValue % o);
}
T operator|(T o) { return mValue | o; }
T operator^(T o) { return mValue ^ o; }
@@ -112,14 +112,14 @@ class OverflowGuard {
mOverflowed = true;
return 0;
}
- return mValue >> o;
+ return static_cast<T>(mValue >> o);
}
T operator<<(T o) {
if (o < 0 || mValue < 0 || o > CLZ(mValue) || o >= static_cast<T>(sizeof(T) * 8)) {
mOverflowed = true;
return 0;
}
- return mValue << o;
+ return static_cast<T>(mValue << o);
}
T operator||(T o) { return mValue || o; }
T operator&&(T o) { return mValue && o; }