Fix signed int overflow warning.

This commit is contained in:
John Ralls 2014-06-09 08:34:20 -07:00
parent 8d723f1b1e
commit 2c910ed1bb

View File

@ -43,14 +43,13 @@ static const gint64 pten[] = { 1, 10, 100, 1000, 10000, 100000, 1000000,
10000000, 100000000, 1000000000, 10000000000,
100000000000, 1000000000000, 10000000000000,
100000000000000, 10000000000000000,
100000000000000000, 1000000000000000000,
10000000000000000000};
100000000000000000, 1000000000000000000};
#define POWTEN_OVERFLOW -5
static inline gint64
powten (int exp)
{
if (exp > 19 || exp < -19)
if (exp > 18 || exp < -18)
return POWTEN_OVERFLOW;
return exp < 0 ? -pten[-exp] : pten[exp];
}