2003-08-22 15:03:10 +00:00
|
|
|
#include "safemult.h"
|
|
|
|
|
|
|
|
int imult32(int32 a,int32 b,int32* c) {
|
|
|
|
int neg=(a<0);
|
2004-01-06 23:35:06 +00:00
|
|
|
uint32 d;
|
2003-08-22 15:03:10 +00:00
|
|
|
if (neg) a=-a;
|
|
|
|
if (b<0) { neg^=1; b=-b; }
|
2004-01-06 23:35:06 +00:00
|
|
|
if (umult32(a,b,&d)) return 0;
|
|
|
|
*c=(neg?-d:d);
|
2003-09-05 21:25:51 +00:00
|
|
|
return 1;
|
2003-08-22 15:03:10 +00:00
|
|
|
}
|