Skip to content

Commit

Permalink
Convert MAXIMUM_ZST_CAPACITY to be calculated in a
Browse files Browse the repository at this point in the history
const instead of multiple target_pointer_width checks.
  • Loading branch information
moonheart08 committed Sep 8, 2020
1 parent 8383257 commit c3c84ad
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions library/alloc/src/collections/vec_deque.rs
Expand Up @@ -32,12 +32,8 @@ mod tests;

const INITIAL_CAPACITY: usize = 7; // 2^3 - 1
const MINIMUM_CAPACITY: usize = 1; // 2 - 1
#[cfg(target_pointer_width = "16")]
const MAXIMUM_ZST_CAPACITY: usize = 1 << (16 - 1); // Largest possible power of two
#[cfg(target_pointer_width = "32")]
const MAXIMUM_ZST_CAPACITY: usize = 1 << (32 - 1); // Largest possible power of two
#[cfg(target_pointer_width = "64")]
const MAXIMUM_ZST_CAPACITY: usize = 1 << (64 - 1); // Largest possible power of two

const MAXIMUM_ZST_CAPACITY: usize = 1 << ((core::mem::size_of::<usize>() << 3) - 1); // Largest possible power of two

/// A double-ended queue implemented with a growable ring buffer.
///
Expand Down

0 comments on commit c3c84ad

Please sign in to comment.