# HG changeset patch # User Georges Racinet # Date 1580153327 -3600 # Node ID be52b7372ec263d59cfe8af8a496f04f3d407b87 # Parent 796d05f3fa84741e42fa00cae53fc9ad5ffc613d 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 diff -r 796d05f3fa84 -r be52b7372ec2 rust/hg-core/src/revlog/node.rs --- 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) } }