diff --git a/src/sdl2/flag.rs b/src/sdl2/flag.rs index 485b0a36..a2f2c292 100644 --- a/src/sdl2/flag.rs +++ b/src/sdl2/flag.rs @@ -63,6 +63,12 @@ macro_rules! flag_type( } } + impl ::std::ops::Not<$typename> for $typename { + fn not(&self) -> $typename { + $typename { bits: !self.bits } + } + } + impl ::std::ops::BitAnd<$typename, $typename> for $typename { fn bitand(&self, rhs: &$typename) -> $typename { $typename { bits: self.bits & rhs.bits } @@ -81,6 +87,18 @@ macro_rules! flag_type( } } + impl ::std::ops::Shl for $typename { + fn shl(&self, rhs: &u32) -> $typename { + $typename { bits: self.bits << *rhs } + } + } + + impl ::std::ops::Shr for $typename { + fn shr(&self, rhs: &u32) -> $typename { + $typename { bits: self.bits >> *rhs } + } + } + $( pub static $name: $typename = $typename { bits: $value }; )+