be careful around 1L and friends
This commit is contained in:
6
C/arith2.c
Normal file → Executable file
6
C/arith2.c
Normal file → Executable file
@@ -542,12 +542,12 @@ ipow(Int x, Int p)
|
||||
{
|
||||
Int r;
|
||||
|
||||
if (p == 0) return 1L;
|
||||
if (p == 0) return ((CELL)1);
|
||||
if (x == 0 && p > 0) return 0L;
|
||||
if(p < 0)
|
||||
return (-p % 2) ? x : 1L;
|
||||
return (-p % 2) ? x : ((CELL)1);
|
||||
|
||||
r = 1L;
|
||||
r = ((CELL)1);
|
||||
for(;;) {
|
||||
if(p & 1) {
|
||||
if (mul_overflow((r*x), r, x)) {
|
||||
|
Reference in New Issue
Block a user