Skip to content

Commit

Permalink
Fix for Rust 1.79
Browse files Browse the repository at this point in the history
  • Loading branch information
akoshelev committed Jun 13, 2024
1 parent c256cb2 commit 080f988
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ipa-core/src/ff/boolean_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ macro_rules! boolean_array_impl_small {
v.0.iter()
.by_refs()
.enumerate()
.fold(0_u128, |acc, (i, b)| acc + ((*b as u128) << i))
.fold(0_u128, |acc, (i, b)| acc + (u128::from(*b) << i))
}
}

Expand Down
2 changes: 1 addition & 1 deletion ipa-core/src/ff/galois_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ macro_rules! bit_array_impl {
.iter()
.by_refs()
.enumerate()
.fold(0_u128, |acc, (i, b)| acc + ((*b as u128) << i))
.fold(0_u128, |acc, (i, b)| acc + (u128::from(*b) << i))
}
}

Expand Down
2 changes: 2 additions & 0 deletions ipa-core/src/ff/prime_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ macro_rules! field_impl {
fn add(self, rhs: Self) -> Self::Output {
let c = u64::from;
debug_assert!(c(Self::PRIME) < (u64::MAX >> 1));
#[allow(clippy::cast_possible_truncation)]
Self(((c(self.0) + c(rhs.0)) % c(Self::PRIME)) as <Self as SharedValue>::Storage)
}
}
Expand All @@ -149,6 +150,7 @@ macro_rules! field_impl {
let c = u64::from;
debug_assert!(c(Self::PRIME) < (u64::MAX >> 1));
// TODO(mt) - constant time?
#[allow(clippy::cast_possible_truncation)]
Self(
((c(Self::PRIME) + c(self.0) - c(rhs.0)) % c(Self::PRIME))
as <Self as SharedValue>::Storage,
Expand Down
1 change: 0 additions & 1 deletion ipa-core/src/helpers/gateway/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pub type MpcTransportImpl = TransportImpl<crate::helpers::HelperIdentity>;
#[cfg(feature = "in-memory-infra")]
pub type ShardTransportImpl = TransportImpl<ShardIndex>;

#[cfg(feature = "real-world-infra")]
#[cfg(feature = "real-world-infra")]
pub type MpcTransportImpl = crate::sync::Arc<crate::net::HttpTransport>;
#[cfg(feature = "real-world-infra")]
Expand Down

0 comments on commit 080f988

Please sign in to comment.