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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [950612-1.c] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
unsigned int
2
f1 (int diff)
3
{
4
  return ((unsigned int) (diff < 0 ? -diff : diff));
5
}
6
 
7
unsigned int
8
f2 (unsigned int diff)
9
{
10
  return ((unsigned int) ((signed int) diff < 0 ? -diff : diff));
11
}
12
 
13
unsigned long long
14
f3 (long long diff)
15
{
16
  return ((unsigned long long) (diff < 0 ? -diff : diff));
17
}
18
 
19
unsigned long long
20
f4 (unsigned long long diff)
21
{
22
  return ((unsigned long long) ((signed long long) diff < 0 ? -diff : diff));
23
}
24
 
25
main ()
26
{
27
  int i;
28
  for (i = 0; i <= 10; i++)
29
    {
30
      if (f1 (i) != i)
31
        abort ();
32
      if (f1 (-i) != i)
33
        abort ();
34
      if (f2 (i) != i)
35
        abort ();
36
      if (f2 (-i) != i)
37
        abort ();
38
      if (f3 ((long long) i) != i)
39
        abort ();
40
      if (f3 ((long long) -i) != i)
41
        abort ();
42
      if (f4 ((long long) i) != i)
43
        abort ();
44
      if (f4 ((long long) -i) != i)
45
        abort ();
46
    }
47
  exit (0);
48
}

powered by: WebSVN 2.1.0

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