Mercurial > hg
diff rust/hg-core/src/revlog/node.rs @ 44187:be52b7372ec2
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
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Mon, 27 Jan 2020 20:28:47 +0100 |
parents | e52401a95b94 |
children | 5ac1eecc9c64 |
line wrap: on
line diff
--- 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) } }