tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: strsuftoi(3), strsuftou(3) proposal in libc
On 10/28/15 9:41 PM, Kamil Rytarowski wrote:
> The code checking for overflows in multiplication is quite
> complicated, I'm attaching just the comments to follow the algorithm:
Hi, Kamil.
You probably don't want to fix typos in the existing comments (i.e.
src/lib/libutil/login_cap.c), but here are three minor corrections if
you (or anyone else) want to fix them:
> /*
> * First check the magnitude of each number. If the sum of the
> * magnatude is way to high, reject the number. (If this test
> * is not done then the first multiply below may overflow.)
> */
* "magnatude" -> "magnitude"
* "way to high" -> "too high"
> * Finally, if MAX - ((h1 * l2) + (l1 * h2) + (l1 * l2))<(h1*h2)
> * then adding in residual amout will cause an overflow.
* "amout" -> "amount"
Regards,
Lewis
Home |
Main Index |
Thread Index |
Old Index