Add BitSeq.isZeros

This commit is contained in:
Zahary Karadjov 2019-08-07 05:19:53 +03:00
parent 19fd0cc489
commit 5e11e1f1db
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
2 changed files with 6 additions and 3 deletions

View File

@ -245,3 +245,8 @@ func isSubsetOf*(a, b: BitSeq): bool =
return false return false
true true
proc isZeros*(x: BitSeq): bool =
for w in words(x):
if w != 0: return false
return true

View File

@ -147,9 +147,7 @@ func readVarint*[Stream](input: var Stream,
## ##
## * `ValueError` ## * `ValueError`
## The stream contained an invalid varint value. ## The stream contained an invalid varint value.
var var parser: VarintParser[type(outVal), flavour]
parser: VarintParser[type(outVal), flavour]
pos = input.pos
while not input.eof: while not input.eof:
case parser.feedByte(input.read) case parser.feedByte(input.read)