is_zero
stdlib/is_zero.nbv
is_zero(v)
does the structure contain nothing but 0 elements? outputs 0 or 1
TODO: make telemorphic e.g. no static or let specification
- Precompiles
if_ne!,len!,loop!- Used by
r1cs/r1cs_assert_field,r1cs/r1cs_into_output
Source
# does the structure contain nothing
# but `0` elements?
# outputs `0` or `1`
#
# TODO: make telemorphic
# e.g. no static or let specification
(v)
static mut out = 1
loop! (len! v), i {
if_ne! v[i], 0 {
out = 0
}
}
out