aboutsummaryrefslogtreecommitdiff
path: root/softint/mul.c
blob: 1907dba5efec3d762928bedba2b13d9b2c042b16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
#include <stdint.h>

long softint_mul( long x, long y )
{

  int i;
  long result = 0;

  for (i = 0; i < (sizeof(long) << 3); i++) {
    if ((x & 0x1) == 1)
      result = result + y;

    x = x >> 1;
    y = y << 1;
  }

  return result;

}