|
// 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
|
|
|
|
// SquareElement z = x * x mod q
|
|
// calling this instead of z.Square(x) is prefered for performance critical path
|
|
// go - noescape
|
|
// func SquareElement(res,x *Element)
|
|
|
|
// Square z = x * x mod q
|
|
// see https://hackmd.io/@zkteam/modular_multiplication
|
|
func (z *Element) Square(x *Element) *Element {
|
|
if z != x {
|
|
z.Set(x)
|
|
}
|
|
MulAssignElement(z, x)
|
|
// SquareElement(z, x)
|
|
return z
|
|
}
|