5 // Created by Chaz McGarvey on 12/28/04.
6 // Copyright 2004 Chaz McGarvey. All rights reserved.
13 * WARNING! BEWARE! WATCH OUT!
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.
19 * You have been warned.
23 /* Here are some handy functions used in this file. */
25 void ReportSearchProgress( ThreadedTask
*task
, unsigned iteration
, unsigned regions
, int *progress
)
27 int newProgress
= (iteration
* 100) / regions
;
28 if ( newProgress
> *progress
) {
29 *progress
= newProgress
;
30 [task reportProgress
:newProgress
];
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...
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);}
52 #pragma mark Search Functions
55 int SearchIteration( ThreadedTask
*task
, unsigned iteration
)
57 SearchContext
*context
= [task context
];
59 unsigned hitsPerRegion
= 0;
65 region
= VMNextRegionWithAttributes( context
->process
, context
->lastRegion
, VMREGION_READABLE | VMREGION_WRITABLE
);
66 if ( VMRegionIsNotNull( region
) ) {
68 if ( context
->bufferSize
< VMRegionSize( region
) ) {
69 char *buf
= realloc( context
->buffer
, VMRegionSize( region
) );
71 context
->buffer
= buf
;
72 context
->bufferSize
= VMRegionSize( region
);
79 if ( !VMRegionBytes( region
, context
->buffer
, &size
) ) {
83 ptr
= context
->buffer
;
84 top
= context
->buffer
+ VMRegionSize( region
);
85 offset
= VMRegionAddress( region
) - (TCAddress
)context
->buffer
;
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
;
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
);
98 *context
->addressPtr
= (TCAddress
)ptr
+ offset
;
99 memcpy( context
->valuePtr
, ptr
, TCArrayElementSize( context
->values
) );
101 context
->numberOfResults
++;
104 context
->addressPtr
++;
105 context
->valuePtr
+= TCArrayElementSize( context
->values
);
108 ptr
+= TCArrayElementSize( context
->values
);
112 if ( hitsPerRegion
> 0 ) {
113 TCAddress addr
= VMRegionAddress( region
);
114 unsigned index
= TCArrayElementCount( context
->regions
);
115 unsigned newsize
= index
+ 1;
117 TCArrayResize( context
->regions
, newsize
);
118 TCArrayResize( context
->perRegion
, newsize
);
120 TCArraySetElementAtIndex( context
->regions
, index
, &addr
);
121 TCArraySetElementAtIndex( context
->perRegion
, index
, &hitsPerRegion
);
124 ReportSearchProgress( task
, iteration
, context
->regionCount
, &context
->progress
);
126 context
->lastRegion
= region
;
130 free( context
->buffer
);
131 context
->buffer
= NULL
;
132 TCArrayResize( context
->addresses
, context
->numberOfResults
);
133 TCArrayResize( context
->values
, context
->numberOfResults
);
139 int SearchIterationAgain( ThreadedTask
*task
, unsigned iteration
)
141 SearchContext
*context
= [task context
];
143 unsigned hitsPerRegion
= 0;
149 if ( iteration
< TCArrayElementCount( context
->lastRegions
) ) {
151 context
->lastRegion
= VMMakeRegion( context
->process
, *(context
->lastRegionPtr
), 0 );
152 region
= VMNextRegionWithAttributes( context
->process
, context
->lastRegion
, VMREGION_READABLE | VMREGION_WRITABLE
);
153 if ( VMRegionIsNotNull( region
) ) {
155 if ( context
->bufferSize
< VMRegionSize( region
) ) {
156 char *buf
= realloc( context
->buffer
, VMRegionSize( region
) );
158 context
->buffer
= buf
;
159 context
->bufferSize
= VMRegionSize( region
);
166 if ( !VMRegionBytes( region
, context
->buffer
, &size
) ) {
170 top
= *context
->lastPerRegionPtr
;
172 for ( i
= 0; i
< top
; i
++ ) {
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
;
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
);
185 *context
->addressPtr
= *context
->lastAddressPtr
;
186 memcpy( context
->valuePtr
, ptr
, TCArrayElementSize( context
->values
) );
188 context
->numberOfResults
++;
191 context
->addressPtr
++;
192 context
->valuePtr
+= TCArrayElementSize( context
->values
);
195 context
->lastAddressPtr
++;
200 context
->lastRegionPtr
++;
201 context
->lastPerRegionPtr
++;
203 if ( hitsPerRegion
> 0 ) {
204 TCAddress addr
= VMRegionAddress( region
);
205 unsigned index
= TCArrayElementCount( context
->regions
);
206 unsigned newsize
= index
+ 1;
208 TCArrayResize( context
->regions
, newsize
);
209 TCArrayResize( context
->perRegion
, newsize
);
211 TCArraySetElementAtIndex( context
->regions
, index
, &addr
);
212 TCArraySetElementAtIndex( context
->perRegion
, index
, &hitsPerRegion
);
215 ReportSearchProgress( task
, iteration
, context
->regionCount
, &context
->progress
);
217 context
->lastRegion
= region
;
221 free( context
->buffer
);
222 context
->buffer
= NULL
;
223 TCArrayResize( context
->addresses
, context
->numberOfResults
);
224 TCArrayResize( context
->values
, context
->numberOfResults
);
230 int SearchIterationLastValue( ThreadedTask
*task
, unsigned iteration
)
232 SearchContext
*context
= [task context
];
234 unsigned hitsPerRegion
= 0;
240 if ( iteration
< TCArrayElementCount( context
->lastRegions
) ) {
242 context
->lastRegion
= VMMakeRegion( context
->process
, *(context
->lastRegionPtr
), 0 );
243 region
= VMNextRegionWithAttributes( context
->process
, context
->lastRegion
, VMREGION_READABLE | VMREGION_WRITABLE
);
244 if ( VMRegionIsNotNull( region
) ) {
246 if ( context
->bufferSize
< VMRegionSize( region
) ) {
247 char *buf
= realloc( context
->buffer
, VMRegionSize( region
) );
249 context
->buffer
= buf
;
250 context
->bufferSize
= VMRegionSize( region
);
257 if ( !VMRegionBytes( region
, context
->buffer
, &size
) ) {
261 top
= *context
->lastPerRegionPtr
;
263 for ( i
= 0; i
< top
; i
++ ) {
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
;
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
);
276 *context
->addressPtr
= *context
->lastAddressPtr
;
277 memcpy( context
->valuePtr
, ptr
, TCArrayElementSize(context
->values
) );
279 context
->numberOfResults
++;
282 context
->addressPtr
++;
283 context
->valuePtr
+= TCArrayElementSize(context
->values
);
286 context
->lastAddressPtr
++;
287 context
->lastValuePtr
+= TCArrayElementSize(context
->values
);
292 context
->lastRegionPtr
++;
293 context
->lastPerRegionPtr
++;
295 if ( hitsPerRegion
> 0 ) {
296 TCAddress addr
= VMRegionAddress( region
);
297 unsigned index
= TCArrayElementCount( context
->regions
);
298 unsigned newsize
= index
+ 1;
300 TCArrayResize( context
->regions
, newsize
);
301 TCArrayResize( context
->perRegion
, newsize
);
303 TCArraySetElementAtIndex( context
->regions
, index
, &addr
);
304 TCArraySetElementAtIndex( context
->perRegion
, index
, &hitsPerRegion
);
307 ReportSearchProgress( task
, iteration
, context
->regionCount
, &context
->progress
);
309 context
->lastRegion
= region
;
313 free( context
->buffer
);
314 context
->buffer
= NULL
;
315 TCArrayResize( context
->addresses
, context
->numberOfResults
);
316 TCArrayResize( context
->values
, context
->numberOfResults
);
323 int SearchStringIteration( ThreadedTask
*task
, unsigned iteration
)
325 SearchContext
*context
= [task context
];
327 unsigned hitsPerRegion
= 0;
330 void *ptr
, *top
, *hit
;
333 region
= VMNextRegionWithAttributes( context
->process
, context
->lastRegion
, VMREGION_READABLE | VMREGION_WRITABLE
);
334 if ( VMRegionIsNotNull( region
) ) {
336 if ( context
->bufferSize
< VMRegionSize(region
) ) {
337 char *buf
= realloc( context
->buffer
, VMRegionSize( region
) );
339 context
->buffer
= buf
;
340 context
->bufferSize
= VMRegionSize(region
);
347 if ( !VMRegionBytes( region
, context
->buffer
, &size
) ) {
351 ptr
= context
->buffer
;
352 top
= context
->buffer
+ VMRegionSize( region
);
353 offset
= VMRegionAddress( region
) - (TCAddress
)context
->buffer
;
356 hit
= bmsearch( context
->value
->_value
, context
->value
->_size
, ptr
, top
- ptr
);
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
;
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
);
367 *context
->addressPtr
= (TCAddress
)hit
+ offset
;
368 memcpy( context
->valuePtr
, hit
, context
->value
->_size
);
369 context
->addressPtr
++;
370 context
->valuePtr
+= context
->value
->_size
;
372 context
->numberOfResults
++;
381 if ( hitsPerRegion
> 0 ) {
382 TCAddress addr
= VMRegionAddress( region
);
383 unsigned index
= TCArrayElementCount( context
->regions
);
384 unsigned newsize
= index
+ 1;
386 TCArrayResize( context
->regions
, newsize
);
387 TCArrayResize( context
->perRegion
, newsize
);
389 TCArraySetElementAtIndex( context
->regions
, index
, &addr
);
390 TCArraySetElementAtIndex( context
->perRegion
, index
, &hitsPerRegion
);
393 ReportSearchProgress( task
, iteration
, context
->regionCount
, &context
->progress
);
395 context
->lastRegion
= region
;
399 free( context
->buffer
);
400 context
->buffer
= NULL
;
401 TCArrayResize( context
->addresses
, context
->numberOfResults
);
402 TCArrayResize( context
->values
, context
->numberOfResults
);
407 int SearchStringIterationAgain( ThreadedTask
*task
, unsigned iteration
)
409 SearchContext
*context
= [task context
];
411 unsigned hitsPerRegion
= 0;
417 if ( iteration
< TCArrayElementCount( context
->lastRegions
) ) {
419 context
->lastRegion
= VMMakeRegion( context
->process
, *(context
->lastRegionPtr
), 0 );
420 region
= VMNextRegionWithAttributes( context
->process
, context
->lastRegion
, VMREGION_READABLE | VMREGION_WRITABLE
);
421 if ( VMRegionIsNotNull( region
) ) {
423 if ( context
->bufferSize
< VMRegionSize( region
) ) {
424 char *buf
= realloc( context
->buffer
, VMRegionSize( region
) );
426 context
->buffer
= buf
;
427 context
->bufferSize
= VMRegionSize( region
);
434 if ( !VMRegionBytes( region
, context
->buffer
, &size
) ) {
438 top
= *context
->lastPerRegionPtr
;
440 for ( i
= 0; i
< top
; i
++ ) {
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
;
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
);
453 *context
->addressPtr
= *context
->lastAddressPtr
;
454 memcpy( context
->valuePtr
, ptr
, TCArrayElementSize( context
->values
) );
455 context
->addressPtr
++;
456 context
->valuePtr
+= TCArrayElementSize( context
->values
);
458 context
->numberOfResults
++;
462 context
->lastAddressPtr
++;
467 context
->lastRegionPtr
++;
468 context
->lastPerRegionPtr
++;
470 if ( hitsPerRegion
> 0 ) {
471 TCAddress addr
= VMRegionAddress( region
);
472 unsigned index
= TCArrayElementCount( context
->regions
);
473 unsigned newsize
= index
+ 1;
475 TCArrayResize( context
->regions
, newsize
);
476 TCArrayResize( context
->perRegion
, newsize
);
478 TCArraySetElementAtIndex( context
->regions
, index
, &addr
);
479 TCArraySetElementAtIndex( context
->perRegion
, index
, &hitsPerRegion
);
482 ReportSearchProgress( task
, iteration
, context
->regionCount
, &context
->progress
);
484 context
->lastRegion
= region
;
488 free( context
->buffer
);
489 context
->buffer
= NULL
;
490 TCArrayResize( context
->addresses
, context
->numberOfResults
);
491 TCArrayResize( context
->values
, context
->numberOfResults
);
496 int SearchStringIterationLastValue( ThreadedTask
*task
, unsigned iteration
)
498 SearchContext
*context
= [task context
];
500 unsigned hitsPerRegion
= 0;
506 if ( iteration
< TCArrayElementCount( context
->lastRegions
) ) {
508 context
->lastRegion
= VMMakeRegion( context
->process
, *(context
->lastRegionPtr
), 0 );
509 region
= VMNextRegionWithAttributes( context
->process
, context
->lastRegion
, VMREGION_READABLE | VMREGION_WRITABLE
);
510 if ( VMRegionIsNotNull( region
) ) {
512 if ( context
->bufferSize
< VMRegionSize( region
) ) {
513 char *buf
= realloc( context
->buffer
, VMRegionSize( region
) );
515 context
->buffer
= buf
;
516 context
->bufferSize
= VMRegionSize( region
);
523 if ( !VMRegionBytes( region
, context
->buffer
, &size
) ) {
527 top
= *context
->lastPerRegionPtr
;
529 for ( i
= 0; i
< top
; i
++ ) {
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
;
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
);
542 *context
->addressPtr
= *context
->lastAddressPtr
;
543 memcpy( context
->valuePtr
, ptr
, TCArrayElementSize(context
->values
) );
544 context
->addressPtr
++;
545 context
->valuePtr
+= TCArrayElementSize(context
->values
);
547 context
->numberOfResults
++;
551 context
->lastAddressPtr
++;
552 context
->lastValuePtr
+= TCArrayElementSize(context
->lastValues
);
557 context
->lastRegionPtr
++;
558 context
->lastPerRegionPtr
++;
560 if ( hitsPerRegion
> 0 ) {
561 TCAddress addr
= VMRegionAddress( region
);
562 unsigned index
= TCArrayElementCount( context
->regions
);
563 unsigned newsize
= index
+ 1;
565 TCArrayResize( context
->regions
, newsize
);
566 TCArrayResize( context
->perRegion
, newsize
);
568 TCArraySetElementAtIndex( context
->regions
, index
, &addr
);
569 TCArraySetElementAtIndex( context
->perRegion
, index
, &hitsPerRegion
);
572 ReportSearchProgress( task
, iteration
, context
->regionCount
, &context
->progress
);
574 context
->lastRegion
= region
;
578 free( context
->buffer
);
579 context
->buffer
= NULL
;
580 TCArrayResize( context
->addresses
, context
->numberOfResults
);
581 TCArrayResize( context
->values
, context
->numberOfResults
);
589 #pragma mark Comparison Functions
593 BOOL EqualInt64( void const *first
, void const *second
) {
594 return *(SInt64
*)first
== *(SInt64
*)second
;
596 BOOL EqualInt32( void const *first
, void const *second
) {
597 return *(SInt32
*)first
== *(SInt32
*)second
;
599 BOOL EqualInt16( void const *first
, void const *second
) {
600 return *(SInt16
*)first
== *(SInt16
*)second
;
602 BOOL EqualInt8( void const *first
, void const *second
) {
603 return *(SInt8
*)first
== *(SInt8
*)second
;
605 BOOL EqualUInt64( void const *first
, void const *second
) {
606 return *(UInt64
*)first
== *(UInt64
*)second
;
608 BOOL EqualUInt32( void const *first
, void const *second
) {
609 return *(UInt32
*)first
== *(UInt32
*)second
;
611 BOOL EqualUInt16( void const *first
, void const *second
) {
612 return *(UInt16
*)first
== *(UInt16
*)second
;
614 BOOL EqualUInt8( void const *first
, void const *second
) {
615 return *(UInt8
*)first
== *(UInt8
*)second
;
617 BOOL EqualFloat( void const *first
, void const *second
) {
618 return TC_EPSILON
> ABS( *(float *)first
- *(float *)second
);
620 BOOL EqualDouble( void const *first
, void const *second
) {
621 return TC_EPSILON
> ABS( *(double *)first
- *(double *)second
);
624 BOOL NotEqualInt64( void const *first
, void const *second
) {
625 return *(SInt64
*)first
!= *(SInt64
*)second
;
627 BOOL NotEqualInt32( void const *first
, void const *second
) {
628 return *(SInt32
*)first
!= *(SInt32
*)second
;
630 BOOL NotEqualInt16( void const *first
, void const *second
) {
631 return *(SInt16
*)first
!= *(SInt16
*)second
;
633 BOOL NotEqualInt8( void const *first
, void const *second
) {
634 return *(SInt8
*)first
!= *(SInt8
*)second
;
636 BOOL NotEqualUInt64( void const *first
, void const *second
) {
637 return *(UInt64
*)first
!= *(UInt64
*)second
;
639 BOOL NotEqualUInt32( void const *first
, void const *second
) {
640 return *(UInt32
*)first
!= *(UInt32
*)second
;
642 BOOL NotEqualUInt16( void const *first
, void const *second
) {
643 return *(UInt16
*)first
!= *(UInt16
*)second
;
645 BOOL NotEqualUInt8( void const *first
, void const *second
) {
646 return *(UInt8
*)first
!= *(UInt8
*)second
;
648 BOOL NotEqualFloat( void const *first
, void const *second
) {
649 return TC_EPSILON
<= ABS( *(float *)first
- *(float *)second
);
651 BOOL NotEqualDouble( void const *first
, void const *second
) {
652 return TC_EPSILON
<= ABS( *(double *)first
- *(double *)second
);
655 BOOL LessThanInt64( void const *first
, void const *second
) {
656 return *(SInt64
*)first
< *(SInt64
*)second
;
658 BOOL LessThanInt32( void const *first
, void const *second
) {
659 return *(SInt32
*)first
< *(SInt32
*)second
;
661 BOOL LessThanInt16( void const *first
, void const *second
) {
662 return *(SInt16
*)first
< *(SInt16
*)second
;
664 BOOL LessThanInt8( void const *first
, void const *second
) {
665 return *(SInt8
*)first
< *(SInt8
*)second
;
667 BOOL LessThanUInt64( void const *first
, void const *second
) {
668 return *(UInt64
*)first
< *(UInt64
*)second
;
670 BOOL LessThanUInt32( void const *first
, void const *second
) {
671 return *(UInt32
*)first
< *(UInt32
*)second
;
673 BOOL LessThanUInt16( void const *first
, void const *second
) {
674 return *(UInt16
*)first
< *(UInt16
*)second
;
676 BOOL LessThanUInt8( void const *first
, void const *second
) {
677 return *(UInt8
*)first
< *(UInt8
*)second
;
679 BOOL LessThanFloat( void const *first
, void const *second
) {
680 return *(float *)first
< *(float *)second
;
682 BOOL LessThanDouble( void const *first
, void const *second
) {
683 return *(double *)first
< *(double *)second
;
686 BOOL GreaterThanInt64( void const *first
, void const *second
) {
687 return *(SInt64
*)first
> *(SInt64
*)second
;
689 BOOL GreaterThanInt32( void const *first
, void const *second
) {
690 return *(SInt32
*)first
> *(SInt32
*)second
;
692 BOOL GreaterThanInt16( void const *first
, void const *second
) {
693 return *(SInt16
*)first
> *(SInt16
*)second
;
695 BOOL GreaterThanInt8( void const *first
, void const *second
) {
696 return *(SInt8
*)first
> *(SInt8
*)second
;
698 BOOL GreaterThanUInt64( void const *first
, void const *second
) {
699 return *(UInt64
*)first
> *(UInt64
*)second
;
701 BOOL GreaterThanUInt32( void const *first
, void const *second
) {
702 return *(UInt32
*)first
> *(UInt32
*)second
;
704 BOOL GreaterThanUInt16( void const *first
, void const *second
) {
705 return *(UInt16
*)first
> *(UInt16
*)second
;
707 BOOL GreaterThanUInt8( void const *first
, void const *second
) {
708 return *(UInt8
*)first
> *(UInt8
*)second
;
710 BOOL GreaterThanFloat( void const *first
, void const *second
) {
711 return *(float *)first
> *(float *)second
;
713 BOOL GreaterThanDouble( void const *first
, void const *second
) {
714 return *(double *)first
> *(double *)second
;