提交 a5ffcf6d 编写于 作者: N Nicholas Nethercote

Inline `NodeIndex` methods.

Because they are small and hot.
上级 f46d0213
......@@ -17,11 +17,13 @@ pub struct NodeIndex {
}
impl NodeIndex {
#[inline]
pub fn new(value: usize) -> NodeIndex {
assert!(value < (u32::MAX as usize));
NodeIndex { index: NonZeroU32::new((value as u32) + 1).unwrap() }
}
#[inline]
pub fn get(self) -> usize {
(self.index.get() - 1) as usize
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册