|
// Copyright 2020 ConsenSys AG
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
// Code generated by goff (v0.2.0) DO NOT EDIT
|
|
|
|
// Package ff contains field arithmetic operations
|
|
package ff
|
|
|
|
// MulAssignElement z = z * x mod q (constant time)
|
|
// calling this instead of z.MulAssign(x) is prefered for performance critical path
|
|
//go:noescape
|
|
func MulAssignElement(res, y *Element)
|
|
|
|
// Mul z = x * y mod q (constant time)
|
|
// see https://hackmd.io/@zkteam/modular_multiplication
|
|
func (z *Element) Mul(x, y *Element) *Element {
|
|
res := *x
|
|
MulAssignElement(&res, y)
|
|
z.Set(&res)
|
|
return z
|
|
}
|
|
|
|
// MulAssign z = z * x mod q (constant time)
|
|
// see https://hackmd.io/@zkteam/modular_multiplication
|
|
func (z *Element) MulAssign(x *Element) *Element {
|
|
MulAssignElement(z, x)
|
|
return z
|
|
}
|