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