source: git/kernel/p_MemCmp.h @ e9c3b2

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