2003-08-22 15:03:10 +00:00
|
|
|
#include "safemult.h"
|
|
|
|
|
|
|
|
int imult16(int16 a,int16 b,int16* c) {
|
|
|
|
int neg=(a<0);
|
2004-01-06 23:35:06 +00:00
|
|
|
uint16 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 (umult16(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
|
|
|
}
|