1 /*
2 Copyright (c) 1990 The Regents of the University of California.
3 All rights reserved.
4
5 Redistribution and use in source and binary forms are permitted
6 provided that the above copyright notice and this paragraph are
7 duplicated in all such forms and that any documentation,
8 and/or other materials related to such
9 distribution and use acknowledge that the software was developed
10 by the University of California, Berkeley. The name of the
11 University may not be used to endorse or promote products derived
12 from this software without specific prior written permission.
13 THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 */
17
18 union u
19 {
20 struct
21 {
22 short int msw;
23 unsigned short lsw;
24 } w;
25 long l;
26 };
27
28 union us
29 {
30 struct
31 {
32 short int msw;
33 unsigned short lsw;
34 } w;
35 long l;
36 };
37
38 int
__cmpsi2(long arga,short int msw_b,unsigned short int lsw_b)39 __cmpsi2(long arga,
40 short int msw_b, unsigned short int lsw_b)
41 {
42 union u u;
43 u.l = arga;
44
45 if (u.w.msw != msw_b)
46 {
47 if (u.w.msw < msw_b) return 0;
48 return 2;
49 }
50 if (u.w.lsw != lsw_b)
51 {
52 if (u.w.lsw < lsw_b) return 0;
53 return 2;
54 }
55 return 1;
56 }
57
58
59 int
__ucmpsi2(unsigned long arga,unsigned short int msw_b,unsigned short int lsw_b)60 __ucmpsi2(unsigned long arga,
61 unsigned short int msw_b, unsigned short int lsw_b)
62 {
63 union us u;
64 u.l = arga;
65
66 if (u.w.msw != msw_b)
67 {
68 if (u.w.msw < msw_b) return 0;
69 return 2;
70 }
71 if (u.w.lsw != lsw_b)
72 {
73 if (u.w.lsw < lsw_b) return 0;
74 return 2;
75 }
76 return 1;
77 }
78
79
80 union pu
81 {
82 struct {
83 char ignore;
84 signed char msb;
85 unsigned short lsw;
86 } w;
87 long l;
88 };
89
90 union pun
91 {
92 struct {
93 char ignore;
94 unsigned char msb;
95 unsigned short lsw;
96 } w;
97 long l;
98 };
99
100
101 int
__cmppsi2(long arga,long argb)102 __cmppsi2(long arga, long argb)
103 {
104 union pu a;
105 union pu b;
106 a.l = arga;
107 b.l = argb;
108
109 if (a.w.msb != b.w.msb)
110 {
111 if (a.w.msb < b.w.msb) return 0;
112 return 2;
113 }
114 if (a.w.lsw != b.w.lsw)
115 {
116 if (a.w.lsw < b.w.lsw) return 0;
117 return 2;
118 }
119 return 1;
120 }
121
122
123 int
__ucmppsi2(long arga,long argb)124 __ucmppsi2(long arga, long argb)
125 {
126 union pun a;
127 union pun b;
128 a.l = arga;
129 b.l = argb;
130
131 if (a.w.msb != b.w.msb)
132 {
133 if (a.w.msb < b.w.msb) return 0;
134 return 2;
135 }
136 if (a.w.lsw != b.w.lsw)
137 {
138 if (a.w.lsw < b.w.lsw) return 0;
139 return 2;
140 }
141 return 1;
142 }
143