projects
/
nihav.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
replace vec.truncate(0) with vec.clear()
[nihav.git]
/
nihav-codec-support
/
src
/
data
/
mod.rs
diff --git
a/nihav-codec-support/src/data/mod.rs
b/nihav-codec-support/src/data/mod.rs
index b8980f2d9b5180d5c06916650cff93200f7e789e..eba029939a3a46643dea1fd3a650a7eccf1f3927 100644
(file)
--- a/
nihav-codec-support/src/data/mod.rs
+++ b/
nihav-codec-support/src/data/mod.rs
@@
-44,17
+44,17
@@
impl<T:Copy> GenericCache<T> {
stride,
height,
xpos: 0,
stride,
height,
xpos: 0,
- data: Vec::with_capacity((height + 1) * stride),
+ data: Vec::with_capacity((height + 1) * stride
+ 1
),
default,
};
ret.reset();
ret
}
/// Reports the total amount of elements stored.
default,
};
ret.reset();
ret
}
/// Reports the total amount of elements stored.
- pub fn full_size(&self) -> usize { self.stride * (self.height + 1) }
+ pub fn full_size(&self) -> usize { self.stride * (self.height + 1)
+ 1
}
/// Resets the cache state.
pub fn reset(&mut self) {
/// Resets the cache state.
pub fn reset(&mut self) {
- self.data.
truncate(0
);
+ self.data.
clear(
);
let size = self.full_size();
self.data.resize(size, self.default);
self.xpos = self.stride + 1;
let size = self.full_size();
self.data.resize(size, self.default);
self.xpos = self.stride + 1;