aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/multiply/multiply.c
blob: 3a0b9036528c5cc66922073ce8e0b3ce8931c508 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// See LICENSE for license details.

// *************************************************************************
// multiply function (c version)
// -------------------------------------------------------------------------

int multiply( int x, int y )
{

 int i;
 int result = 0;

 for (i = 0; i < 32; i++) {
   if ((x & 0x1) == 1)
     result = result + y;
       
   x = x >> 1;
   y = y << 1;
 } 
 
 return result;

}