You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.7 KiB

  1. //go:build !amd64
  2. // +build !amd64
  3. // Copyright 2020 ConsenSys Software Inc.
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. // Code generated by consensys/gnark-crypto DO NOT EDIT
  17. package ff
  18. // /!\ WARNING /!\
  19. // this code has not been audited and is provided as-is. In particular,
  20. // there is no security guarantees such as constant time implementation
  21. // or side-channel attack resistance
  22. // /!\ WARNING /!\
  23. // MulBy3 x *= 3
  24. func MulBy3(x *Element) {
  25. mulByConstant(x, 3)
  26. }
  27. // MulBy5 x *= 5
  28. func MulBy5(x *Element) {
  29. mulByConstant(x, 5)
  30. }
  31. // MulBy13 x *= 13
  32. func MulBy13(x *Element) {
  33. mulByConstant(x, 13)
  34. }
  35. // Butterfly sets
  36. // a = a + b
  37. // b = a - b
  38. func Butterfly(a, b *Element) {
  39. _butterflyGeneric(a, b)
  40. }
  41. func mul(z, x, y *Element) {
  42. _mulGeneric(z, x, y)
  43. }
  44. // FromMont converts z in place (i.e. mutates) from Montgomery to regular representation
  45. // sets and returns z = z * 1
  46. func fromMont(z *Element) {
  47. _fromMontGeneric(z)
  48. }
  49. func add(z, x, y *Element) {
  50. _addGeneric(z, x, y)
  51. }
  52. func double(z, x *Element) {
  53. _doubleGeneric(z, x)
  54. }
  55. func sub(z, x, y *Element) {
  56. _subGeneric(z, x, y)
  57. }
  58. func neg(z, x *Element) {
  59. _negGeneric(z, x)
  60. }
  61. func reduce(z *Element) {
  62. _reduceGeneric(z)
  63. }