|
3 | 3 | #![allow(clippy::let_unit_value)]
|
4 | 4 |
|
5 | 5 | use crate::primitive::sync::atomic::{self, AtomicBool};
|
6 |
| -use array_macro::array; |
7 | 6 | use core::cell::UnsafeCell;
|
8 | 7 | use core::fmt;
|
9 | 8 | use core::mem;
|
@@ -684,8 +683,13 @@ fn lock(addr: usize) -> &'static SeqLock {
|
684 | 683 | // stored at addresses that are multiples of 3. It'd be too bad if `LEN` was divisible by 3.
|
685 | 684 | // In order to protect from such cases, we simply choose a large prime number for `LEN`.
|
686 | 685 | const LEN: usize = 97;
|
687 |
| - |
688 |
| - static LOCKS: [SeqLock; LEN] = array![_ => SeqLock::new(); LEN]; |
| 686 | + const L: SeqLock = SeqLock::new(); |
| 687 | + static LOCKS: [SeqLock; LEN] = [ |
| 688 | + 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, |
| 689 | + 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, |
| 690 | + 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, |
| 691 | + L, L, L, L, L, L, L, |
| 692 | + ]; |
689 | 693 |
|
690 | 694 | // If the modulus is a constant number, the compiler will use crazy math to transform this into
|
691 | 695 | // a sequence of cheap arithmetic operations rather than using the slow modulo instruction.
|
|
0 commit comments