Use T::BITS
instead of size_of::<T> * 8
.
This commit is contained in:
parent
5c30a16fa0
commit
1e2dba1e7c
17 changed files with 44 additions and 64 deletions
|
@ -528,7 +528,7 @@ unsafe impl<#[may_dangle] T, A: AllocRef> Drop for RawVec<T, A> {
|
|||
|
||||
#[inline]
|
||||
fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
|
||||
if mem::size_of::<usize>() < 8 && alloc_size > isize::MAX as usize {
|
||||
if usize::BITS < 64 && alloc_size > isize::MAX as usize {
|
||||
Err(CapacityOverflow)
|
||||
} else {
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue