]> Dogcows Code - chaz/thecheat/blob - Searching.m
The Cheat 1.2.1
[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
168 if ( context->bufferSize < VMRegionSize( region ) ) {
169 char *buf = realloc( context->buffer, VMRegionSize( region ) );
170 if ( buf ) {
171 context->buffer = buf;
172 context->bufferSize = VMRegionSize( region );
173 }
174 else {
175 goto FAILURE;
176 }
177 }
178
179 if ( !VMRegionBytes( region, context->buffer, &size ) ) {
180 goto FAILURE;
181 }
182
183 top = *context->lastPerRegionPtr;
184
185 for ( i = 0; i < top; i++ ) {
186
187 ptr = context->buffer + *context->lastAddressPtr - VMRegionAddress(region);
188 if ( context->compareFunc(ptr,context->value->_value) ) {
189 if ( context->numberOfResults >= TCArrayElementCount(context->addresses) ) {
190 TCArrayResize( context->addresses, TCArrayElementCount(context->addresses) + TC_BUFFER_SIZE / sizeof(TCAddress) );
191 context->addressPtr = (TCAddress *)TCArrayBytes(context->addresses) + context->numberOfResults;
192 }
193 if ( context->numberOfResults >= TCArrayElementCount(context->values) ) {
194 TCArrayResize( context->values, TCArrayElementCount(context->values) + TC_BUFFER_SIZE / TCArrayElementSize(context->values) );
195 context->valuePtr = TCArrayBytes(context->values) + context->numberOfResults * TCArrayElementSize(context->values);
196 }
197
198 *context->addressPtr = *context->lastAddressPtr;
199 memcpy( context->valuePtr, ptr, TCArrayElementSize( context->values ) );
200
201 context->numberOfResults++;
202 hitsPerRegion++;
203
204 context->addressPtr++;
205 context->valuePtr += TCArrayElementSize( context->values );
206 }
207
208 context->lastAddressPtr++;
209 }
210 }
211
212 FAILURE:;
213 context->lastRegionPtr++;
214 context->lastPerRegionPtr++;
215
216 if ( hitsPerRegion > 0 ) {
217 TCAddress addr = VMRegionAddress( region );
218 unsigned index = TCArrayElementCount( context->regions );
219 unsigned newsize = index + 1;
220
221 TCArrayResize( context->regions, newsize );
222 TCArrayResize( context->perRegion, newsize );
223
224 TCArraySetElementAtIndex( context->regions, index, &addr );
225 TCArraySetElementAtIndex( context->perRegion, index, &hitsPerRegion );
226 }
227
228 ReportSearchProgress( task, iteration, context->regionCount, &context->progress );
229
230 context->lastRegion = region;
231 return 1;
232 }
233 else {
234 free( context->buffer );
235 context->buffer = NULL;
236 TCArrayResize( context->addresses, context->numberOfResults );
237 TCArrayResize( context->values, context->numberOfResults );
238 return 0;
239 }
240 }
241
242
243 int SearchIterationLastValue( ThreadedTask *task, unsigned iteration )
244 {
245 SearchContext *context = [task context];
246 VMRegion region;
247 unsigned hitsPerRegion = 0;
248 vm_size_t size;
249
250 void *ptr;
251 unsigned i, top;
252
253 if ( iteration < TCArrayElementCount( context->lastRegions ) ) {
254
255 context->lastRegion = VMMakeRegion( context->process, *(context->lastRegionPtr), 0 );
256 region = VMNextRegionWithAttributes( context->process, context->lastRegion, VMREGION_READABLE | VMREGION_WRITABLE );
257 if ( VMRegionIsNotNull( region ) ) {
258
259 if ( context->bufferSize < VMRegionSize( region ) ) {
260 char *buf = realloc( context->buffer, VMRegionSize( region ) );
261 if ( buf ) {
262 context->buffer = buf;
263 context->bufferSize = VMRegionSize( region );
264 }
265 else {
266 goto FAILURE;
267 }
268 }
269
270 if ( !VMRegionBytes( region, context->buffer, &size ) ) {
271 goto FAILURE;
272 }
273
274 top = *context->lastPerRegionPtr;
275
276 for ( i = 0; i < top; i++ ) {
277
278 ptr = context->buffer + *context->lastAddressPtr - VMRegionAddress(region);
279 if ( context->compareFunc(ptr,context->lastValuePtr) ) {
280 if ( context->numberOfResults >= TCArrayElementCount(context->addresses) ) {
281 TCArrayResize( context->addresses, TCArrayElementCount(context->addresses) + TC_BUFFER_SIZE / sizeof(TCAddress) );
282 context->addressPtr = (TCAddress *)TCArrayBytes(context->addresses) + context->numberOfResults;
283 }
284 if ( context->numberOfResults >= TCArrayElementCount(context->values) ) {
285 TCArrayResize( context->values, TCArrayElementCount(context->values) + TC_BUFFER_SIZE / TCArrayElementSize(context->values) );
286 context->valuePtr = TCArrayBytes(context->values) + context->numberOfResults * TCArrayElementSize(context->values);
287 }
288
289 *context->addressPtr = *context->lastAddressPtr;
290 memcpy( context->valuePtr, ptr, TCArrayElementSize(context->values) );
291
292 context->numberOfResults++;
293 hitsPerRegion++;
294
295 context->addressPtr++;
296 context->valuePtr += TCArrayElementSize(context->values);
297 }
298
299 context->lastAddressPtr++;
300 context->lastValuePtr += TCArrayElementSize(context->values);
301 }
302 }
303
304 FAILURE:;
305 context->lastRegionPtr++;
306 context->lastPerRegionPtr++;
307
308 if ( hitsPerRegion > 0 ) {
309 TCAddress addr = VMRegionAddress( region );
310 unsigned index = TCArrayElementCount( context->regions );
311 unsigned newsize = index + 1;
312
313 TCArrayResize( context->regions, newsize );
314 TCArrayResize( context->perRegion, newsize );
315
316 TCArraySetElementAtIndex( context->regions, index, &addr );
317 TCArraySetElementAtIndex( context->perRegion, index, &hitsPerRegion );
318 }
319
320 ReportSearchProgress( task, iteration, context->regionCount, &context->progress );
321
322 context->lastRegion = region;
323 return 1;
324 }
325 else {
326 free( context->buffer );
327 context->buffer = NULL;
328 TCArrayResize( context->addresses, context->numberOfResults );
329 TCArrayResize( context->values, context->numberOfResults );
330 return 0;
331 }
332 }
333
334
335
336 int SearchStringIteration( ThreadedTask *task, unsigned iteration )
337 {
338 SearchContext *context = [task context];
339 VMRegion region;
340 unsigned hitsPerRegion = 0;
341 vm_size_t size;
342
343 void *ptr, *top, *hit;
344 TCAddress offset;
345
346 region = VMNextRegionWithAttributes( context->process, context->lastRegion, VMREGION_READABLE | VMREGION_WRITABLE );
347 if ( VMRegionIsNotNull( region ) ) {
348
349 if ( context->bufferSize < VMRegionSize(region) ) {
350 char *buf = realloc( context->buffer, VMRegionSize( region ) );
351 if ( buf ) {
352 context->buffer = buf;
353 context->bufferSize = VMRegionSize(region);
354 }
355 else {
356 goto FAILURE;
357 }
358 }
359
360 if ( !VMRegionBytes( region, context->buffer, &size ) ) {
361 goto FAILURE;
362 }
363
364 ptr = context->buffer;
365 top = context->buffer + VMRegionSize( region );
366 offset = VMRegionAddress( region ) - (TCAddress)context->buffer;
367
368 do {
369 hit = bmsearch( context->value->_value, context->value->_size, ptr, top - ptr );
370 if ( hit ) {
371 if ( context->numberOfResults >= TCArrayElementCount(context->addresses) ) {
372 TCArrayResize( context->addresses, TCArrayElementCount(context->addresses) + TC_BUFFER_SIZE / sizeof(TCAddress) );
373 context->addressPtr = (TCAddress *)TCArrayBytes(context->addresses) + context->numberOfResults;
374 }
375 if ( context->numberOfResults >= TCArrayElementCount(context->values) ) {
376 TCArrayResize( context->values, TCArrayElementCount(context->values) + TC_BUFFER_SIZE / TCArrayElementSize(context->values) );
377 context->valuePtr = TCArrayBytes(context->values) + context->numberOfResults * TCArrayElementSize(context->values);
378 }
379
380 *context->addressPtr = (TCAddress)hit + offset;
381 memcpy( context->valuePtr, hit, context->value->_size );
382 context->addressPtr++;
383 context->valuePtr += context->value->_size;
384
385 context->numberOfResults++;
386 hitsPerRegion++;
387 }
388
389 ptr = hit + 1;
390 }
391 while ( hit );
392
393 FAILURE:;
394 if ( hitsPerRegion > 0 ) {
395 TCAddress addr = VMRegionAddress( region );
396 unsigned index = TCArrayElementCount( context->regions );
397 unsigned newsize = index + 1;
398
399 TCArrayResize( context->regions, newsize );
400 TCArrayResize( context->perRegion, newsize );
401
402 TCArraySetElementAtIndex( context->regions, index, &addr );
403 TCArraySetElementAtIndex( context->perRegion, index, &hitsPerRegion );
404 }
405
406 ReportSearchProgress( task, iteration, context->regionCount, &context->progress );
407
408 context->lastRegion = region;
409 return 1;
410 }
411 else {
412 free( context->buffer );
413 context->buffer = NULL;
414 TCArrayResize( context->addresses, context->numberOfResults );
415 TCArrayResize( context->values, context->numberOfResults );
416 return 0;
417 }
418 }
419
420 int SearchStringIterationAgain( ThreadedTask *task, unsigned iteration )
421 {
422 SearchContext *context = [task context];
423 VMRegion region;
424 unsigned hitsPerRegion = 0;
425 vm_size_t size;
426
427 void *ptr;
428 unsigned i, top;
429
430 if ( iteration < TCArrayElementCount( context->lastRegions ) ) {
431
432 context->lastRegion = VMMakeRegion( context->process, *(context->lastRegionPtr), 0 );
433 region = VMNextRegionWithAttributes( context->process, context->lastRegion, VMREGION_READABLE | VMREGION_WRITABLE );
434 if ( VMRegionIsNotNull( region ) ) {
435
436 if ( context->bufferSize < VMRegionSize( region ) ) {
437 char *buf = realloc( context->buffer, VMRegionSize( region ) );
438 if ( buf ) {
439 context->buffer = buf;
440 context->bufferSize = VMRegionSize( region );
441 }
442 else {
443 goto FAILURE;
444 }
445 }
446
447 if ( !VMRegionBytes( region, context->buffer, &size ) ) {
448 goto FAILURE;
449 }
450
451 top = *context->lastPerRegionPtr;
452
453 for ( i = 0; i < top; i++ ) {
454
455 ptr = context->buffer + *context->lastAddressPtr - VMRegionAddress(region);
456 if ( 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 ( 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.061516 seconds and 4 git commands to generate.