about summary refs log tree commit diff
path: root/library/stdarch/crates
diff options
context:
space:
mode:
authorFolkert de Vries <folkert@folkertdev.nl>2025-07-05 10:57:05 +0200
committerAmanieu d'Antras <amanieu@gmail.com>2025-07-07 17:08:03 +0000
commitbb2d169700574d196f51b6a253e1a15c9b144c6d (patch)
tree96fad8f0eb35f9a329236cf4b620658d06db80ab /library/stdarch/crates
parente101e383d0580e642548a5e935a9ff844339159a (diff)
downloadrust-bb2d169700574d196f51b6a253e1a15c9b144c6d.tar.gz
rust-bb2d169700574d196f51b6a253e1a15c9b144c6d.zip
use `is_multiple_of` to check if an addr is aligned
Diffstat (limited to 'library/stdarch/crates')
-rw-r--r--library/stdarch/crates/core_arch/src/powerpc/macros.rs2
-rw-r--r--library/stdarch/crates/core_arch/src/s390x/macros.rs2
-rw-r--r--library/stdarch/crates/core_arch/src/s390x/vector.rs4
-rw-r--r--library/stdarch/crates/core_arch/src/wasm32/simd128.rs2
-rw-r--r--library/stdarch/crates/core_arch/src/x86_64/cmpxchg16b.rs2
5 files changed, 8 insertions, 4 deletions
diff --git a/library/stdarch/crates/core_arch/src/powerpc/macros.rs b/library/stdarch/crates/core_arch/src/powerpc/macros.rs
index af47494e8fb..24d86f1018c 100644
--- a/library/stdarch/crates/core_arch/src/powerpc/macros.rs
+++ b/library/stdarch/crates/core_arch/src/powerpc/macros.rs
@@ -278,6 +278,7 @@ macro_rules! impl_from {
     ($s: ident) => {
         #[unstable(feature = "stdarch_powerpc", issue = "111145")]
         impl From<$s> for s_t_l!($s) {
+            #[inline]
             fn from (v: $s) -> Self {
                 unsafe {
                     transmute(v)
@@ -297,6 +298,7 @@ macro_rules! impl_neg {
         #[unstable(feature = "stdarch_powerpc", issue = "111145")]
         impl crate::ops::Neg for s_t_l!($s) {
             type Output = s_t_l!($s);
+            #[inline]
             fn neg(self) -> Self::Output {
                 unsafe { simd_neg(self) }
             }
diff --git a/library/stdarch/crates/core_arch/src/s390x/macros.rs b/library/stdarch/crates/core_arch/src/s390x/macros.rs
index 4f0f84ec912..26afbaa45a7 100644
--- a/library/stdarch/crates/core_arch/src/s390x/macros.rs
+++ b/library/stdarch/crates/core_arch/src/s390x/macros.rs
@@ -435,6 +435,7 @@ macro_rules! impl_from {
     ($s: ident) => {
         #[unstable(feature = "stdarch_s390x", issue = "135681")]
         impl From<$s> for s_t_l!($s) {
+            #[inline]
             fn from (v: $s) -> Self {
                 unsafe {
                     transmute(v)
@@ -454,6 +455,7 @@ macro_rules! impl_neg {
         #[unstable(feature = "stdarch_s390x", issue = "135681")]
         impl crate::ops::Neg for s_t_l!($s) {
             type Output = s_t_l!($s);
+            #[inline]
             fn neg(self) -> Self::Output {
                 unsafe { simd_neg(self) }
             }
diff --git a/library/stdarch/crates/core_arch/src/s390x/vector.rs b/library/stdarch/crates/core_arch/src/s390x/vector.rs
index ae5c37ce017..101de701069 100644
--- a/library/stdarch/crates/core_arch/src/s390x/vector.rs
+++ b/library/stdarch/crates/core_arch/src/s390x/vector.rs
@@ -51,7 +51,7 @@ types! {
     pub struct vector_double(2 x f64);
 }
 
-#[repr(packed)]
+#[repr(C, packed)]
 struct PackedTuple<T, U> {
     x: T,
     y: U,
@@ -4787,7 +4787,7 @@ pub unsafe fn vec_splat_s8<const IMM: i8>() -> vector_signed_char {
 #[unstable(feature = "stdarch_s390x", issue = "135681")]
 #[cfg_attr(test, assert_instr(vrepih, IMM = 42))]
 pub unsafe fn vec_splat_s16<const IMM: i16>() -> vector_signed_short {
-    vector_signed_short([IMM as i16; 8])
+    vector_signed_short([IMM; 8])
 }
 
 /// Vector Splat Signed Word
diff --git a/library/stdarch/crates/core_arch/src/wasm32/simd128.rs b/library/stdarch/crates/core_arch/src/wasm32/simd128.rs
index fc0d7723fa0..108bc3125c5 100644
--- a/library/stdarch/crates/core_arch/src/wasm32/simd128.rs
+++ b/library/stdarch/crates/core_arch/src/wasm32/simd128.rs
@@ -141,7 +141,7 @@ unsafe extern "unadjusted" {
     fn llvm_f64x2_max(x: simd::f64x2, y: simd::f64x2) -> simd::f64x2;
 }
 
-#[repr(packed)]
+#[repr(C, packed)]
 #[derive(Copy)]
 struct Unaligned<T>(T);
 
diff --git a/library/stdarch/crates/core_arch/src/x86_64/cmpxchg16b.rs b/library/stdarch/crates/core_arch/src/x86_64/cmpxchg16b.rs
index 46a008245bf..d3e7f62903b 100644
--- a/library/stdarch/crates/core_arch/src/x86_64/cmpxchg16b.rs
+++ b/library/stdarch/crates/core_arch/src/x86_64/cmpxchg16b.rs
@@ -48,7 +48,7 @@ pub unsafe fn cmpxchg16b(
     success: Ordering,
     failure: Ordering,
 ) -> u128 {
-    debug_assert!(dst as usize % 16 == 0);
+    debug_assert!(dst.addr().is_multiple_of(16));
 
     let res = crate::sync::atomic::atomic_compare_exchange(dst, old, new, success, failure);
     res.unwrap_or_else(|x| x)