fork download
  1. #include <stdint.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. int32_t imul(int16_t x, int16_t y)
  6. {
  7. #define u(x) ((uint32_t)(x))
  8. #define s(x) ((int32_t)(x))
  9. return ((u(abs(x)) * u(abs(y))) ^ ((x ^ y) >> 15)) + (u(x ^ y) >> 31);
  10. }
  11.  
  12. int main(void)
  13. {
  14. printf("%d\n", imul(-32768, -32768));
  15. return 0;
  16. }
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
1073741824