Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cmpsi.c « h8500 « machine « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3357343f559e244f97d8d5efc2a211f026a4dd3a (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

union u 
{
  struct 
    {
      short int msw;
      unsigned short lsw;
    } w;
  long l;
};

union us
{
  struct 
    {
      short int msw;
      unsigned short lsw;
    } w;
  long l;
};

int
__cmpsi2(long arga,
	 short int msw_b, unsigned short int lsw_b)
{
  union u u;
  u.l = arga;

  if (u.w.msw != msw_b)
    {
      if (u.w.msw < msw_b) return 0;
      return 2;
    }
  if (u.w.lsw != lsw_b) 
    {
      if (u.w.lsw < lsw_b) return 0;
      return 2;
    }
  return 1;
}


int
__ucmpsi2(unsigned long arga,
	 unsigned short int msw_b, unsigned short int lsw_b)
{
  union us u;
  u.l = arga;

  if (u.w.msw != msw_b)
    {
      if (u.w.msw < msw_b) return 0;
      return 2;
    }
  if (u.w.lsw != lsw_b) 
    {
      if (u.w.lsw < lsw_b) return 0;
      return 2;
    }
  return 1;
}


union pu 
{
  struct {
    char ignore;
    signed char msb;
    unsigned short lsw;
  } w;
  long l;
};

union pun
{
  struct {
    char ignore;
    unsigned char msb;
    unsigned short lsw;
  } w;
  long l;
};


int
__cmppsi2(long arga, long argb)
{
  union pu a;
  union pu b;
  a.l = arga;
  b.l = argb;

  if (a.w.msb != b.w.msb)
    {
      if (a.w.msb < b.w.msb) return 0;
      return 2;
    }
  if (a.w.lsw != b.w.lsw)
    {
      if (a.w.lsw < b.w.lsw) return 0;
      return 2;
    }
  return 1;
}


int
__ucmppsi2(long arga, long argb)
{
  union pun a;
  union pun b;
  a.l = arga;
  b.l = argb;

  if (a.w.msb != b.w.msb)
    {
      if (a.w.msb < b.w.msb) return 0;
      return 2;
    }
  if (a.w.lsw != b.w.lsw)
    {
      if (a.w.lsw < b.w.lsw) return 0;
      return 2;
    }
  return 1;
}