Skip to content

Commit

Permalink
atomic: remove AtomicI64/AtomicU64 on riscv32
Browse files Browse the repository at this point in the history
The riscv32 platform does not have AtomicI64 or AtomicU64, so remove
those implementations on that platform.

This fixes bincode-org#531.

Signed-off-by: Sean Cross <[email protected]>
  • Loading branch information
xobs committed Apr 1, 2022
1 parent c8f95cc commit a309baf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/features/atomic.rs
Original file line number Diff line number Diff line change
@@ -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<E: crate::enc::Encoder>(
Expand Down Expand Up @@ -64,6 +66,7 @@ impl Decode for AtomicU32 {
}
}

#[cfg(not(target_arch = "riscv32"))]
impl Encode for AtomicU64 {
fn encode<E: crate::enc::Encoder>(
&self,
Expand All @@ -73,6 +76,7 @@ impl Encode for AtomicU64 {
}
}

#[cfg(not(target_arch = "riscv32"))]
impl Decode for AtomicU64 {
fn decode<D: crate::de::Decoder>(decoder: &mut D) -> Result<Self, crate::error::DecodeError> {
Ok(AtomicU64::new(Decode::decode(decoder)?))
Expand Down Expand Up @@ -139,6 +143,7 @@ impl Decode for AtomicI32 {
}
}

#[cfg(not(target_arch = "riscv32"))]
impl Encode for AtomicI64 {
fn encode<E: crate::enc::Encoder>(
&self,
Expand All @@ -148,6 +153,7 @@ impl Encode for AtomicI64 {
}
}

#[cfg(not(target_arch = "riscv32"))]
impl Decode for AtomicI64 {
fn decode<D: crate::de::Decoder>(decoder: &mut D) -> Result<Self, crate::error::DecodeError> {
Ok(AtomicI64::new(Decode::decode(decoder)?))
Expand Down

0 comments on commit a309baf

Please sign in to comment.