Mercurial > hg-stable
changeset 44262: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 | 796d05f3fa84 |
children | 1f9e6fbdd3e6 |
files | rust/hg-core/src/revlog/node.rs |
diffstat | 1 files changed, 1 insertions(+), 0 deletions(-) [+] |
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) } }