Skip to content

Commit e3bb00b

Browse files
author
Stjepan Glavina
committed
Turn doc comment into regular comment
1 parent 83c1c4e commit e3bb00b

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

crossbeam-utils/src/atomic/atomic_cell.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -695,28 +695,28 @@ impl Drop for WriteGuard {
695695
#[inline]
696696
#[must_use]
697697
fn lock(addr: usize) -> &'static Lock {
698-
/// The number of locks is a prime number because we want to make sure `addr % LEN` gets
699-
/// dispersed across all locks.
700-
///
701-
/// Note that addresses are always aligned to some power of 2, depending on type `T` in
702-
/// `AtomicCell<T>`. If `LEN` was an even number, then `addr % LEN` would be an even number,
703-
/// too, which means only half of the locks would get utilized!
704-
///
705-
/// It is also possible for addresses to accidentally get aligned to a number that is not a
706-
/// power of 2. Consider this example:
707-
///
708-
/// ```
709-
/// #[repr(C)]
710-
/// struct Foo {
711-
/// a: AtomicCell<u8>,
712-
/// b: u8,
713-
/// c: u8,
714-
/// }
715-
/// ```
716-
///
717-
/// Now, if we have a slice of type `&[Foo]`, it is possible that field `a` in all items gets
718-
/// stored at addresses that are multiples of 3. It'd be too bad if `LEN` was divisible by 3.
719-
/// In order to protect from such cases, we simply choose a large prime number for `LEN`.
698+
// The number of locks is a prime number because we want to make sure `addr % LEN` gets
699+
// dispersed across all locks.
700+
//
701+
// Note that addresses are always aligned to some power of 2, depending on type `T` in
702+
// `AtomicCell<T>`. If `LEN` was an even number, then `addr % LEN` would be an even number,
703+
// too, which means only half of the locks would get utilized!
704+
//
705+
// It is also possible for addresses to accidentally get aligned to a number that is not a
706+
// power of 2. Consider this example:
707+
//
708+
// ```
709+
// #[repr(C)]
710+
// struct Foo {
711+
// a: AtomicCell<u8>,
712+
// b: u8,
713+
// c: u8,
714+
// }
715+
// ```
716+
//
717+
// Now, if we have a slice of type `&[Foo]`, it is possible that field `a` in all items gets
718+
// stored at addresses that are multiples of 3. It'd be too bad if `LEN` was divisible by 3.
719+
// In order to protect from such cases, we simply choose a large prime number for `LEN`.
720720
const LEN: usize = 97;
721721

722722
const L: Lock = Lock {

0 commit comments

Comments
 (0)