static bool __in_range_p(struct dt_dt_s now, const struct dseq_clo_s *clo) { if (!dt_sandwich_only_t_p(now)) { if (clo->dir > 0) { return dt_dt_in_range_p(now, clo->fst, clo->lst) == 1; } else if (clo->dir < 0) { return dt_dt_in_range_p(now, clo->lst, clo->fst) == 1; } } /* otherwise perform a simple range check */ if (clo->dir > 0) { if (clo->fst.t.u < clo->lst.t.u) { /* dseq A B with A < B */ return now.t.u >= clo->fst.t.u && now.t.u <= clo->lst.t.u; } else { /* dseq A B with A > B and wrap-around, * carries have kindly been stored in d.u */ return now.t.u <= clo->lst.t.u || now.d.u == 0U; } } else if (clo->dir < 0) { if (clo->fst.t.u > clo->lst.t.u) { /* counting down from A to B */ return now.t.u <= clo->fst.t.u && now.t.u >= clo->lst.t.u; } else { /* count down from A to B with wrap around, * carries have kindly been stored in d.u */ return now.t.u >= clo->lst.t.u || now.d.u == 0U; } } return false; }
static bool __in_range_p(struct dt_dt_s now, struct dseq_clo_s *clo) { if (!dt_sandwich_only_t_p(now)) { if (clo->dir > 0) { return dt_dt_in_range_p(now, clo->fst, clo->lst); } else if (clo->dir < 0) { return dt_dt_in_range_p(now, clo->lst, clo->fst); } } /* otherwise perform a simple range check */ if (clo->dir > 0) { if (now.t.u >= clo->fst.t.u && now.t.u <= clo->lst.t.u) { return true; } else if (clo->fst.t.u >= clo->lst.t.u) { return now.t.u <= clo->lst.t.u || now.d.daisydur == 0; } } else if (clo->dir < 0) { if (now.t.u <= clo->fst.t.u && now.t.u >= clo->lst.t.u) { return true; } else if (clo->fst.t.u <= clo->lst.t.u) { return now.t.u >= clo->lst.t.u || now.d.daisydur == 0; } } return false; }