comparison 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
comparison
equal deleted inserted replaced
44186:796d05f3fa84 44187:be52b7372ec2
221 /// Retrieve the `i`th half-byte from the prefix. 221 /// Retrieve the `i`th half-byte from the prefix.
222 /// 222 ///
223 /// This is also the `i`th hexadecimal digit in numeric form, 223 /// This is also the `i`th hexadecimal digit in numeric form,
224 /// also called a [nybble](https://en.wikipedia.org/wiki/Nibble). 224 /// also called a [nybble](https://en.wikipedia.org/wiki/Nibble).
225 pub fn get_nybble(&self, i: usize) -> u8 { 225 pub fn get_nybble(&self, i: usize) -> u8 {
226 assert!(i < self.len());
226 get_nybble(self.buf, i) 227 get_nybble(self.buf, i)
227 } 228 }
228 } 229 }
229 230
230 /// A shortcut for full `Node` references 231 /// A shortcut for full `Node` references