OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [config/] [udivmodsi4.c] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
unsigned long
2
udivmodsi4(unsigned long num, unsigned long den, int modwanted)
3
{
4
  unsigned long bit = 1;
5
  unsigned long res = 0;
6
 
7
  while (den < num && bit && !(den & (1L<<31)))
8
    {
9
      den <<=1;
10
      bit <<=1;
11
    }
12
  while (bit)
13
    {
14
      if (num >= den)
15
        {
16
          num -= den;
17
          res |= bit;
18
        }
19
      bit >>=1;
20
      den >>=1;
21
    }
22
  if (modwanted) return num;
23
  return res;
24
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.