1 typedef __SIZE_TYPE__ size_t;
2 typedef const struct objc_selector
3 {
4   void *sel_id;
5 }
6  *SEL;
7 typedef struct objc_object
8 {
9 }
10  *id;
11 typedef struct objc_class *Class;
12 struct objc_class
13 {
14   struct sarray *dtable;
15 };
16 typedef size_t sidx;
17 struct soffset
18 {
19   unsigned int boffset:(sizeof (size_t) * 8) / 2;
20   unsigned int eoffset:(sizeof (size_t) * 8) / 2;
21 };
22 union sofftype
23 {
24   struct soffset off;
25   sidx idx;
26 };
27 struct sarray
28 {
29   size_t capacity;
30 };
31 static __inline__ unsigned int
soffset_decode(sidx indx)32 soffset_decode (sidx indx)
33 {
34   union sofftype x;
35   x.idx = indx;
36   return x.off.eoffset + (x.off.boffset * (1 << 5));
37 }
38 static __inline__ void *
sarray_get_safe(struct sarray * array,sidx indx)39 sarray_get_safe (struct sarray *array, sidx indx)
40 {
41   if (soffset_decode (indx) < array->capacity)
42     return (void *)sarray_get (array, indx);
43 }
44 void *
get_imp(Class class,SEL sel)45 get_imp (Class class, SEL sel)
46 {
47   void *res = sarray_get_safe (class->dtable, (size_t) sel->sel_id);
48   if (res == 0)
49     {
50 	{
51 	  res = get_imp (class, sel);
52 	}
53     }
54 }
55