Skip to content

Commit

Permalink
Merge #722
Browse files Browse the repository at this point in the history
722: Simplify `AtomicCell` `LOCKS` r=taiki-e a=Daniel-Bloom-dfinity



Co-authored-by: Daniel.Bloom <daniel.bloom@dfinity.org>
  • Loading branch information
bors[bot] and Daniel-Bloom-dfinity authored Jul 25, 2021
2 parents f2cae5c + cb4db4c commit 2653a6c
Showing 1 changed file with 6 additions and 98 deletions.
104 changes: 6 additions & 98 deletions crossbeam-utils/src/atomic/atomic_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,105 +683,13 @@ fn lock(addr: usize) -> &'static SeqLock {
// stored at addresses that are multiples of 3. It'd be too bad if `LEN` was divisible by 3.
// In order to protect from such cases, we simply choose a large prime number for `LEN`.
const LEN: usize = 97;

#[allow(clippy::declare_interior_mutable_const)]
const L: SeqLock = SeqLock::new();
static LOCKS: [SeqLock; LEN] = [
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
SeqLock::new(),
L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
L, L, L, L, L, L, L,
];

// If the modulus is a constant number, the compiler will use crazy math to transform this into
Expand Down

0 comments on commit 2653a6c

Please sign in to comment.