My Project
Loading...
Searching...
No Matches
p_MemCmp.h
Go to the documentation of this file.
1/****************************************
2* Computer Algebra System SINGULAR *
3****************************************/
4/***************************************************************
5 * File: p_MemCmp.h
6 * Purpose: macros for memory comparisons
7 * Author: obachman (Olaf Bachmann)
8 * Created: 8/00
9 *******************************************************************/
10#ifndef P_MEM_CMP_H
11#define P_MEM_CMP_H
12
13/***************************************************************
14 *
15 * auxiallary macros
16 *
17 *******************************************************************/
18#define _p_MemCmp_Declare(s1, s2) \
19 const unsigned long* _s1 = ((unsigned long*) s1); \
20 const unsigned long* _s2 = ((unsigned long*) s2); \
21 REGISTER unsigned long _v1; \
22 REGISTER unsigned long _v2
23
24#define _p_MemCmp_Equal(i, s1, s2, actionE) \
25 do { _v1=((unsigned long*)s1)[i]; _v2=((unsigned long*)s2)[i]; if (_v1==_v2) actionE; }while (0)
26#define _p_MemCmp_NotEqual(actionG, actionS) \
27 do {if (_v1 > _v2) actionG; actionS;} while (0)
28
29#define _p_MemCmp_LengthOne_Equal(i, s1, s2, actionE) \
30 _p_MemCmp_Equal(i, s1, s2, actionE)
31#define _p_MemCmp_LengthTwo_Equal(i, s1, s2, actionE) \
32 _p_MemCmp_Equal(i, s1, s2, _p_MemCmp_Equal(i+1, s1, s2, actionE))
33#define _p_MemCmp_LengthThree_Equal(i, s1, s2, actionE) \
34 _p_MemCmp_LengthTwo_Equal(i, s1, s2, _p_MemCmp_Equal(i+2, s1, s2, actionE))
35#define _p_MemCmp_LengthFour_Equal(i, s1, s2, actionE) \
36 _p_MemCmp_LengthThree_Equal(i, s1, s2, _p_MemCmp_Equal(i+3, s1, s2, actionE))
37#define _p_MemCmp_LengthFive_Equal(i, s1, s2, actionE) \
38 _p_MemCmp_LengthFour_Equal(i, s1, s2, _p_MemCmp_Equal(i+4, s1, s2, actionE))
39#define _p_MemCmp_LengthSix_Equal(i, s1, s2, actionE) \
40 _p_MemCmp_LengthFive_Equal(i, s1, s2, _p_MemCmp_Equal(i+5, s1, s2, actionE))
41#define _p_MemCmp_LengthSeven_Equal(i, s1, s2, actionE) \
42 _p_MemCmp_LengthSix_Equal(i, s1, s2, _p_MemCmp_Equal(i+6, s1, s2, actionE))
43#define _p_MemCmp_LengthEight_Equal(i, s1, s2, actionE) \
44 _p_MemCmp_LengthSeven_Equal(i, s1, s2, _p_MemCmp_Equal(i+7, s1, s2, actionE))
45#define _p_MemCmp_LengthGeneral_Equal(i, s1, s2, length, actionE) \
46do \
47{ \
48 \
49 REGISTER unsigned long _i = (unsigned long) i; \
50 const unsigned long _l = \
51 (unsigned long) length + (unsigned long)i ; \
52 \
53 LengthGeneral_LoopTop: \
54 _v1 = s1[_i]; \
55 _v2 = s2[_i]; \
56 if (_v1 == _v2) \
57 { \
58 _i++; \
59 if (_i == _l) actionE; \
60 else goto LengthGeneral_LoopTop; \
61 } \
62} \
63while (0)
64
65/***************************************************************
66 *
67 * Pomog
68 *
69 *******************************************************************/
70#define p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
71do \
72{ \
73 _p_MemCmp_Declare(s1,s2); \
74 _p_MemCmp_LengthOne_Equal(0, _s1, _s2, actionE); \
75 _p_MemCmp_NotEqual(actionG, actionS); \
76} \
77while (0)
78#define p_MemCmp_LengthTwo_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
79do \
80{ \
81 _p_MemCmp_Declare(s1,s2); \
82 _p_MemCmp_LengthTwo_Equal(0, _s1, _s2, actionE); \
83 _p_MemCmp_NotEqual(actionG, actionS); \
84} \
85while (0)
86#define p_MemCmp_LengthThree_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
87do \
88{ \
89 _p_MemCmp_Declare(s1,s2); \
90 _p_MemCmp_LengthThree_Equal(0, _s1, _s2, actionE); \
91 _p_MemCmp_NotEqual(actionG, actionS); \
92} \
93while (0)
94#define p_MemCmp_LengthFour_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
95do \
96{ \
97 _p_MemCmp_Declare(s1,s2); \
98 _p_MemCmp_LengthFour_Equal(0, _s1, _s2, actionE); \
99 _p_MemCmp_NotEqual(actionG, actionS); \
100} \
101while (0)
102#define p_MemCmp_LengthFive_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
103do \
104{ \
105 _p_MemCmp_Declare(s1,s2); \
106 _p_MemCmp_LengthFive_Equal(0, _s1, _s2, actionE); \
107 _p_MemCmp_NotEqual(actionG, actionS); \
108} \
109while (0)
110#define p_MemCmp_LengthSix_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
111do \
112{ \
113 _p_MemCmp_Declare(s1,s2); \
114 _p_MemCmp_LengthSix_Equal(0, _s1, _s2, actionE); \
115 _p_MemCmp_NotEqual(actionG, actionS); \
116} \
117while (0)
118#define p_MemCmp_LengthSeven_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
119do \
120{ \
121 _p_MemCmp_Declare(s1,s2); \
122 _p_MemCmp_LengthSeven_Equal(0, _s1, _s2, actionE); \
123 _p_MemCmp_NotEqual(actionG, actionS);; \
124} \
125while (0)
126
127#define p_MemCmp_LengthEight_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
128do \
129{ \
130 _p_MemCmp_Declare(s1,s2); \
131 _p_MemCmp_LengthEight_Equal(0, _s1, _s2, actionE); \
132 _p_MemCmp_NotEqual(actionG, actionS); \
133} \
134while (0)
135#define p_MemCmp_LengthGeneral_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
136do \
137{ \
138 _p_MemCmp_Declare(s1,s2); \
139 _p_MemCmp_LengthGeneral_Equal(0, _s1, _s2, length, actionE); \
140 _p_MemCmp_NotEqual(actionG, actionS); \
141} \
142while (0)
143
144/***************************************************************
145 *
146 * Nomog
147 *
148 *******************************************************************/
149#define p_MemCmp_LengthOne_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
150 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
151#define p_MemCmp_LengthTwo_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
152 p_MemCmp_LengthTwo_OrdPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
153#define p_MemCmp_LengthThree_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
154 p_MemCmp_LengthThree_OrdPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
155#define p_MemCmp_LengthFour_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
156 p_MemCmp_LengthFour_OrdPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
157#define p_MemCmp_LengthFive_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
158 p_MemCmp_LengthFive_OrdPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
159#define p_MemCmp_LengthSix_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
160 p_MemCmp_LengthSix_OrdPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
161#define p_MemCmp_LengthSeven_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
162 p_MemCmp_LengthSeven_OrdPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
163#define p_MemCmp_LengthEight_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
164 p_MemCmp_LengthEight_OrdPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
165#define p_MemCmp_LengthGeneral_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
166 p_MemCmp_LengthGeneral_OrdPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
167
168/***************************************************************
169 *
170 * PomogZero
171 *
172 *******************************************************************/
173#define p_MemCmp_LengthTwo_OrdPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
174 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
175#define p_MemCmp_LengthThree_OrdPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
176 p_MemCmp_LengthTwo_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
177#define p_MemCmp_LengthFour_OrdPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
178 p_MemCmp_LengthThree_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
179#define p_MemCmp_LengthFive_OrdPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
180 p_MemCmp_LengthFour_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
181#define p_MemCmp_LengthSix_OrdPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
182 p_MemCmp_LengthFive_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
183#define p_MemCmp_LengthSeven_OrdPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
184 p_MemCmp_LengthSix_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
185#define p_MemCmp_LengthEight_OrdPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
186 p_MemCmp_LengthSeven_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
187#define p_MemCmp_LengthGeneral_OrdPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
188 p_MemCmp_LengthGeneral_OrdPomog(s1, s2, (length) -1, ordsgn, actionE, actionG, actionS)
189
190/***************************************************************
191 *
192 * NomogZero
193 *
194 *******************************************************************/
195#define p_MemCmp_LengthTwo_OrdNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
196 p_MemCmp_LengthOne_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
197#define p_MemCmp_LengthThree_OrdNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
198 p_MemCmp_LengthTwo_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
199#define p_MemCmp_LengthFour_OrdNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
200 p_MemCmp_LengthThree_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
201#define p_MemCmp_LengthFive_OrdNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
202 p_MemCmp_LengthFour_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
203#define p_MemCmp_LengthSix_OrdNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
204 p_MemCmp_LengthFive_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
205#define p_MemCmp_LengthSeven_OrdNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
206 p_MemCmp_LengthSix_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
207#define p_MemCmp_LengthEight_OrdNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
208 p_MemCmp_LengthSeven_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
209#define p_MemCmp_LengthGeneral_OrdNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
210 p_MemCmp_LengthGeneral_OrdNomog(s1, s2, (length) -1, ordsgn, actionE, actionG, actionS)
211
212/***************************************************************
213 *
214 * NegPomog
215 *
216 *******************************************************************/
217#define p_MemCmp_LengthTwo_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
218 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
219 _p_MemCmp_LengthOne_Equal(1, _s2, _s1,actionE), \
220 actionS, actionG)
221#define p_MemCmp_LengthThree_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
222 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
223 _p_MemCmp_LengthTwo_Equal(1, _s2, _s1, actionE), \
224 actionS, actionG)
225#define p_MemCmp_LengthFour_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
226 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
227 _p_MemCmp_LengthThree_Equal(1, _s2, _s1, actionE), \
228 actionS, actionG)
229#define p_MemCmp_LengthFive_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
230 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
231 _p_MemCmp_LengthFour_Equal(1, _s2, _s1, actionE), \
232 actionS, actionG)
233#define p_MemCmp_LengthSix_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
234 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
235 _p_MemCmp_LengthFive_Equal(1, _s2, _s1, actionE), \
236 actionS, actionG)
237#define p_MemCmp_LengthSeven_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
238 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
239 _p_MemCmp_LengthSix_Equal(1, _s2, _s1, actionE), \
240 actionS, actionG)
241#define p_MemCmp_LengthEight_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
242 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
243 _p_MemCmp_LengthSeven_Equal(1, _s2, _s1, actionE), \
244 actionS, actionG)
245#define p_MemCmp_LengthGeneral_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
246 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
247 _p_MemCmp_LengthGeneral_Equal(1, _s2, _s1, (length) -1, actionE), \
248 actionS, actionG)
249
250/***************************************************************
251 *
252 * PomogNeg
253 *
254 *******************************************************************/
255#define p_MemCmp_LengthTwo_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS) \
256 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
257 _p_MemCmp_Equal(1, _s2, _s1, actionE), \
258 actionG, actionS)
259#define p_MemCmp_LengthThree_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS) \
260 p_MemCmp_LengthTwo_OrdPomog(s1, s2, length, ordsgn, \
261 _p_MemCmp_Equal(2, _s2, _s1, actionE), \
262 actionG, actionS)
263#define p_MemCmp_LengthFour_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS) \
264 p_MemCmp_LengthThree_OrdPomog(s1, s2, length, ordsgn, \
265 _p_MemCmp_Equal(3, _s2, _s1, actionE), \
266 actionG, actionS)
267#define p_MemCmp_LengthFive_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS) \
268 p_MemCmp_LengthFour_OrdPomog(s1, s2, length, ordsgn, \
269 _p_MemCmp_Equal(4, _s2, _s1, actionE), \
270 actionG, actionS)
271#define p_MemCmp_LengthSix_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS) \
272 p_MemCmp_LengthFive_OrdPomog(s1, s2, length, ordsgn, \
273 _p_MemCmp_Equal(5, _s2, _s1, actionE), \
274 actionG, actionS)
275#define p_MemCmp_LengthSeven_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS) \
276 p_MemCmp_LengthSix_OrdPomog(s1, s2, length, ordsgn, \
277 _p_MemCmp_Equal(6, _s2, _s1, actionE), \
278 actionG, actionS)
279#define p_MemCmp_LengthEight_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS) \
280 p_MemCmp_LengthSeven_OrdPomog(s1, s2, length, ordsgn, \
281 _p_MemCmp_Equal(7, _s2, _s1, actionE), \
282 actionG, actionS)
283#define p_MemCmp_LengthGeneral_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS) \
284 p_MemCmp_LengthGeneral_OrdPomog(s1, s2, (length-1), ordsgn, \
285 _p_MemCmp_Equal(_i, _s2, _s1, actionE), \
286 actionG, actionS)
287
288/***************************************************************
289 *
290 * PosNomog
291 *
292 *******************************************************************/
293#define p_MemCmp_LengthThree_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
294 p_MemCmp_LengthThree_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
295#define p_MemCmp_LengthFour_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
296 p_MemCmp_LengthFour_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
297#define p_MemCmp_LengthFive_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
298 p_MemCmp_LengthFive_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
299#define p_MemCmp_LengthSix_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
300 p_MemCmp_LengthSix_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
301#define p_MemCmp_LengthSeven_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
302 p_MemCmp_LengthSeven_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
303#define p_MemCmp_LengthEight_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
304 p_MemCmp_LengthEight_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
305#define p_MemCmp_LengthGeneral_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
306 p_MemCmp_LengthGeneral_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionS, actionG)
307
308/***************************************************************
309 *
310 * NomogPos
311 *
312 *******************************************************************/
313#define p_MemCmp_LengthThree_OrdNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
314 p_MemCmp_LengthThree_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionS, actionG)
315#define p_MemCmp_LengthFour_OrdNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
316 p_MemCmp_LengthFour_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionS, actionG)
317#define p_MemCmp_LengthFive_OrdNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
318 p_MemCmp_LengthFive_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionS, actionG)
319#define p_MemCmp_LengthSix_OrdNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
320 p_MemCmp_LengthSix_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionS, actionG)
321#define p_MemCmp_LengthSeven_OrdNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
322 p_MemCmp_LengthSeven_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionS, actionG)
323#define p_MemCmp_LengthEight_OrdNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
324 p_MemCmp_LengthEight_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionS, actionG)
325#define p_MemCmp_LengthGeneral_OrdNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
326 p_MemCmp_LengthGeneral_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionS, actionG)
327
328
329/***************************************************************
330 *
331 * PomogNegZero
332 *
333 *******************************************************************/
334#define p_MemCmp_LengthThree_OrdPomogNegZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
335 p_MemCmp_LengthTwo_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS)
336#define p_MemCmp_LengthFour_OrdPomogNegZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
337 p_MemCmp_LengthThree_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS)
338#define p_MemCmp_LengthFive_OrdPomogNegZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
339 p_MemCmp_LengthFour_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS)
340#define p_MemCmp_LengthSix_OrdPomogNegZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
341 p_MemCmp_LengthFive_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS)
342#define p_MemCmp_LengthSeven_OrdPomogNegZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
343 p_MemCmp_LengthSix_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS)
344#define p_MemCmp_LengthEight_OrdPomogNegZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
345 p_MemCmp_LengthSeven_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS)
346#define p_MemCmp_LengthGeneral_OrdPomogNegZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
347 p_MemCmp_LengthGeneral_OrdPomogNeg(s1, s2, (length) -1, ordsgn, actionE, actionG, actionS)
348
349/***************************************************************
350 *
351 * NegPomogZero
352 *
353 *******************************************************************/
354#define p_MemCmp_LengthThree_OrdNegPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
355 p_MemCmp_LengthTwo_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
356#define p_MemCmp_LengthFour_OrdNegPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
357 p_MemCmp_LengthThree_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
358#define p_MemCmp_LengthFive_OrdNegPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
359 p_MemCmp_LengthFour_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
360#define p_MemCmp_LengthSix_OrdNegPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
361 p_MemCmp_LengthFive_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
362#define p_MemCmp_LengthSeven_OrdNegPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
363 p_MemCmp_LengthSix_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
364#define p_MemCmp_LengthEight_OrdNegPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
365 p_MemCmp_LengthSeven_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
366#define p_MemCmp_LengthGeneral_OrdNegPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
367 p_MemCmp_LengthGeneral_OrdNegPomog(s1, s2, (length) -1, ordsgn, actionE, actionG, actionS)
368
369/***************************************************************
370 *
371 * NomogPosZero
372 *
373 *******************************************************************/
374#define p_MemCmp_LengthFour_OrdNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
375 p_MemCmp_LengthThree_OrdNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS)
376#define p_MemCmp_LengthFive_OrdNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
377 p_MemCmp_LengthFour_OrdNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS)
378#define p_MemCmp_LengthSix_OrdNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
379 p_MemCmp_LengthFive_OrdNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS)
380#define p_MemCmp_LengthSeven_OrdNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
381 p_MemCmp_LengthSix_OrdNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS)
382#define p_MemCmp_LengthEight_OrdNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
383 p_MemCmp_LengthSeven_OrdNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS)
384#define p_MemCmp_LengthGeneral_OrdNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
385 p_MemCmp_LengthGeneral_OrdNomogPos(s1, s2, (length) -1, ordsgn, actionE, actionG, actionS)
386
387/***************************************************************
388 *
389 * PosNomogZero
390 *
391 *******************************************************************/
392#define p_MemCmp_LengthFour_OrdPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
393 p_MemCmp_LengthThree_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
394#define p_MemCmp_LengthFive_OrdPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
395 p_MemCmp_LengthFour_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
396#define p_MemCmp_LengthSix_OrdPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
397 p_MemCmp_LengthFive_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
398#define p_MemCmp_LengthSeven_OrdPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
399 p_MemCmp_LengthSix_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
400#define p_MemCmp_LengthEight_OrdPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
401 p_MemCmp_LengthSeven_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
402#define p_MemCmp_LengthGeneral_OrdPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
403 p_MemCmp_LengthGeneral_OrdPosNomog(s1, s2, (length) -1, ordsgn, actionE, actionG, actionS)
404
405/***************************************************************
406 *
407 * PosPosNomog
408 *
409 *******************************************************************/
410#define p_MemCmp_LengthThree_OrdPosPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
411 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
412 _p_MemCmp_Equal(1, _s1, _s2, \
413 _p_MemCmp_LengthOne_Equal(2, _s2, _s1, actionE)), \
414 actionG, actionS)
415#define p_MemCmp_LengthFour_OrdPosPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
416 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
417 _p_MemCmp_Equal(1, _s1, _s2, \
418 _p_MemCmp_LengthTwo_Equal(2, _s2, _s1, actionE)), \
419 actionG, actionS)
420#define p_MemCmp_LengthFive_OrdPosPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
421 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
422 _p_MemCmp_Equal(1, _s1, _s2, \
423 _p_MemCmp_LengthThree_Equal(2, _s2, _s1, actionE)), \
424 actionG, actionS)
425#define p_MemCmp_LengthSix_OrdPosPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
426 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
427 _p_MemCmp_Equal(1, _s1, _s2, \
428 _p_MemCmp_LengthFour_Equal(2, _s2, _s1, actionE)), \
429 actionG, actionS)
430#define p_MemCmp_LengthSeven_OrdPosPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
431 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
432 _p_MemCmp_Equal(1, _s1, _s2, \
433 _p_MemCmp_LengthFive_Equal(2, _s2, _s1, actionE)), \
434 actionG, actionS)
435#define p_MemCmp_LengthEight_OrdPosPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
436 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
437 _p_MemCmp_Equal(1, _s1, _s2, \
438 _p_MemCmp_LengthSix_Equal(2, _s2, _s1, actionE)), \
439 actionG, actionS)
440#define p_MemCmp_LengthGeneral_OrdPosPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
441 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
442 _p_MemCmp_Equal(1, _s1, _s2, \
443 _p_MemCmp_LengthGeneral_Equal(2,_s2,_s1,(length-2), actionE)), \
444 actionG, actionS)
445
446/***************************************************************
447 *
448 * NegPosNomog
449 *
450 *******************************************************************/
451#define p_MemCmp_LengthThree_OrdNegPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
452 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
453 _p_MemCmp_Equal(1, _s2, _s1, \
454 _p_MemCmp_LengthOne_Equal(2, _s1, _s2, actionE)), \
455 actionS, actionG)
456#define p_MemCmp_LengthFour_OrdNegPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
457 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
458 _p_MemCmp_Equal(1, _s2, _s1, \
459 _p_MemCmp_LengthTwo_Equal(2, _s1, _s2, actionE)), \
460 actionS, actionG)
461#define p_MemCmp_LengthFive_OrdNegPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
462 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
463 _p_MemCmp_Equal(1, _s2, _s1, \
464 _p_MemCmp_LengthThree_Equal(2, _s1, _s2, actionE)), \
465 actionS, actionG)
466#define p_MemCmp_LengthSix_OrdNegPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
467 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
468 _p_MemCmp_Equal(1, _s2, _s1, \
469 _p_MemCmp_LengthFour_Equal(2, _s1, _s2, actionE)), \
470 actionS, actionG)
471#define p_MemCmp_LengthSeven_OrdNegPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
472 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
473 _p_MemCmp_Equal(1, _s2, _s1, \
474 _p_MemCmp_LengthFive_Equal(2, _s1, _s2, actionE)), \
475 actionS, actionG)
476#define p_MemCmp_LengthEight_OrdNegPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
477 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
478 _p_MemCmp_Equal(1, _s2, _s1, \
479 _p_MemCmp_LengthSix_Equal(2, _s1, _s2, actionE)), \
480 actionS, actionG)
481#define p_MemCmp_LengthGeneral_OrdNegPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \
482 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
483 _p_MemCmp_Equal(1, _s2, _s1, \
484 _p_MemCmp_LengthGeneral_Equal(2, _s1,_s2, \
485 (length-2) , actionE)), \
486 actionS, actionG)
487
488/***************************************************************
489 *
490 * PosNomogPos
491 *
492 *******************************************************************/
493#define p_MemCmp_LengthThree_OrdPosNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
494 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
495 _p_MemCmp_LengthOne_Equal(1, _s2, _s1, \
496 _p_MemCmp_LengthOne_Equal(2, _s1, _s2, actionE)), \
497 actionG, actionS)
498#define p_MemCmp_LengthFour_OrdPosNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
499 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
500 _p_MemCmp_LengthTwo_Equal(1, _s2, _s1, \
501 _p_MemCmp_Equal(3, _s1, _s2, actionE)), \
502 actionG, actionS)
503#define p_MemCmp_LengthFive_OrdPosNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
504 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
505 _p_MemCmp_LengthThree_Equal(1, _s2, _s1, \
506 _p_MemCmp_Equal(4, _s1, _s2, actionE)), \
507 actionG, actionS)
508#define p_MemCmp_LengthSix_OrdPosNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
509 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
510 _p_MemCmp_LengthFour_Equal(1, _s2, _s1, \
511 _p_MemCmp_Equal(5, _s1, _s2, actionE)), \
512 actionG, actionS)
513#define p_MemCmp_LengthSeven_OrdPosNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
514 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
515 _p_MemCmp_LengthFive_Equal(1, _s2, _s1, \
516 _p_MemCmp_Equal(6, _s1, _s2, actionE)), \
517 actionG, actionS)
518#define p_MemCmp_LengthEight_OrdPosNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
519 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
520 _p_MemCmp_LengthSix_Equal(1, _s2, _s1, \
521 _p_MemCmp_Equal(7, _s1, _s2, actionE)), \
522 actionG, actionS)
523#define p_MemCmp_LengthGeneral_OrdPosNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \
524 p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, \
525 _p_MemCmp_LengthGeneral_Equal(1, _s2, _s1, (length - 2), \
526 _p_MemCmp_Equal(_i, _s1, _s2, actionE)), \
527 actionG, actionS)
528
529
530/***************************************************************
531 *
532 * PosPosNomogZero
533 *
534 *******************************************************************/
535#define p_MemCmp_LengthFour_OrdPosPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
536 p_MemCmp_LengthThree_OrdPosPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
537#define p_MemCmp_LengthFive_OrdPosPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
538 p_MemCmp_LengthFour_OrdPosPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
539#define p_MemCmp_LengthSix_OrdPosPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
540 p_MemCmp_LengthFive_OrdPosPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
541#define p_MemCmp_LengthSeven_OrdPosPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
542 p_MemCmp_LengthSix_OrdPosPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
543#define p_MemCmp_LengthEight_OrdPosPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
544 p_MemCmp_LengthSeven_OrdPosPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
545#define p_MemCmp_LengthGeneral_OrdPosPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
546 p_MemCmp_LengthGeneral_OrdPosPosNomog(s1, s2, (length) -1, ordsgn, actionE, actionG, actionS)
547
548/***************************************************************
549 *
550 * PosNomogPosZero
551 *
552 *******************************************************************/
553#define p_MemCmp_LengthFour_OrdPosNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
554 p_MemCmp_LengthThree_OrdPosNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS)
555#define p_MemCmp_LengthFive_OrdPosNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
556 p_MemCmp_LengthFour_OrdPosNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS)
557#define p_MemCmp_LengthSix_OrdPosNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
558 p_MemCmp_LengthFive_OrdPosNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS)
559#define p_MemCmp_LengthSeven_OrdPosNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
560 p_MemCmp_LengthSix_OrdPosNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS)
561#define p_MemCmp_LengthEight_OrdPosNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
562 p_MemCmp_LengthSeven_OrdPosNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS)
563#define p_MemCmp_LengthGeneral_OrdPosNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
564 p_MemCmp_LengthGeneral_OrdPosNomogPos(s1, s2, (length) -1, ordsgn, actionE, actionG, actionS)
565
566/***************************************************************
567 *
568 * NegPosNomogZero
569 *
570 *******************************************************************/
571#define p_MemCmp_LengthFour_OrdNegPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
572 p_MemCmp_LengthThree_OrdNegPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
573#define p_MemCmp_LengthFive_OrdNegPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
574 p_MemCmp_LengthFour_OrdNegPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
575#define p_MemCmp_LengthSix_OrdNegPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
576 p_MemCmp_LengthFive_OrdNegPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
577#define p_MemCmp_LengthSeven_OrdNegPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
578 p_MemCmp_LengthSix_OrdNegPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
579#define p_MemCmp_LengthEight_OrdNegPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
580 p_MemCmp_LengthSeven_OrdNegPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS)
581#define p_MemCmp_LengthGeneral_OrdNegPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \
582 p_MemCmp_LengthGeneral_OrdNegPosNomog(s1, s2, (length) -1, ordsgn, actionE, actionG, actionS)
583
584
585/***************************************************************
586 *
587 * OrdGeneral
588 *
589 *******************************************************************/
590#define _p_MemCmp_OrdGeneral_Declare(s1, s2) \
591 const unsigned long* _s1 = ((unsigned long*) s1); \
592 const unsigned long* _s2 = ((unsigned long*) s2); \
593 REGISTER unsigned long _v1; \
594 REGISTER unsigned long _v2; \
595 REGISTER unsigned long _i
596
597#define _p_MemCmp_OrdGeneral_NotEqual(ordsgn, actionG, actionS) \
598do \
599{ \
600 const long* _ordsgn = (long*) ordsgn; \
601 if (_v1 > _v2) \
602 { \
603 if (_ordsgn[_i] == 1) actionG; \
604 actionS; \
605 } \
606 if (_ordsgn[_i] == 1) actionS; \
607 actionG; \
608} \
609while (0)
610
611#define _p_MemCmp_OrdGeneral(i, actionE) \
612do \
613{ \
614 _i = i; \
615 _v1 = _s1[i]; \
616 _v2 = _s2[i]; \
617 if (_v1 == _v2) actionE; \
618} \
619while(0)
620
621#define _p_MemCmp_LengthTwo_OrdGeneral(actionE) \
622 _p_MemCmp_OrdGeneral(0, _p_MemCmp_OrdGeneral(1, actionE))
623
624#define _p_MemCmp_LengthThree_OrdGeneral(actionE) \
625 _p_MemCmp_LengthTwo_OrdGeneral(_p_MemCmp_OrdGeneral(2, actionE))
626
627#define _p_MemCmp_LengthFour_OrdGeneral(actionE) \
628 _p_MemCmp_LengthThree_OrdGeneral(_p_MemCmp_OrdGeneral(3, actionE))
629
630#define _p_MemCmp_LengthFive_OrdGeneral(actionE) \
631 _p_MemCmp_LengthFour_OrdGeneral(_p_MemCmp_OrdGeneral(4, actionE))
632
633#define _p_MemCmp_LengthSix_OrdGeneral(actionE) \
634 _p_MemCmp_LengthFive_OrdGeneral(_p_MemCmp_OrdGeneral(5, actionE))
635
636#define _p_MemCmp_LengthSeven_OrdGeneral(actionE) \
637 _p_MemCmp_LengthSix_OrdGeneral(_p_MemCmp_OrdGeneral(6, actionE))
638
639#define _p_MemCmp_LengthEight_OrdGeneral(actionE) \
640 _p_MemCmp_LengthSeven_OrdGeneral(_p_MemCmp_OrdGeneral(7, actionE))
641
642#define p_MemCmp_LengthOne_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS) \
643do \
644{ \
645 _p_MemCmp_OrdGeneral_Declare(s1, s2); \
646 _p_MemCmp_OrdGeneral(0, actionE); \
647 _p_MemCmp_OrdGeneral_NotEqual(ordsgn, actionG, actionS); \
648} \
649while (0)
650
651#define p_MemCmp_LengthTwo_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS) \
652do \
653{ \
654 _p_MemCmp_OrdGeneral_Declare(s1, s2); \
655 _p_MemCmp_LengthTwo_OrdGeneral(actionE); \
656 _p_MemCmp_OrdGeneral_NotEqual(ordsgn, actionG, actionS); \
657} \
658while (0)
659
660#define p_MemCmp_LengthThree_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS) \
661do \
662{ \
663 _p_MemCmp_OrdGeneral_Declare(s1, s2); \
664 _p_MemCmp_LengthThree_OrdGeneral(actionE); \
665 _p_MemCmp_OrdGeneral_NotEqual(ordsgn, actionG, actionS); \
666} \
667while (0)
668
669#define p_MemCmp_LengthFour_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS) \
670do \
671{ \
672 _p_MemCmp_OrdGeneral_Declare(s1, s2); \
673 _p_MemCmp_LengthFour_OrdGeneral(actionE); \
674 _p_MemCmp_OrdGeneral_NotEqual(ordsgn, actionG, actionS); \
675} \
676while (0)
677
678#define p_MemCmp_LengthFive_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS) \
679do \
680{ \
681 _p_MemCmp_OrdGeneral_Declare(s1, s2); \
682 _p_MemCmp_LengthFive_OrdGeneral(actionE); \
683 _p_MemCmp_OrdGeneral_NotEqual(ordsgn, actionG, actionS); \
684} \
685while (0)
686
687#define p_MemCmp_LengthSix_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS) \
688do \
689{ \
690 _p_MemCmp_OrdGeneral_Declare(s1, s2); \
691 _p_MemCmp_LengthSix_OrdGeneral(actionE); \
692 _p_MemCmp_OrdGeneral_NotEqual(ordsgn, actionG, actionS); \
693} \
694while (0)
695
696#define p_MemCmp_LengthSeven_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS) \
697do \
698{ \
699 _p_MemCmp_OrdGeneral_Declare(s1, s2); \
700 _p_MemCmp_LengthSeven_OrdGeneral(actionE); \
701 _p_MemCmp_OrdGeneral_NotEqual(ordsgn, actionG, actionS); \
702} \
703while (0)
704
705#define p_MemCmp_LengthEight_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS) \
706do \
707{ \
708 _p_MemCmp_OrdGeneral_Declare(s1, s2); \
709 _p_MemCmp_LengthEight_OrdGeneral(actionE); \
710 _p_MemCmp_OrdGeneral_NotEqual(ordsgn, actionG, actionS); \
711} \
712while (0)
713
714/***************************************************************
715 *
716 * Last but not least LengthGeneral_OrdGeneral
717 *
718 *******************************************************************/
719#define p_MemCmp_LengthGeneral_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS) \
720do \
721{ \
722 _p_MemCmp_OrdGeneral_Declare(s1, s2); \
723 const unsigned long _l = (unsigned long) length; \
724 \
725 _i=0; \
726 \
727 LengthGeneral_OrdGeneral_LoopTop: \
728 _v1 = _s1[_i]; \
729 _v2 = _s2[_i]; \
730 if (_v1 == _v2) \
731 { \
732 _i++; \
733 if (_i == _l) actionE; \
734 goto LengthGeneral_OrdGeneral_LoopTop; \
735 } \
736 \
737 _p_MemCmp_OrdGeneral_NotEqual(ordsgn, actionG, actionS); \
738} \
739while (0)
740
741// or, in other (less efficient) words
742#define p_MemCmp_LengthGeneral_OrdGeneral2(s1, s2, length, ordsgn, actionE, actionG, actionS) \
743do \
744{ \
745 int _i; \
746 \
747 for (_i=0; _i<length;_i++) \
748 { \
749 if (s1[_i] != s2[_i]) \
750 { \
751 if (s1[_i] > s2[_i]) \
752 { \
753 if (ordsgn[_i] == 1) \
754 actionG; \
755 actionS; \
756 } \
757 if (ordsgn[_i] == 1) \
758 actionS; \
759 actionG; \
760 } \
761 } \
762 actionE; \
763} \
764while (0)
765
766/***************************************************************
767 *
768 * Bitmask
769 *
770 *******************************************************************/
771#define _p_MemCmp_Bitmask_Declare(s1, s2, bitmask) \
772 const unsigned long* _s1 = ((unsigned long*) s1); \
773 const unsigned long* _s2 = ((unsigned long*) s2); \
774 REGISTER const unsigned long _bitmask = bitmask; \
775 REGISTER unsigned long _v1; \
776 REGISTER unsigned long _v2; \
777 REGISTER unsigned long _i \
778
779
780#define p_MemCmp_Bitmask_LengthGeneral(s1, s2, bitmask, length, actionG, actionS) \
781do \
782{ \
783 _p_MemCmp_Bitmask_Declare(s1, s2, bitmask); \
784 const unsigned long _l = (unsigned long) length; \
785 \
786 _i=0; \
787 \
788 while (_i < _l) \
789 { \
790 _v1 = _s1[_i]; \
791 _v2 = _s2[_i]; \
792 \
793 if ((_v1 > _v2) || \
794 (((_v1 & _bitmask) ^ (_v2 & _bitmask)) != ((_v2 - _v1) & _bitmask))) \
795 actionS; \
796 _i++; \
797 } \
798 actionG; \
799} \
800while (0)
801
802
803#define _p_MemCmp_Bitmask(i, actionS) \
804do \
805{ \
806 _i = i; \
807 _v1 = _s1[i]; \
808 _v2 = _s2[i]; \
809 if ((_v1 > _v2) || \
810 (((_v1 & _bitmask) ^ (_v2 & _bitmask)) != ((_v2 - _v1) & _bitmask))) \
811 actionS; \
812} \
813while (0)
814
815#define _p_MemCmp_Bitmask_LengthTwo(actionS) \
816 do \
817{ \
818 _p_MemCmp_Bitmask(0, actionS); \
819 _p_MemCmp_Bitmask(1, actionS); \
820} \
821while (0)
822
823#define _p_MemCmp_Bitmask_LengthThree(actionS) \
824 do \
825{ \
826 _p_MemCmp_Bitmask_LengthTwo(actionS); \
827 _p_MemCmp_Bitmask(2, actionS); \
828} \
829while (0)
830
831#define _p_MemCmp_Bitmask_LengthFour(actionS) \
832 do \
833{ \
834 _p_MemCmp_Bitmask_LengthThree(actionS); \
835 _p_MemCmp_Bitmask(3, actionS); \
836} \
837while (0)
838
839
840#define _p_MemCmp_Bitmask_LengthFive(actionS) \
841 do \
842{ \
843 _p_MemCmp_Bitmask_LengthFour(actionS); \
844 _p_MemCmp_Bitmask(4, actionS); \
845} \
846while (0)
847
848
849#define _p_MemCmp_Bitmask_LengthSix(actionS) \
850 do \
851{ \
852 _p_MemCmp_Bitmask_LengthFive(actionS); \
853 _p_MemCmp_Bitmask(5, actionS); \
854} \
855while (0)
856
857#define _p_MemCmp_Bitmask_LengthSeven(actionS) \
858 do \
859{ \
860 _p_MemCmp_Bitmask_LengthSix(actionS); \
861 _p_MemCmp_Bitmask(6, actionS); \
862} \
863while (0)
864
865#define _p_MemCmp_Bitmask_LengthEight(actionS) \
866do \
867{ \
868 _p_MemCmp_Bitmask_LengthSeven(actionS); \
869 _p_MemCmp_Bitmask(7, actionS); \
870} \
871while (0)
872
873#define p_MemCmp_Bitmask_LengthZero(s1, s2, bitmask, length, actionG, actionS) actionG
874
875#define p_MemCmp_Bitmask_LengthOne(s1, s2, bitmask, length, actionG, actionS) \
876do \
877{ \
878 _p_MemCmp_Bitmask_Declare(s1, s2, bitmask); \
879 _p_MemCmp_Bitmask(0, actionS); \
880 actionG; \
881} \
882while (0)
883
884#define p_MemCmp_Bitmask_LengthTwo(s1, s2, bitmask, length, actionG, actionS) \
885do \
886{ \
887 _p_MemCmp_Bitmask_Declare(s1, s2, bitmask); \
888 _p_MemCmp_Bitmask_LengthTwo(actionS); \
889 actionG; \
890} \
891while (0)
892
893#define p_MemCmp_Bitmask_LengthThree(s1, s2, bitmask, length, actionG, actionS) \
894do \
895{ \
896 _p_MemCmp_Bitmask_Declare(s1, s2, bitmask); \
897 _p_MemCmp_Bitmask_LengthThree(actionS); \
898 actionG; \
899} \
900while (0)
901
902#define p_MemCmp_Bitmask_LengthFour(s1, s2, bitmask, length, actionG, actionS) \
903do \
904{ \
905 _p_MemCmp_Bitmask_Declare(s1, s2, bitmask); \
906 _p_MemCmp_Bitmask_LengthFour(actionS); \
907 actionG; \
908} \
909while (0)
910
911#define p_MemCmp_Bitmask_LengthFive(s1, s2, bitmask, length, actionG, actionS) \
912do \
913{ \
914 _p_MemCmp_Bitmask_Declare(s1, s2, bitmask); \
915 _p_MemCmp_Bitmask_LengthFive(actionS); \
916 actionG; \
917} \
918while (0)
919
920#define p_MemCmp_Bitmask_LengthSix(s1, s2, bitmask, length, actionG, actionS) \
921do \
922{ \
923 _p_MemCmp_Bitmask_Declare(s1, s2, bitmask); \
924 _p_MemCmp_Bitmask_LengthSix(actionS); \
925 actionG; \
926} \
927while (0)
928
929#define p_MemCmp_Bitmask_LengthSeven(s1, s2, bitmask, length, actionG, actionS) \
930do \
931{ \
932 _p_MemCmp_Bitmask_Declare(s1, s2, bitmask); \
933 _p_MemCmp_Bitmask_LengthSeven(actionS); \
934 actionG; \
935} \
936while (0)
937
938#define p_MemCmp_Bitmask_LengthEigth(s1, s2, bitmask, length, actionG, actionS) \
939do \
940{ \
941 _p_MemCmp_Bitmask_Declare(s1, s2, bitmask); \
942 _p_MemCmp_Bitmask_LengthEigth(actionS); \
943 actionG; \
944} \
945while (0)
946
947
948#endif // P_MEM_CMP