Fully inline BytesMut::new (#493)

This commit is contained in:
Noah
2021-04-11 05:49:33 +09:00
committed by GitHub
parent b9eade12a5
commit 9c770188fd
+2
View File
@@ -1250,6 +1250,7 @@ impl Shared {
}
}
#[inline]
fn original_capacity_to_repr(cap: usize) -> usize {
let width = PTR_WIDTH - ((cap >> MIN_ORIGINAL_CAPACITY_WIDTH).leading_zeros() as usize);
cmp::min(
@@ -1476,6 +1477,7 @@ impl PartialEq<Bytes> for BytesMut {
}
}
#[inline]
fn vptr(ptr: *mut u8) -> NonNull<u8> {
if cfg!(debug_assertions) {
NonNull::new(ptr).expect("Vec pointer should be non-null")