To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 7bf7a7ed authored by Stefan Schindler's avatar Stefan Schindler
Browse files

Fix the add_assign of ByteUnit

parent ce8c7bd5
......@@ -239,14 +239,18 @@ impl std::ops::AddAssign for ByteUnit {
fn add_assign(&mut self, other: Self) {
match self {
&mut Byte(ref mut me) => match other {
Byte(r) => { *me += r; },
KiloByte(r) => { *me += r * 1024; },
Byte(r) => { *me += r; return },
KiloByte(r) => { *me += r * 1024; return; },
},
&mut KiloByte(ref mut me) => match other {
Byte(r) => *me += r / 1024, // FIXME: Rundungsfehler
KiloByte(r) => *me += r,
Byte(r) => { /* *me += r / 1024; würde zu einem Präzisions führen */ },
KiloByte(r) => { *me += r; return },
},
}
// Change Type of self
let mut v = self.to_byte() + other;
std::mem::swap(self, &mut v);
}
}
impl std::ops::Sub for ByteUnit {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment