Closed WilfredTA closed 3 years ago
Evidently, I turned on an auto-formatter without even realizing it...
Evidently, I turned on an auto-formatter without even realizing it...
Lmk when you've reverted all the unintentional formatting changes, I'll review then.
The product of normalizers can be stored. Beforehand, we do: `(normalizer1 reserve1) (normalizer2 * reserve2)
which is equivalent to
(normalizer1 * normalizer2) * (reserve1 * reserve2)
Therefore, we can simply store the product of the normalizers since we only ever use their product.
Further, the casts in
seek
touint112
can result in overflows when casting the product of areserve
by itsnormalizer
. This fixes that as well.Finally, there is no need to conditionally normalize the reserves. Either their precision is less than 18 or equivalent to 18. The former case results in
normalizer
> 1, so we should multiple by the normalizer. The latter case results innormalizer == 1
, so we can still multiply by the normalizer.