rust-node: avoid meaningless read at the end of odd prefix
This should be heavily factored out by the CPU branch predictor
anyway.
Differential Revision: https://phab.mercurial-scm.org/D8019
--- a/rust/hg-core/src/revlog/node.rs Fri Dec 27 16:06:54 2019 +0100
+++ b/rust/hg-core/src/revlog/node.rs Mon Jan 27 20:28:47 2020 +0100
@@ -223,6 +223,7 @@
/// This is also the `i`th hexadecimal digit in numeric form,
/// also called a [nybble](https://en.wikipedia.org/wiki/Nibble).
pub fn get_nybble(&self, i: usize) -> u8 {
+ assert!(i < self.len());
get_nybble(self.buf, i)
}
}