1
Fork 0

Use T::BITS instead of size_of::<T> * 8.

This commit is contained in:
Mara Bos 2020-09-08 21:39:13 +02:00
parent 5c30a16fa0
commit 1e2dba1e7c
17 changed files with 44 additions and 64 deletions

View file

@ -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(())