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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [machine/] [h8500/] [cmpsi.c] - Blame information for rev 407

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

Line No. Rev Author Line
1 148 jeremybenn
 
2
union u
3
{
4
  struct
5
    {
6
      short int msw;
7
      unsigned short lsw;
8
    } w;
9
  long l;
10
};
11
 
12
union us
13
{
14
  struct
15
    {
16
      short int msw;
17
      unsigned short lsw;
18
    } w;
19
  long l;
20
};
21
 
22
int
23
__cmpsi2(long arga,
24
         short int msw_b, unsigned short int lsw_b)
25
{
26
  union u u;
27
  u.l = arga;
28
 
29
  if (u.w.msw != msw_b)
30
    {
31
      if (u.w.msw < msw_b) return 0;
32
      return 2;
33
    }
34
  if (u.w.lsw != lsw_b)
35
    {
36
      if (u.w.lsw < lsw_b) return 0;
37
      return 2;
38
    }
39
  return 1;
40
}
41
 
42
 
43
int
44
__ucmpsi2(unsigned long arga,
45
         unsigned short int msw_b, unsigned short int lsw_b)
46
{
47
  union us u;
48
  u.l = arga;
49
 
50
  if (u.w.msw != msw_b)
51
    {
52
      if (u.w.msw < msw_b) return 0;
53
      return 2;
54
    }
55
  if (u.w.lsw != lsw_b)
56
    {
57
      if (u.w.lsw < lsw_b) return 0;
58
      return 2;
59
    }
60
  return 1;
61
}
62
 
63
 
64
union pu
65
{
66
  struct {
67
    char ignore;
68
    signed char msb;
69
    unsigned short lsw;
70
  } w;
71
  long l;
72
};
73
 
74
union pun
75
{
76
  struct {
77
    char ignore;
78
    unsigned char msb;
79
    unsigned short lsw;
80
  } w;
81
  long l;
82
};
83
 
84
 
85
int
86
__cmppsi2(long arga, long argb)
87
{
88
  union pu a;
89
  union pu b;
90
  a.l = arga;
91
  b.l = argb;
92
 
93
  if (a.w.msb != b.w.msb)
94
    {
95
      if (a.w.msb < b.w.msb) return 0;
96
      return 2;
97
    }
98
  if (a.w.lsw != b.w.lsw)
99
    {
100
      if (a.w.lsw < b.w.lsw) return 0;
101
      return 2;
102
    }
103
  return 1;
104
}
105
 
106
 
107
int
108
__ucmppsi2(long arga, long argb)
109
{
110
  union pun a;
111
  union pun b;
112
  a.l = arga;
113
  b.l = argb;
114
 
115
  if (a.w.msb != b.w.msb)
116
    {
117
      if (a.w.msb < b.w.msb) return 0;
118
      return 2;
119
    }
120
  if (a.w.lsw != b.w.lsw)
121
    {
122
      if (a.w.lsw < b.w.lsw) return 0;
123
      return 2;
124
    }
125
  return 1;
126
}

powered by: WebSVN 2.1.0

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