Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

14 lines
253 B

  1. #include "safemult.h"
  2. int imult64(int64 a,int64 b,int64* c) {
  3. int neg=(a<0);
  4. uint64 d;
  5. if (neg) a=-a;
  6. if (b<0) { neg^=1; b=-b; }
  7. if (!umult64(a,b,&d)) return 0;
  8. if (d > 0x7fffffffffffffffULL + neg) return 0;
  9. *c=(neg?-d:d);
  10. return 1;
  11. }