Skip to content

Commit a3cd87b

Browse files
folkertdevAmanieu
authored andcommitted
use is_multiple_of to check if an addr is aligned
1 parent fdb4b91 commit a3cd87b

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

crates/core_arch/src/powerpc/macros.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ macro_rules! impl_from {
278278
($s: ident) => {
279279
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
280280
impl From<$s> for s_t_l!($s) {
281+
#[inline]
281282
fn from (v: $s) -> Self {
282283
unsafe {
283284
transmute(v)
@@ -297,6 +298,7 @@ macro_rules! impl_neg {
297298
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
298299
impl crate::ops::Neg for s_t_l!($s) {
299300
type Output = s_t_l!($s);
301+
#[inline]
300302
fn neg(self) -> Self::Output {
301303
unsafe { simd_neg(self) }
302304
}

crates/core_arch/src/s390x/macros.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ macro_rules! impl_from {
435435
($s: ident) => {
436436
#[unstable(feature = "stdarch_s390x", issue = "135681")]
437437
impl From<$s> for s_t_l!($s) {
438+
#[inline]
438439
fn from (v: $s) -> Self {
439440
unsafe {
440441
transmute(v)
@@ -454,6 +455,7 @@ macro_rules! impl_neg {
454455
#[unstable(feature = "stdarch_s390x", issue = "135681")]
455456
impl crate::ops::Neg for s_t_l!($s) {
456457
type Output = s_t_l!($s);
458+
#[inline]
457459
fn neg(self) -> Self::Output {
458460
unsafe { simd_neg(self) }
459461
}

crates/core_arch/src/s390x/vector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ types! {
5151
pub struct vector_double(2 x f64);
5252
}
5353

54-
#[repr(packed)]
54+
#[repr(C, packed)]
5555
struct PackedTuple<T, U> {
5656
x: T,
5757
y: U,
@@ -4787,7 +4787,7 @@ pub unsafe fn vec_splat_s8<const IMM: i8>() -> vector_signed_char {
47874787
#[unstable(feature = "stdarch_s390x", issue = "135681")]
47884788
#[cfg_attr(test, assert_instr(vrepih, IMM = 42))]
47894789
pub unsafe fn vec_splat_s16<const IMM: i16>() -> vector_signed_short {
4790-
vector_signed_short([IMM as i16; 8])
4790+
vector_signed_short([IMM; 8])
47914791
}
47924792

47934793
/// Vector Splat Signed Word

crates/core_arch/src/wasm32/simd128.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ unsafe extern "unadjusted" {
141141
fn llvm_f64x2_max(x: simd::f64x2, y: simd::f64x2) -> simd::f64x2;
142142
}
143143

144-
#[repr(packed)]
144+
#[repr(C, packed)]
145145
#[derive(Copy)]
146146
struct Unaligned<T>(T);
147147

crates/core_arch/src/x86_64/cmpxchg16b.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub unsafe fn cmpxchg16b(
4848
success: Ordering,
4949
failure: Ordering,
5050
) -> u128 {
51-
debug_assert!(dst as usize % 16 == 0);
51+
debug_assert!(dst.addr().is_multiple_of(16));
5252

5353
let res = crate::sync::atomic::atomic_compare_exchange(dst, old, new, success, failure);
5454
res.unwrap_or_else(|x| x)

0 commit comments

Comments
 (0)