Skip to content

Commit

Permalink
Replace the 10 times loop by a multiply by 10
Browse files Browse the repository at this point in the history
  • Loading branch information
simulot committed Nov 13, 2020
1 parent f351dd5 commit c49f25b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions converters/type_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ func addDigitToMantissa(mantissaIn uint64, d byte) (mantissaOut uint64, carryOut
mantissaOut = mantissaIn

if mantissaIn != 0 {
for i := 0; i < 9; i++ {
mantissaOut, carry = bits.Add64(mantissaOut, mantissaIn, carry)
if carry != 0 {
return mantissaIn, true
}
var over uint64
over, mantissaOut = bits.Mul64(mantissaIn, uint64(10))
if over != 0 {
return mantissaIn, true
}
}
}
mantissaOut, carry = bits.Add64(mantissaOut, uint64(d), carry)
if carry != 0 {
return mantissaIn, true
Expand Down

0 comments on commit c49f25b

Please sign in to comment.