From a309baf011b8de44cfff4e45f93cd8fc2d73dece Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 1 Apr 2022 17:05:26 +0800 Subject: [PATCH] atomic: remove AtomicI64/AtomicU64 on riscv32 The riscv32 platform does not have AtomicI64 or AtomicU64, so remove those implementations on that platform. This fixes #531. Signed-off-by: Sean Cross --- src/features/atomic.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/features/atomic.rs b/src/features/atomic.rs index c1c4d24b..04b3bab0 100644 --- a/src/features/atomic.rs +++ b/src/features/atomic.rs @@ -1,8 +1,10 @@ use crate::{de::Decode, enc::Encode}; use core::sync::atomic::{ - AtomicBool, AtomicI16, AtomicI32, AtomicI64, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, - AtomicU64, AtomicU8, AtomicUsize, Ordering, + AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8, + AtomicUsize, Ordering, }; +#[cfg(not(target_arch = "riscv32"))] +use core::sync::atomic::{AtomicI64, AtomicU64}; impl Encode for AtomicBool { fn encode( @@ -64,6 +66,7 @@ impl Decode for AtomicU32 { } } +#[cfg(not(target_arch = "riscv32"))] impl Encode for AtomicU64 { fn encode( &self, @@ -73,6 +76,7 @@ impl Encode for AtomicU64 { } } +#[cfg(not(target_arch = "riscv32"))] impl Decode for AtomicU64 { fn decode(decoder: &mut D) -> Result { Ok(AtomicU64::new(Decode::decode(decoder)?)) @@ -139,6 +143,7 @@ impl Decode for AtomicI32 { } } +#[cfg(not(target_arch = "riscv32"))] impl Encode for AtomicI64 { fn encode( &self, @@ -148,6 +153,7 @@ impl Encode for AtomicI64 { } } +#[cfg(not(target_arch = "riscv32"))] impl Decode for AtomicI64 { fn decode(decoder: &mut D) -> Result { Ok(AtomicI64::new(Decode::decode(decoder)?))