2015-09-29 14:42:40 +00:00
|
|
|
#if defined(__GNUC__) && (__GNUC__ >= 5)
|
|
|
|
|
|
|
|
#include "uint16.h"
|
|
|
|
|
|
|
|
int imult16( int16 a, int16 b, int16* c) { return !__builtin_mul_overflow(a,b,c); }
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2003-08-22 15:03:10 +00:00
|
|
|
#include "safemult.h"
|
|
|
|
|
|
|
|
int imult16(int16 a,int16 b,int16* c) {
|
2005-07-15 20:57:07 +00:00
|
|
|
int32 x=(int32)a*b;
|
|
|
|
if ((int16)x != x) return 0;
|
|
|
|
*c=x;
|
2003-09-05 21:25:51 +00:00
|
|
|
return 1;
|
2003-08-22 15:03:10 +00:00
|
|
|
}
|
2015-09-29 14:42:40 +00:00
|
|
|
|
|
|
|
#endif
|