celestiaorg / smt

A Go library that implements a Sparse Merkle tree for a key-value map.
https://godoc.org/github.com/celestiaorg/smt
MIT License
138 stars 53 forks source link

Use integer division instead of floating-point division #16

Closed adlerjohn closed 3 years ago

adlerjohn commented 3 years ago

Instead of rounding up by converting to float then back to int, do rounding-up integer division directly.

Based on https://stackoverflow.com/a/17974.