Skip to content

Commit 3261c37

Browse files
Merge "Add bitwise operators to declare_binder_enum" into main am: e22a903
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3483232 Change-Id: I50c74486c76aa56688275fe0278bb49c4399c8ba Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2 parents 89a466b + e22a903 commit 3261c37

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

libs/binder/rust/src/binder.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,5 +1201,45 @@ macro_rules! declare_binder_enum {
12011201
Ok(v.map(|v| v.into_iter().map(Self).collect()))
12021202
}
12031203
}
1204+
1205+
impl std::ops::BitOr for $enum {
1206+
type Output = Self;
1207+
fn bitor(self, rhs: Self) -> Self {
1208+
Self(self.0 | rhs.0)
1209+
}
1210+
}
1211+
1212+
impl std::ops::BitOrAssign for $enum {
1213+
fn bitor_assign(&mut self, rhs: Self) {
1214+
self.0 = self.0 | rhs.0;
1215+
}
1216+
}
1217+
1218+
impl std::ops::BitAnd for $enum {
1219+
type Output = Self;
1220+
fn bitand(self, rhs: Self) -> Self {
1221+
Self(self.0 & rhs.0)
1222+
}
1223+
}
1224+
1225+
impl std::ops::BitAndAssign for $enum {
1226+
fn bitand_assign(&mut self, rhs: Self) {
1227+
self.0 = self.0 & rhs.0;
1228+
}
1229+
}
1230+
1231+
impl std::ops::BitXor for $enum {
1232+
type Output = Self;
1233+
fn bitxor(self, rhs: Self) -> Self {
1234+
Self(self.0 ^ rhs.0)
1235+
}
1236+
}
1237+
1238+
impl std::ops::BitXorAssign for $enum {
1239+
fn bitxor_assign(&mut self, rhs: Self) {
1240+
self.0 = self.0 ^ rhs.0;
1241+
}
1242+
}
1243+
12041244
};
12051245
}

0 commit comments

Comments
 (0)