// Equal returns 1 if x == y, and 0 otherwise.
//
// Both operands must have the same announced length.
+//
+//go:norace
func (x *Nat) Equal(y *Nat) choice {
// Eliminate bounds checks in the loop.
size := len(x.limbs)
}
// IsZero returns 1 if x == 0, and 0 otherwise.
+//
+//go:norace
func (x *Nat) IsZero() choice {
// Eliminate bounds checks in the loop.
size := len(x.limbs)
}
// IsOne returns 1 if x == 1, and 0 otherwise.
+//
+//go:norace
func (x *Nat) IsOne() choice {
// Eliminate bounds checks in the loop.
size := len(x.limbs)
//
// The length of x must be the same as the modulus. x must already be reduced
// modulo m.
+//
+//go:norace
func (x *Nat) IsMinusOne(m *Modulus) choice {
minusOne := m.Nat()
minusOne.SubOne(m)
}
// IsOdd returns 1 if x is odd, and 0 otherwise.
+//
+//go:norace
func (x *Nat) IsOdd() choice {
if len(x.limbs) == 0 {
return no
// cmpGeq returns 1 if x >= y, and 0 otherwise.
//
// Both operands must have the same announced length.
+//
+//go:norace
func (x *Nat) cmpGeq(y *Nat) choice {
// Eliminate bounds checks in the loop.
size := len(x.limbs)
// assign sets x <- y if on == 1, and does nothing otherwise.
//
// Both operands must have the same announced length.
+//
+//go:norace
func (x *Nat) assign(on choice, y *Nat) *Nat {
// Eliminate bounds checks in the loop.
size := len(x.limbs)
// add computes x += y and returns the carry.
//
// Both operands must have the same announced length.
+//
+//go:norace
func (x *Nat) add(y *Nat) (c uint) {
// Eliminate bounds checks in the loop.
size := len(x.limbs)
// sub computes x -= y. It returns the borrow of the subtraction.
//
// Both operands must have the same announced length.
+//
+//go:norace
func (x *Nat) sub(y *Nat) (c uint) {
// Eliminate bounds checks in the loop.
size := len(x.limbs)
// ShiftRightVarTime sets x = x >> n.
//
// The announced length of x is unchanged.
+//
+//go:norace
func (x *Nat) ShiftRightVarTime(n uint) *Nat {
// Eliminate bounds checks in the loop.
size := len(x.limbs)
// shiftIn calculates x = x << _W + y mod m.
//
// This assumes that x is already reduced mod m.
+//
+//go:norace
func (x *Nat) shiftIn(y uint, m *Modulus) *Nat {
d := NewNat().resetFor(m)
// addMulVVW multiplies the multi-word value x by the single-word value y,
// adding the result to the multi-word value z and returning the final carry.
// It can be thought of as one row of a pen-and-paper column multiplication.
+//
+//go:norace
func addMulVVW(z, x []uint, y uint) (carry uint) {
_ = x[len(z)-1] // bounds check elimination hint
for i := range z {
}
}
+//go:norace
func rshift1(a *Nat, carry uint) {
size := len(a.limbs)
aLimbs := a.limbs[:size]