refactor: satisfy clippy::manual_bits

This commit is contained in:
Erich Gubler 2024-08-12 12:22:54 +01:00
parent c72bc7b84b
commit b1eb6db8cd
2 changed files with 2 additions and 3 deletions

View File

@ -11,7 +11,7 @@ type IdType = u64;
type ZippedIndex = Index; type ZippedIndex = Index;
type NonZeroId = std::num::NonZeroU64; type NonZeroId = std::num::NonZeroU64;
const INDEX_BITS: usize = std::mem::size_of::<ZippedIndex>() * 8; const INDEX_BITS: usize = ZippedIndex::BITS as usize;
const EPOCH_BITS: usize = INDEX_BITS - BACKEND_BITS; const EPOCH_BITS: usize = INDEX_BITS - BACKEND_BITS;
const BACKEND_BITS: usize = 3; const BACKEND_BITS: usize = 3;
const BACKEND_SHIFT: usize = INDEX_BITS * 2 - BACKEND_BITS; const BACKEND_SHIFT: usize = INDEX_BITS * 2 - BACKEND_BITS;

View File

@ -1,7 +1,6 @@
//! The `ResourceMetadata` type. //! The `ResourceMetadata` type.
use bit_vec::BitVec; use bit_vec::BitVec;
use std::mem;
use wgt::strict_assert; use wgt::strict_assert;
/// A set of resources, holding a `Arc<T>` and epoch for each member. /// A set of resources, holding a `Arc<T>` and epoch for each member.
@ -191,7 +190,7 @@ fn resize_bitvec<B: bit_vec::BitBlock>(vec: &mut BitVec<B>, size: usize) {
/// ///
/// Will skip entire usize's worth of bits if they are all false. /// Will skip entire usize's worth of bits if they are all false.
fn iterate_bitvec_indices(ownership: &BitVec<usize>) -> impl Iterator<Item = usize> + '_ { fn iterate_bitvec_indices(ownership: &BitVec<usize>) -> impl Iterator<Item = usize> + '_ {
const BITS_PER_BLOCK: usize = mem::size_of::<usize>() * 8; const BITS_PER_BLOCK: usize = usize::BITS as usize;
let size = ownership.len(); let size = ownership.len();