Index: src/runtime/lookup.m ================================================================== --- src/runtime/lookup.m +++ src/runtime/lookup.m @@ -37,11 +37,12 @@ class_respondsToSelector(Class cls, SEL sel) { if (cls == Nil) return NO; - return (objc_sparsearray_get(cls->dtable, sel->uid) != NULL ? YES : NO); + return (objc_sparsearray_get(cls->dtable, (uint32_t)sel->uid) != NULL + ? YES : NO); } #if !defined(__ELF__) || (!defined(OF_X86_ASM) && !defined(OF_AMD64_ASM)) static id nil_method(id self, SEL _cmd) @@ -55,11 +56,13 @@ IMP imp; if (obj == nil) return (IMP)nil_method; - if ((imp = objc_sparsearray_get(obj->isa->dtable, sel->uid)) == NULL) + imp = objc_sparsearray_get(obj->isa->dtable, (uint32_t)sel->uid); + + if (imp == NULL) return objc_forward_handler(obj, sel); return imp; } @@ -69,13 +72,13 @@ IMP imp; if (super->self == nil) return (IMP)nil_method; - imp = objc_sparsearray_get(super->class->dtable, sel->uid); + imp = objc_sparsearray_get(super->class->dtable, (uint32_t)sel->uid); if (imp == NULL) return objc_forward_handler(super->self, sel); return imp; } #endif Index: src/runtime/selector.m ================================================================== --- src/runtime/selector.m +++ src/runtime/selector.m @@ -103,11 +103,11 @@ sel_getName(SEL sel) { const char *ret; objc_global_mutex_lock(); - ret = objc_sparsearray_get(selectors, sel->uid); + ret = objc_sparsearray_get(selectors, (uint32_t)sel->uid); objc_global_mutex_unlock(); return ret; } Index: src/runtime/sparsearray.m ================================================================== --- src/runtime/sparsearray.m +++ src/runtime/sparsearray.m @@ -26,11 +26,11 @@ static struct objc_sparsearray_level3 *empty_level3 = NULL; static void init(void) { - size_t i; + uint_fast16_t i; empty_level2 = malloc(sizeof(struct objc_sparsearray_level2)); empty_level3 = malloc(sizeof(struct objc_sparsearray_level3)); if (empty_level2 == NULL || empty_level3 == NULL) @@ -47,11 +47,11 @@ struct objc_sparsearray* objc_sparsearray_new(void) { struct objc_sparsearray *s; - size_t i; + uint_fast16_t i; if (empty_level2 == NULL || empty_level3 == NULL) init(); if ((s = malloc(sizeof(struct objc_sparsearray))) == NULL) @@ -65,11 +65,11 @@ void objc_sparsearray_copy(struct objc_sparsearray *dst, struct objc_sparsearray *src) { - size_t i, j, k; + uint_fast16_t i, j, k; uint32_t idx; for (i = 0; i < 256; i++) { if (src->buckets[i]->empty) continue; @@ -100,11 +100,11 @@ uint8_t j = idx >> 8; uint8_t k = idx; if (s->buckets[i]->empty) { struct objc_sparsearray_level2 *t; - size_t l; + uint_fast16_t l; t = malloc(sizeof(struct objc_sparsearray_level2)); if (t == NULL) ERROR("Not enough memory to insert into sparse array!"); @@ -117,11 +117,11 @@ s->buckets[i] = t; } if (s->buckets[i]->buckets[j]->empty) { struct objc_sparsearray_level3 *t; - size_t l; + uint_fast16_t l; t = malloc(sizeof(struct objc_sparsearray_level3)); if (t == NULL) ERROR("Not enough memory to insert into sparse array!"); @@ -138,11 +138,11 @@ } void objc_sparsearray_free(struct objc_sparsearray *s) { - size_t i, j; + uint_fast16_t i, j; for (i = 0; i < 256; i++) { if (s->buckets[i]->empty) continue;