]> Dogcows Code - chaz/thecheat/blob - Searching.m
The Cheat 1.2.3
[chaz/thecheat] / Searching.m
1
2 // **********************************************************************
3 // The Cheat - A universal game cheater for Mac OS X
4 // (C) 2003-2005 Chaz McGarvey (BrokenZipper)
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 1, or (at your option)
9 // any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 //
20
21
22 #import "Searching.h"
23
24
25 /*
26 * WARNING! BEWARE! WATCH OUT!
27 *
28 * This source code file makes use of goto jump statements. If goto statements
29 * are disagreeable to you, you may want to skip over this file or you face the
30 * possibility that you will be changed in a very deep and personal way.
31 *
32 * You have been warned.
33 */
34
35
36 /* Here are some handy functions used in this file. */
37
38 void ReportSearchProgress( ThreadedTask *task, unsigned iteration, unsigned regions, int *progress )
39 {
40 int newProgress = (iteration * 100) / regions;
41 if ( newProgress > *progress ) {
42 *progress = newProgress;
43 [task reportProgress:newProgress];
44 }
45 }
46
47
48 /*
49 * This is a real gem. I have no idea where I got this, but it is a wicked
50 * fast string searching algorithm. Hope it's not patented...
51 */
52 #define ASIZE 256
53 void *bmsearch( char *pat, int m, char *text, int n ) {
54 int i,j,k,skip[ASIZE];if(m==0)return 0;
55 for(k=0;k<ASIZE;k++)skip[k]=m;
56 for(k=0;k<m-1;k++)skip[(int)pat[k]]=m-k-1;
57 for(k=m-1;k<n;k+=skip[(int)text[k]&(ASIZE-1)]){
58 for(j=m-1,i=k;j>=0&&text[i]==pat[j];j--)i--;
59 if(j==-1)return(text+i+1);}
60 return NULL;
61 }
62
63
64 #pragma mark -
65 #pragma mark Search Functions
66
67
68 int SearchIteration( ThreadedTask *task, unsigned iteration )
69 {
70 SearchContext *context = [task context];
71 VMRegion region;
72 unsigned hitsPerRegion = 0;
73 vm_size_t size;
74
75 void *ptr, *top;
76 TCAddress offset;
77
78 region = VMNextRegionWithAttributes( context->process, context->lastRegion, VMREGION_READABLE | VMREGION_WRITABLE );
79 if ( VMRegionIsNotNull( region ) ) {
80
81 if ( context->bufferSize < VMRegionSize( region ) ) {
82 char *buf = realloc( context->buffer, VMRegionSize( region ) );
83 if ( buf ) {
84 context->buffer = buf;
85 context->bufferSize = VMRegionSize( region );
86 }
87 else {
88 goto FAILURE;
89 }
90 }
91
92 if ( !VMRegionBytes( region, context->buffer, &size ) ) {
93 goto FAILURE;
94 }
95
96 ptr = context->buffer;
97 top = context->buffer + VMRegionSize( region );
98 offset = VMRegionAddress( region ) - (TCAddress)context->buffer;
99
100 while ( ptr < top ) {
101 if ( context->compareFunc(ptr,context->value->_value) ) {
102 if ( context->numberOfResults >= TCArrayElementCount(context->addresses) ) {
103 TCArrayResize( context->addresses, TCArrayElementCount(context->addresses) + TC_BUFFER_SIZE / sizeof(TCAddress) );
104 context->addressPtr = (TCAddress *)TCArrayBytes(context->addresses) + context->numberOfResults;
105 }
106 if ( context->numberOfResults >= TCArrayElementCount(context->values) ) {
107 TCArrayResize( context->values, TCArrayElementCount(context->values) + TC_BUFFER_SIZE / TCArrayElementSize(context->values) );
108 context->valuePtr = TCArrayBytes(context->values) + context->numberOfResults * TCArrayElementSize(context->values);
109 }
110
111 *context->addressPtr = (TCAddress)ptr + offset;
112 memcpy( context->valuePtr, ptr, TCArrayElementSize( context->values ) );
113
114 context->numberOfResults++;
115 hitsPerRegion++;
116
117 context->addressPtr++;
118 context->valuePtr += TCArrayElementSize( context->values );
119 }
120
121 ptr += TCArrayElementSize( context->values );
122 }
123
124 FAILURE:;
125 if ( hitsPerRegion > 0 ) {
126 TCAddress addr = VMRegionAddress( region );
127 unsigned index = TCArrayElementCount( context->regions );
128 unsigned newsize = index + 1;
129
130 TCArrayResize( context->regions, newsize );
131 TCArrayResize( context->perRegion, newsize );
132
133 TCArraySetElementAtIndex( context->regions, index, &addr );
134 TCArraySetElementAtIndex( context->perRegion, index, &hitsPerRegion );
135 }
136
137 ReportSearchProgress( task, iteration, context->regionCount, &context->progress );
138
139 context->lastRegion = region;
140 return 1;
141 }
142 else {
143 free( context->buffer );
144 context->buffer = NULL;
145 TCArrayResize( context->addresses, context->numberOfResults );
146 TCArrayResize( context->values, context->numberOfResults );
147 return 0;
148 }
149 }
150
151
152 int SearchIterationAgain( ThreadedTask *task, unsigned iteration )
153 {
154 SearchContext *context = [task context];
155 VMRegion region;
156 unsigned hitsPerRegion = 0;
157 vm_size_t size;
158
159 void *ptr;
160 unsigned i, top;
161
162 if ( iteration < TCArrayElementCount( context->lastRegions ) ) {
163
164 context->lastRegion = VMMakeRegion( context->process, *(context->lastRegionPtr), 0 );
165 region = VMNextRegionWithAttributes( context->process, context->lastRegion, VMREGION_READABLE | VMREGION_WRITABLE );
166 if ( VMRegionIsNotNull( region ) ) {
167 if ( context->bufferSize < VMRegionSize( region ) ) {
168 char *buf = realloc( context->buffer, VMRegionSize( region ) );
169 if ( buf ) {
170 context->buffer = buf;
171 context->bufferSize = VMRegionSize( region );
172 }
173 else {
174 goto FAILURE;
175 }
176 }
177
178 if ( !VMRegionBytes( region, context->buffer, &size ) ) {
179 goto FAILURE;
180 }
181
182 top = *context->lastPerRegionPtr;
183
184 for ( i = 0; i < top; i++ ) {
185 ptr = context->buffer + *context->lastAddressPtr - VMRegionAddress(region);
186
187 if (ptr >= context->buffer && context->compareFunc(ptr,context->value->_value)) {
188 if ( context->numberOfResults >= TCArrayElementCount(context->addresses) ) {
189 TCArrayResize( context->addresses, TCArrayElementCount(context->addresses) + TC_BUFFER_SIZE / sizeof(TCAddress) );
190 context->addressPtr = (TCAddress *)TCArrayBytes(context->addresses) + context->numberOfResults;
191 }
192 if ( context->numberOfResults >= TCArrayElementCount(context->values) ) {
193 TCArrayResize( context->values, TCArrayElementCount(context->values) + TC_BUFFER_SIZE / TCArrayElementSize(context->values) );
194 context->valuePtr = TCArrayBytes(context->values) + context->numberOfResults * TCArrayElementSize(context->values);
195 }
196
197 *context->addressPtr = *context->lastAddressPtr;
198 memcpy( context->valuePtr, ptr, TCArrayElementSize( context->values ) );
199
200 context->numberOfResults++;
201 hitsPerRegion++;
202
203 context->addressPtr++;
204 context->valuePtr += TCArrayElementSize( context->values );
205 }
206
207 context->lastAddressPtr++;
208 }
209 }
210
211 FAILURE:;
212 context->lastRegionPtr++;
213 context->lastPerRegionPtr++;
214
215 if ( hitsPerRegion > 0 ) {
216 TCAddress addr = VMRegionAddress( region );
217 unsigned index = TCArrayElementCount( context->regions );
218 unsigned newsize = index + 1;
219
220 TCArrayResize( context->regions, newsize );
221 TCArrayResize( context->perRegion, newsize );
222
223 TCArraySetElementAtIndex( context->regions, index, &addr );
224 TCArraySetElementAtIndex( context->perRegion, index, &hitsPerRegion );
225 }
226
227 ReportSearchProgress( task, iteration, context->regionCount, &context->progress );
228
229 context->lastRegion = region;
230 return 1;
231 }
232 else {
233 free( context->buffer );
234 context->buffer = NULL;
235 TCArrayResize( context->addresses, context->numberOfResults );
236 TCArrayResize( context->values, context->numberOfResults );
237 return 0;
238 }
239 }
240
241
242 int SearchIterationLastValue( ThreadedTask *task, unsigned iteration )
243 {
244 SearchContext *context = [task context];
245 VMRegion region;
246 unsigned hitsPerRegion = 0;
247 vm_size_t size;
248
249 void *ptr;
250 unsigned i, top;
251
252 if ( iteration < TCArrayElementCount( context->lastRegions ) ) {
253
254 context->lastRegion = VMMakeRegion( context->process, *(context->lastRegionPtr), 0 );
255 region = VMNextRegionWithAttributes( context->process, context->lastRegion, VMREGION_READABLE | VMREGION_WRITABLE );
256 if ( VMRegionIsNotNull( region ) ) {
257
258 if ( context->bufferSize < VMRegionSize( region ) ) {
259 char *buf = realloc( context->buffer, VMRegionSize( region ) );
260 if ( buf ) {
261 context->buffer = buf;
262 context->bufferSize = VMRegionSize( region );
263 }
264 else {
265 goto FAILURE;
266 }
267 }
268
269 if ( !VMRegionBytes( region, context->buffer, &size ) ) {
270 goto FAILURE;
271 }
272
273 top = *context->lastPerRegionPtr;
274
275 for ( i = 0; i < top; i++ ) {
276
277 ptr = context->buffer + *context->lastAddressPtr - VMRegionAddress(region);
278 if ( ptr >= context->buffer && context->compareFunc(ptr,context->lastValuePtr) ) {
279 if ( context->numberOfResults >= TCArrayElementCount(context->addresses) ) {
280 TCArrayResize( context->addresses, TCArrayElementCount(context->addresses) + TC_BUFFER_SIZE / sizeof(TCAddress) );
281 context->addressPtr = (TCAddress *)TCArrayBytes(context->addresses) + context->numberOfResults;
282 }
283 if ( context->numberOfResults >= TCArrayElementCount(context->values) ) {
284 TCArrayResize( context->values, TCArrayElementCount(context->values) + TC_BUFFER_SIZE / TCArrayElementSize(context->values) );
285 context->valuePtr = TCArrayBytes(context->values) + context->numberOfResults * TCArrayElementSize(context->values);
286 }
287
288 *context->addressPtr = *context->lastAddressPtr;
289 memcpy( context->valuePtr, ptr, TCArrayElementSize(context->values) );
290
291 context->numberOfResults++;
292 hitsPerRegion++;
293
294 context->addressPtr++;
295 context->valuePtr += TCArrayElementSize(context->values);
296 }
297
298 context->lastAddressPtr++;
299 context->lastValuePtr += TCArrayElementSize(context->values);
300 }
301 }
302
303 FAILURE:;
304 context->lastRegionPtr++;
305 context->lastPerRegionPtr++;
306
307 if ( hitsPerRegion > 0 ) {
308 TCAddress addr = VMRegionAddress( region );
309 unsigned index = TCArrayElementCount( context->regions );
310 unsigned newsize = index + 1;
311
312 TCArrayResize( context->regions, newsize );
313 TCArrayResize( context->perRegion, newsize );
314
315 TCArraySetElementAtIndex( context->regions, index, &addr );
316 TCArraySetElementAtIndex( context->perRegion, index, &hitsPerRegion );
317 }
318
319 ReportSearchProgress( task, iteration, context->regionCount, &context->progress );
320
321 context->lastRegion = region;
322 return 1;
323 }
324 else {
325 free( context->buffer );
326 context->buffer = NULL;
327 TCArrayResize( context->addresses, context->numberOfResults );
328 TCArrayResize( context->values, context->numberOfResults );
329 return 0;
330 }
331 }
332
333
334
335 int SearchStringIteration( ThreadedTask *task, unsigned iteration )
336 {
337 SearchContext *context = [task context];
338 VMRegion region;
339 unsigned hitsPerRegion = 0;
340 vm_size_t size;
341
342 void *ptr, *top, *hit;
343 TCAddress offset;
344
345 region = VMNextRegionWithAttributes( context->process, context->lastRegion, VMREGION_READABLE | VMREGION_WRITABLE );
346 if ( VMRegionIsNotNull( region ) ) {
347
348 if ( context->bufferSize < VMRegionSize(region) ) {
349 char *buf = realloc( context->buffer, VMRegionSize( region ) );
350 if ( buf ) {
351 context->buffer = buf;
352 context->bufferSize = VMRegionSize(region);
353 }
354 else {
355 goto FAILURE;
356 }
357 }
358
359 if ( !VMRegionBytes( region, context->buffer, &size ) ) {
360 goto FAILURE;
361 }
362
363 ptr = context->buffer;
364 top = context->buffer + VMRegionSize( region );
365 offset = VMRegionAddress( region ) - (TCAddress)context->buffer;
366
367 do {
368 hit = bmsearch( context->value->_value, context->value->_size, ptr, top - ptr );
369 if ( hit ) {
370 if ( context->numberOfResults >= TCArrayElementCount(context->addresses) ) {
371 TCArrayResize( context->addresses, TCArrayElementCount(context->addresses) + TC_BUFFER_SIZE / sizeof(TCAddress) );
372 context->addressPtr = (TCAddress *)TCArrayBytes(context->addresses) + context->numberOfResults;
373 }
374 if ( context->numberOfResults >= TCArrayElementCount(context->values) ) {
375 TCArrayResize( context->values, TCArrayElementCount(context->values) + TC_BUFFER_SIZE / TCArrayElementSize(context->values) );
376 context->valuePtr = TCArrayBytes(context->values) + context->numberOfResults * TCArrayElementSize(context->values);
377 }
378
379 *context->addressPtr = (TCAddress)hit + offset;
380 memcpy( context->valuePtr, hit, context->value->_size );
381 context->addressPtr++;
382 context->valuePtr += context->value->_size;
383
384 context->numberOfResults++;
385 hitsPerRegion++;
386 }
387
388 ptr = hit + 1;
389 }
390 while ( hit );
391
392 FAILURE:;
393 if ( hitsPerRegion > 0 ) {
394 TCAddress addr = VMRegionAddress( region );
395 unsigned index = TCArrayElementCount( context->regions );
396 unsigned newsize = index + 1;
397
398 TCArrayResize( context->regions, newsize );
399 TCArrayResize( context->perRegion, newsize );
400
401 TCArraySetElementAtIndex( context->regions, index, &addr );
402 TCArraySetElementAtIndex( context->perRegion, index, &hitsPerRegion );
403 }
404
405 ReportSearchProgress( task, iteration, context->regionCount, &context->progress );
406
407 context->lastRegion = region;
408 return 1;
409 }
410 else {
411 free( context->buffer );
412 context->buffer = NULL;
413 TCArrayResize( context->addresses, context->numberOfResults );
414 TCArrayResize( context->values, context->numberOfResults );
415 return 0;
416 }
417 }
418
419 int SearchStringIterationAgain( ThreadedTask *task, unsigned iteration )
420 {
421 SearchContext *context = [task context];
422 VMRegion region;
423 unsigned hitsPerRegion = 0;
424 vm_size_t size;
425
426 void *ptr;
427 unsigned i, top;
428
429 if ( iteration < TCArrayElementCount( context->lastRegions ) ) {
430
431 context->lastRegion = VMMakeRegion( context->process, *(context->lastRegionPtr), 0 );
432 region = VMNextRegionWithAttributes( context->process, context->lastRegion, VMREGION_READABLE | VMREGION_WRITABLE );
433 if ( VMRegionIsNotNull( region ) ) {
434
435 if ( context->bufferSize < VMRegionSize( region ) ) {
436 char *buf = realloc( context->buffer, VMRegionSize( region ) );
437 if ( buf ) {
438 context->buffer = buf;
439 context->bufferSize = VMRegionSize( region );
440 }
441 else {
442 goto FAILURE;
443 }
444 }
445
446 if ( !VMRegionBytes( region, context->buffer, &size ) ) {
447 goto FAILURE;
448 }
449
450 top = *context->lastPerRegionPtr;
451
452 for ( i = 0; i < top; i++ ) {
453
454 ptr = context->buffer + *context->lastAddressPtr - VMRegionAddress(region);
455
456 if ( ptr >= context->buffer && memcmp( ptr, context->value->_value, MIN(TCArrayElementSize(context->values),context->buffer+VMRegionAddress(region)-ptr) ) == 0 ) {
457 if ( context->numberOfResults >= TCArrayElementCount(context->addresses) ) {
458 TCArrayResize( context->addresses, TCArrayElementCount(context->addresses) + TC_BUFFER_SIZE / sizeof(TCAddress) );
459 context->addressPtr = (TCAddress *)TCArrayBytes(context->addresses) + context->numberOfResults;
460 }
461 if ( context->numberOfResults >= TCArrayElementCount(context->values) ) {
462 TCArrayResize( context->values, TCArrayElementCount(context->values) + TC_BUFFER_SIZE / TCArrayElementSize(context->values) );
463 context->valuePtr = TCArrayBytes(context->values) + context->numberOfResults * TCArrayElementSize(context->values);
464 }
465
466 *context->addressPtr = *context->lastAddressPtr;
467 memcpy( context->valuePtr, ptr, TCArrayElementSize( context->values ) );
468 context->addressPtr++;
469 context->valuePtr += TCArrayElementSize( context->values );
470
471 context->numberOfResults++;
472 hitsPerRegion++;
473 }
474
475 context->lastAddressPtr++;
476 }
477 }
478
479 FAILURE:;
480 context->lastRegionPtr++;
481 context->lastPerRegionPtr++;
482
483 if ( hitsPerRegion > 0 ) {
484 TCAddress addr = VMRegionAddress( region );
485 unsigned index = TCArrayElementCount( context->regions );
486 unsigned newsize = index + 1;
487
488 TCArrayResize( context->regions, newsize );
489 TCArrayResize( context->perRegion, newsize );
490
491 TCArraySetElementAtIndex( context->regions, index, &addr );
492 TCArraySetElementAtIndex( context->perRegion, index, &hitsPerRegion );
493 }
494
495 ReportSearchProgress( task, iteration, context->regionCount, &context->progress );
496
497 context->lastRegion = region;
498 return 1;
499 }
500 else {
501 free( context->buffer );
502 context->buffer = NULL;
503 TCArrayResize( context->addresses, context->numberOfResults );
504 TCArrayResize( context->values, context->numberOfResults );
505 return 0;
506 }
507 }
508
509 int SearchStringIterationLastValue( ThreadedTask *task, unsigned iteration )
510 {
511 SearchContext *context = [task context];
512 VMRegion region;
513 unsigned hitsPerRegion = 0;
514 vm_size_t size;
515
516 void *ptr;
517 unsigned i, top;
518
519 if ( iteration < TCArrayElementCount( context->lastRegions ) ) {
520
521 context->lastRegion = VMMakeRegion( context->process, *(context->lastRegionPtr), 0 );
522 region = VMNextRegionWithAttributes( context->process, context->lastRegion, VMREGION_READABLE | VMREGION_WRITABLE );
523 if ( VMRegionIsNotNull( region ) ) {
524
525 if ( context->bufferSize < VMRegionSize( region ) ) {
526 char *buf = realloc( context->buffer, VMRegionSize( region ) );
527 if ( buf ) {
528 context->buffer = buf;
529 context->bufferSize = VMRegionSize( region );
530 }
531 else {
532 goto FAILURE;
533 }
534 }
535
536 if ( !VMRegionBytes( region, context->buffer, &size ) ) {
537 goto FAILURE;
538 }
539
540 top = *context->lastPerRegionPtr;
541
542 for ( i = 0; i < top; i++ ) {
543
544 ptr = context->buffer + *context->lastAddressPtr - VMRegionAddress(region);
545 if ( ptr >= context->buffer && memcmp( ptr, context->lastValuePtr, MIN(TCArrayElementSize(context->values),context->buffer+VMRegionAddress(region)-ptr) ) == 0 ) {
546 if ( context->numberOfResults >= TCArrayElementCount(context->addresses) ) {
547 TCArrayResize( context->addresses, TCArrayElementCount(context->addresses) + TC_BUFFER_SIZE / sizeof(TCAddress) );
548 context->addressPtr = (TCAddress *)TCArrayBytes(context->addresses) + context->numberOfResults;
549 }
550 if ( context->numberOfResults >= TCArrayElementCount(context->values) ) {
551 TCArrayResize( context->values, TCArrayElementCount(context->values) + TC_BUFFER_SIZE / TCArrayElementSize(context->values) );
552 context->valuePtr = TCArrayBytes(context->values) + context->numberOfResults * TCArrayElementSize(context->values);
553 }
554
555 *context->addressPtr = *context->lastAddressPtr;
556 memcpy( context->valuePtr, ptr, TCArrayElementSize(context->values) );
557 context->addressPtr++;
558 context->valuePtr += TCArrayElementSize(context->values);
559
560 context->numberOfResults++;
561 hitsPerRegion++;
562 }
563
564 context->lastAddressPtr++;
565 context->lastValuePtr += TCArrayElementSize(context->lastValues);
566 }
567 }
568
569 FAILURE:;
570 context->lastRegionPtr++;
571 context->lastPerRegionPtr++;
572
573 if ( hitsPerRegion > 0 ) {
574 TCAddress addr = VMRegionAddress( region );
575 unsigned index = TCArrayElementCount( context->regions );
576 unsigned newsize = index + 1;
577
578 TCArrayResize( context->regions, newsize );
579 TCArrayResize( context->perRegion, newsize );
580
581 TCArraySetElementAtIndex( context->regions, index, &addr );
582 TCArraySetElementAtIndex( context->perRegion, index, &hitsPerRegion );
583 }
584
585 ReportSearchProgress( task, iteration, context->regionCount, &context->progress );
586
587 context->lastRegion = region;
588 return 1;
589 }
590 else {
591 free( context->buffer );
592 context->buffer = NULL;
593 TCArrayResize( context->addresses, context->numberOfResults );
594 TCArrayResize( context->values, context->numberOfResults );
595 return 0;
596 }
597 }
598
599
600
601 #pragma mark -
602 #pragma mark Comparison Functions
603
604
605
606 BOOL EqualInt64( void const *first, void const *second ) {
607 return *(SInt64 *)first == *(SInt64 *)second;
608 }
609 BOOL EqualInt32( void const *first, void const *second ) {
610 return *(SInt32 *)first == *(SInt32 *)second;
611 }
612 BOOL EqualInt16( void const *first, void const *second ) {
613 return *(SInt16 *)first == *(SInt16 *)second;
614 }
615 BOOL EqualInt8( void const *first, void const *second ) {
616 return *(SInt8 *)first == *(SInt8 *)second;
617 }
618 BOOL EqualUInt64( void const *first, void const *second ) {
619 return *(UInt64 *)first == *(UInt64 *)second;
620 }
621 BOOL EqualUInt32( void const *first, void const *second ) {
622 return *(UInt32 *)first == *(UInt32 *)second;
623 }
624 BOOL EqualUInt16( void const *first, void const *second ) {
625 return *(UInt16 *)first == *(UInt16 *)second;
626 }
627 BOOL EqualUInt8( void const *first, void const *second ) {
628 return *(UInt8 *)first == *(UInt8 *)second;
629 }
630 BOOL EqualFloat( void const *first, void const *second ) {
631 return TC_EPSILON > ABS( *(float *)first - *(float *)second );
632 }
633 BOOL EqualDouble( void const *first, void const *second ) {
634 return TC_EPSILON > ABS( *(double *)first - *(double *)second );
635 }
636
637 BOOL NotEqualInt64( void const *first, void const *second ) {
638 return *(SInt64 *)first != *(SInt64 *)second;
639 }
640 BOOL NotEqualInt32( void const *first, void const *second ) {
641 return *(SInt32 *)first != *(SInt32 *)second;
642 }
643 BOOL NotEqualInt16( void const *first, void const *second ) {
644 return *(SInt16 *)first != *(SInt16 *)second;
645 }
646 BOOL NotEqualInt8( void const *first, void const *second ) {
647 return *(SInt8 *)first != *(SInt8 *)second;
648 }
649 BOOL NotEqualUInt64( void const *first, void const *second ) {
650 return *(UInt64 *)first != *(UInt64 *)second;
651 }
652 BOOL NotEqualUInt32( void const *first, void const *second ) {
653 return *(UInt32 *)first != *(UInt32 *)second;
654 }
655 BOOL NotEqualUInt16( void const *first, void const *second ) {
656 return *(UInt16 *)first != *(UInt16 *)second;
657 }
658 BOOL NotEqualUInt8( void const *first, void const *second ) {
659 return *(UInt8 *)first != *(UInt8 *)second;
660 }
661 BOOL NotEqualFloat( void const *first, void const *second ) {
662 return TC_EPSILON <= ABS( *(float *)first - *(float *)second );
663 }
664 BOOL NotEqualDouble( void const *first, void const *second ) {
665 return TC_EPSILON <= ABS( *(double *)first - *(double *)second );
666 }
667
668 BOOL LessThanInt64( void const *first, void const *second ) {
669 return *(SInt64 *)first < *(SInt64 *)second;
670 }
671 BOOL LessThanInt32( void const *first, void const *second ) {
672 return *(SInt32 *)first < *(SInt32 *)second;
673 }
674 BOOL LessThanInt16( void const *first, void const *second ) {
675 return *(SInt16 *)first < *(SInt16 *)second;
676 }
677 BOOL LessThanInt8( void const *first, void const *second ) {
678 return *(SInt8 *)first < *(SInt8 *)second;
679 }
680 BOOL LessThanUInt64( void const *first, void const *second ) {
681 return *(UInt64 *)first < *(UInt64 *)second;
682 }
683 BOOL LessThanUInt32( void const *first, void const *second ) {
684 return *(UInt32 *)first < *(UInt32 *)second;
685 }
686 BOOL LessThanUInt16( void const *first, void const *second ) {
687 return *(UInt16 *)first < *(UInt16 *)second;
688 }
689 BOOL LessThanUInt8( void const *first, void const *second ) {
690 return *(UInt8 *)first < *(UInt8 *)second;
691 }
692 BOOL LessThanFloat( void const *first, void const *second ) {
693 return *(float *)first < *(float *)second;
694 }
695 BOOL LessThanDouble( void const *first, void const *second ) {
696 return *(double *)first < *(double *)second;
697 }
698
699 BOOL GreaterThanInt64( void const *first, void const *second ) {
700 return *(SInt64 *)first > *(SInt64 *)second;
701 }
702 BOOL GreaterThanInt32( void const *first, void const *second ) {
703 return *(SInt32 *)first > *(SInt32 *)second;
704 }
705 BOOL GreaterThanInt16( void const *first, void const *second ) {
706 return *(SInt16 *)first > *(SInt16 *)second;
707 }
708 BOOL GreaterThanInt8( void const *first, void const *second ) {
709 return *(SInt8 *)first > *(SInt8 *)second;
710 }
711 BOOL GreaterThanUInt64( void const *first, void const *second ) {
712 return *(UInt64 *)first > *(UInt64 *)second;
713 }
714 BOOL GreaterThanUInt32( void const *first, void const *second ) {
715 return *(UInt32 *)first > *(UInt32 *)second;
716 }
717 BOOL GreaterThanUInt16( void const *first, void const *second ) {
718 return *(UInt16 *)first > *(UInt16 *)second;
719 }
720 BOOL GreaterThanUInt8( void const *first, void const *second ) {
721 return *(UInt8 *)first > *(UInt8 *)second;
722 }
723 BOOL GreaterThanFloat( void const *first, void const *second ) {
724 return *(float *)first > *(float *)second;
725 }
726 BOOL GreaterThanDouble( void const *first, void const *second ) {
727 return *(double *)first > *(double *)second;
728 }
729
730
731
732
733
This page took 0.067967 seconds and 4 git commands to generate.