Mercurial > MadButterfly
comparison include/mb_tools.h @ 250:bd8ea44b421e
Fix bug and finish unit test for collision testing in event.c.
- mock for cairo, rdman, coord, and shape should be refactoried to a module.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 04 Jan 2009 11:42:32 +0800 |
parents | 65cabbdd5284 |
children | 44b8223f307c |
comparison
equal
deleted
inserted
replaced
245:81458bb0bf34 | 250:bd8ea44b421e |
---|---|
59 if((q).tail == (elm)) \ | 59 if((q).tail == (elm)) \ |
60 (q).tail = _stailq_cur; \ | 60 (q).tail = _stailq_cur; \ |
61 } \ | 61 } \ |
62 } \ | 62 } \ |
63 } while(0) | 63 } while(0) |
64 #define STAILQ_FOR_EACH(q, type, field, elm) \ | |
65 for((elm) = (q).head; \ | |
66 (elm) != NULL; \ | |
67 (elm) = (elm)->field) | |
64 | 68 |
65 /*! \defgroup darray Dynamic Array | 69 /*! \defgroup darray Dynamic Array |
66 * | 70 * |
67 * DARRAY is a dynamic sized array/list, it's length is a variable. | 71 * DARRAY is a dynamic sized array/list, it's length is a variable. |
68 * It is extended, automatically, if it is full and more elemnts are | 72 * It is extended, automatically, if it is full and more elemnts are |
132 | 136 |
133 #define OFFSET(type, mem) (((void *)&((type *)NULL)->mem) - NULL) | 137 #define OFFSET(type, mem) (((void *)&((type *)NULL)->mem) - NULL) |
134 #define MEM2OBJ(var, type, mem) ((type *)((void *)var - OFFSET(type, mem))) | 138 #define MEM2OBJ(var, type, mem) ((type *)((void *)var - OFFSET(type, mem))) |
135 #define OFF2TYPE(obj, off, type) (*(type *)((void *)(obj) + (off))) | 139 #define OFF2TYPE(obj, off, type) (*(type *)((void *)(obj) + (off))) |
136 | 140 |
141 #define MAX(a, b) ((a) > (b)? (a): (b)) | |
142 #define MIN(a, b) ((a) < (b)? (a): (b)) | |
143 | |
137 #endif /* __TOOLS_H_ */ | 144 #endif /* __TOOLS_H_ */ |