projects
/
nihav.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
codec_support/codecs: add negation for MV
[nihav.git]
/
nihav-codec-support
/
src
/
codecs
/
mod.rs
diff --git
a/nihav-codec-support/src/codecs/mod.rs
b/nihav-codec-support/src/codecs/mod.rs
index 389821eb6c4e1de71642cc44ff18ada1ab4306bc..92dee916db07f818611befffbb83ba400adcf75e 100644
(file)
--- a/
nihav-codec-support/src/codecs/mod.rs
+++ b/
nihav-codec-support/src/codecs/mod.rs
@@
-1,6
+1,6
@@
//! Decoder support functions and definitions.
use std::fmt;
//! Decoder support functions and definitions.
use std::fmt;
-use std::ops::{Add, AddAssign, Sub, SubAssign};
+use std::ops::{Add, AddAssign, Sub, SubAssign
, Neg
};
pub use nihav_core::frame::*;
use std::mem;
pub use nihav_core::frame::*;
use std::mem;
@@
-288,6
+288,13
@@
impl SubAssign for MV {
fn sub_assign(&mut self, other: MV) { self.x -= other.x; self.y -= other.y; }
}
fn sub_assign(&mut self, other: MV) { self.x -= other.x; self.y -= other.y; }
}
+impl Neg for MV {
+ type Output = MV;
+ fn neg(self) -> Self::Output {
+ MV { x: -self.x, y: -self.y }
+ }
+}
+
impl fmt::Display for MV {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{},{}", self.x, self.y)
impl fmt::Display for MV {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{},{}", self.x, self.y)