void v_rptr (Vector vec, void *data) { uintptr_t p = (uintptr_t) data; p -= (uintptr_t) vec->data; p /= vec->siz; if (p < 0 || p >= vec->len) return; v_rem (vec, p); }
void t_flush () { if (times == NULL) return; int i; for (i = 0; i < times->len; ++ i) { struct Timer *t = v_at (times, i); if ((t->flags & TMR_STOP) == 0) continue; t->callback (t->arg); v_rem (times, i); -- i; } }
void t_idle () { if (times == NULL) return; int i, current = SDL_GetTicks (); for (i = 0; i < times->len; ++ i) { struct Timer *t = v_at (times, i); if (t->time >= current) continue; t->callback (t->arg); v_rem (times, i); -- i; } }