diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-07 13:21:32 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-08 01:50:59 -0800 |
commit | 9c5737d51187a49f64adf864939f1d312eee410e (patch) | |
tree | ee9f3c029ce75ba269af7a38c45f9a602745e5e7 /Menes | |
parent | c28bc6f17b73cc9da12bef41c6f69d1595466df4 (diff) |
First draft of relevancy sorted search.
Diffstat (limited to 'Menes')
-rw-r--r-- | Menes/radixSortWithSelector.h | 1 | ||||
-rw-r--r-- | Menes/radixSortWithSelector.mm | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/Menes/radixSortWithSelector.h b/Menes/radixSortWithSelector.h index d148cb3..4438584 100644 --- a/Menes/radixSortWithSelector.h +++ b/Menes/radixSortWithSelector.h @@ -46,6 +46,7 @@ typedef uint32_t (*MenesRadixSortFunction)(id, void *); @interface NSMutableArray (MenesRadixSortWithSelector) - (void) radixSortUsingFunction:(MenesRadixSortFunction)function withContext:(void *)argument; +- (void) radixSortUsingSelector:(SEL)selector; @end #endif//Menes_radixSort_H diff --git a/Menes/radixSortWithSelector.mm b/Menes/radixSortWithSelector.mm index 949a14b..f61dd99 100644 --- a/Menes/radixSortWithSelector.mm +++ b/Menes/radixSortWithSelector.mm @@ -41,6 +41,8 @@ #include "Menes/radixSortWithSelector.h" +#include <objc/runtime.h> + struct RadixItem_ { size_t index; uint32_t key; @@ -109,4 +111,12 @@ struct RadixItem_ { delete [] swap; } +- (void) radixSortUsingSelector:(SEL)selector { + if ([self count] == 0) + return; + + IMP imp(class_getMethodImplementation([[self lastObject] class], selector)); + [self radixSortUsingFunction:reinterpret_cast<MenesRadixSortFunction>(imp) withContext:selector]; +} + @end |