Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ZeroConstant => ConstZero #546

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/limb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod sub;
#[cfg(feature = "rand_core")]
mod rand;

use crate::{Bounded, ConstCtOption, Constants, NonZero, ZeroConstant};
use crate::{Bounded, ConstCtOption, ConstZero, Constants, NonZero};
use core::fmt;
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq};

Expand Down Expand Up @@ -120,7 +120,7 @@ impl ConditionallySelectable for Limb {
}
}

impl ZeroConstant for Limb {
impl ConstZero for Limb {
const ZERO: Self = Self::ZERO;
}

Expand Down
4 changes: 2 additions & 2 deletions src/modular/const_monty_form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod sub;

use self::inv::ConstMontyFormInverter;
use super::{div_by_2::div_by_2, reduction::montgomery_reduction, BernsteinYangInverter, Retrieve};
use crate::{Limb, Odd, PrecomputeInverter, Uint, ZeroConstant};
use crate::{ConstZero, Limb, Odd, PrecomputeInverter, Uint};
use core::{fmt::Debug, marker::PhantomData};
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq};

Expand Down Expand Up @@ -181,7 +181,7 @@ impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Default for ConstMontyFor
}
}

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ZeroConstant for ConstMontyForm<MOD, LIMBS> {
impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstZero for ConstMontyForm<MOD, LIMBS> {
const ZERO: Self = Self::ZERO;
}

Expand Down
6 changes: 3 additions & 3 deletions src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,20 +267,20 @@ pub trait Zero: ConstantTimeEq + Sized {
/// Trait for associating a constant representing zero.
///
/// Types which impl this trait automatically receive a blanket impl of [`Zero`].
pub trait ZeroConstant: Zero {
pub trait ConstZero: Zero {
/// The value `0`.
const ZERO: Self;
}

impl<T: ZeroConstant> Zero for T {
impl<T: ConstZero> Zero for T {
#[inline(always)]
fn zero() -> T {
Self::ZERO
}
}

/// Trait for associating constant values with a type.
pub trait Constants: ZeroConstant {
pub trait Constants: ConstZero {
/// The value `1`.
const ONE: Self;

Expand Down
6 changes: 3 additions & 3 deletions src/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ mod rand;

use crate::{
modular::{BernsteinYangInverter, MontyForm},
Bounded, ConstCtOption, Constants, Encoding, FixedInteger, Integer, Limb, NonZero, Odd,
PrecomputeInverter, PrecomputeInverterWithAdjuster, Word, ZeroConstant,
Bounded, ConstCtOption, ConstZero, Constants, Encoding, FixedInteger, Integer, Limb, NonZero,
Odd, PrecomputeInverter, PrecomputeInverterWithAdjuster, Word,
};
use core::fmt;
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq};
Expand Down Expand Up @@ -258,7 +258,7 @@ impl<const LIMBS: usize> Integer for Uint<LIMBS> {
}
}

impl<const LIMBS: usize> ZeroConstant for Uint<LIMBS> {
impl<const LIMBS: usize> ConstZero for Uint<LIMBS> {
const ZERO: Self = Self::ZERO;
}

Expand Down