Skip to content

Commit 69f67e7

Browse files
Add bitwise operators to declare_binder_enum
Test: atest aidl_integration_test Bug: 393455995 Change-Id: Ie8621848062185fd5c236272f8ee04b21b3f1d10
1 parent 52b4e75 commit 69f67e7

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)