static void ptimer_reload(ptimer_state *s)

{

    if (s->delta == 0) {

        ptimer_trigger(s);

        s->delta = s->limit;

    }

    if (s->delta == 0 || s->period == 0) {

        fprintf(stderr, "Timer with period zero, disabling\n");

        s->enabled = 0;

        return;

    }



    s->last_event = s->next_event;

    s->next_event = s->last_event + s->delta * s->period;

    if (s->period_frac) {

        s->next_event += ((int64_t)s->period_frac * s->delta) >> 32;

    }

    timer_mod(s->timer, s->next_event);

}

static void ptimer_reload(ptimer_state *s)

{

    if (s->delta == 0) {

        ptimer_trigger(s);

        s->delta = s->limit;

    }

    if (s->delta == 0 || s->period == 0) {

        fprintf(stderr, "Timer with period zero, disabling\n");

        s->enabled = 0;

        return;

    }



    s->last_event = s->next_event;

    s->next_event = s->last_event + s->delta * s->period;

    if (s->period_frac) {

        s->next_event += ((int64_t)s->period_frac * s->delta) >> 32;

    }

    timer_mod(s->timer, s->next_event);

}

static void FUNC_0(ptimer_state *VAR_0)

{

    if (VAR_0->delta == 0) {

        ptimer_trigger(VAR_0);

        VAR_0->delta = VAR_0->limit;

    }

    if (VAR_0->delta == 0 || VAR_0->period == 0) {

        fprintf(stderr, "Timer with period zero, disabling\n");

        VAR_0->enabled = 0;

        return;

    }



    VAR_0->last_event = VAR_0->next_event;

    VAR_0->next_event = VAR_0->last_event + VAR_0->delta * VAR_0->period;

    if (VAR_0->period_frac) {

        VAR_0->next_event += ((int64_t)VAR_0->period_frac * VAR_0->delta) >> 32;

    }

    timer_mod(VAR_0->timer, VAR_0->next_event);

}

static void FUNC_0(ptimer_state *VAR_0)
{ if (VAR_0->delta == 0) { ptimer_trigger(VAR_0); VAR_0->delta = VAR_0->limit; } if (VAR_0->delta == 0 || VAR_0->period == 0) { fprintf(stderr, "Timer with period zero, disabling\n"); VAR_0->enabled = 0; return; } VAR_0->last_event = VAR_0->next_event; VAR_0->next_event = VAR_0->last_event + VAR_0->delta * VAR_0->period; if (VAR_0->period_frac) { VAR_0->next_event += ((int64_t)VAR_0->period_frac * VAR_0->delta) >> 32; } timer_mod(VAR_0->timer, VAR_0->next_event); }