summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2010-11-15 12:09:34 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2010-11-15 14:39:13 -0800
commitb0403ab1ce1bba4de3a26d6436d739d167c93c37 (patch)
tree3cc3fa8c9b9aec0af06798f8880e73108c65e051
parentcbb32e4e27b4bbff638fa2f3d35b6ba53ab0d20c (diff)
Fold RadixSort_() into -[NSMutableArray(Radix) radixSortUsingFunction:withContext:].
-rw-r--r--MobileCydia.mm32
1 files changed, 14 insertions, 18 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 6dd79d2..6a73c60 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -419,7 +419,20 @@ struct RadixItem_ {
uint32_t key;
};
-static void RadixSort_(NSMutableArray *self, size_t count, struct RadixItem_ *swap) {
+@implementation NSMutableArray (Radix)
+
+- (void) radixSortUsingFunction:(SKRadixFunction)function withContext:(void *)argument {
+ size_t count([self count]);
+ struct RadixItem_ *swap(new RadixItem_[count * 2]);
+
+ for (size_t i(0); i != count; ++i) {
+ RadixItem_ &item(swap[i]);
+ item.index = i;
+
+ id object([self objectAtIndex:i]);
+ item.key = function(object, argument);
+ }
+
struct RadixItem_ *lhs(swap), *rhs(swap + count);
static const size_t width = 32;
@@ -469,23 +482,6 @@ static void RadixSort_(NSMutableArray *self, size_t count, struct RadixItem_ *sw
delete [] swap;
}
-@implementation NSMutableArray (Radix)
-
-- (void) radixSortUsingFunction:(SKRadixFunction)function withContext:(void *)argument {
- size_t count([self count]);
- struct RadixItem_ *swap(new RadixItem_[count * 2]);
-
- for (size_t i(0); i != count; ++i) {
- RadixItem_ &item(swap[i]);
- item.index = i;
-
- id object([self objectAtIndex:i]);
- item.key = function(object, argument);
- }
-
- RadixSort_(self, count, swap);
-}
-
@end
/* }}} */
/* Insertion Sort {{{ */