We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8cbafa2 commit 8549b3aCopy full SHA for 8549b3a
std/math/emulated/field_assert.go
@@ -103,6 +103,11 @@ func (f *Field[T]) AssertIsInRange(a *Element[T]) {
103
// method internally reduces the element and asserts that the value is less than
104
// the modulus.
105
func (f *Field[T]) IsZero(a *Element[T]) frontend.Variable {
106
+ // fast path - when the element is on zero limbs, then it is always zero
107
+ if len(a.Limbs) == 0 {
108
+ return 1
109
+ }
110
+
111
// to avoid using strict reduction (which is expensive as requires binary
112
// assertion that value is less than modulus), we use ordinary reduction but
113
// in this case the result can be either 0 or p (if it is zero).
0 commit comments