Skip to content

Commit

Permalink
don't pad unless needed
Browse files Browse the repository at this point in the history
  • Loading branch information
dryajov committed Dec 17, 2023
1 parent 9be7b0c commit a9a0c1b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions poseidon2/io.nim
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ iterator elements*(bytes: openArray[byte], _: type F): F =
let element = F.fromOpenArray(bytes.toOpenArray(chunkStart, chunkEnd))
yield element
chunkStart += chunkLen
let finalChunk = bytes[chunkStart..<bytes.len] & endMarker
let finalElement = F.fromOpenArray(finalChunk)
yield finalElement
if bytes.len - chunkStart > 0:
let finalChunk = bytes[chunkStart..<bytes.len] & endMarker
let finalElement = F.fromOpenArray(finalChunk)
yield finalElement

# Remark: since `fromInt()` does not work at compile time, this doesn't either
func toF*(a: SomeInteger | SomeUnsignedInt) : F =
Expand Down

0 comments on commit a9a0c1b

Please sign in to comment.