Skip to content

Commit

Permalink
Merge #641
Browse files Browse the repository at this point in the history
641: Fix CachePadded test r=taiki-e a=taiki-e

This test fails on architectures that use 32-byte alignment as assuming the alignment of `CachePadded` is 64+.

https://github.com/crossbeam-rs/crossbeam/blob/a66fe72b224e0864f66360778d611a06c7234771/crossbeam-utils/tests/cache_padded.rs#L25-L31

Co-authored-by: Taiki Endo <te316e89@gmail.com>
  • Loading branch information
bors[bot] and taiki-e committed Jan 4, 2021
2 parents a66fe72 + a939a35 commit de4f099
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crossbeam-utils/tests/cache_padded.rs
Expand Up @@ -27,7 +27,9 @@ fn distance() {
let arr = [CachePadded::new(17u8), CachePadded::new(37u8)];
let a = &*arr[0] as *const u8;
let b = &*arr[1] as *const u8;
assert!(unsafe { a.offset(64) } <= b);
let align = mem::align_of::<CachePadded<()>>();
assert!(align >= 32);
assert_eq!(unsafe { a.add(align) }, b);
}

#[test]
Expand Down

0 comments on commit de4f099

Please sign in to comment.