summaryrefslogtreecommitdiff
path: root/Menes
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-03-07 13:21:32 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-08 01:50:59 -0800
commit9c5737d51187a49f64adf864939f1d312eee410e (patch)
treeee9f3c029ce75ba269af7a38c45f9a602745e5e7 /Menes
parentc28bc6f17b73cc9da12bef41c6f69d1595466df4 (diff)
First draft of relevancy sorted search.
Diffstat (limited to 'Menes')
-rw-r--r--Menes/radixSortWithSelector.h1
-rw-r--r--Menes/radixSortWithSelector.mm10
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