mirror of
https://github.com/Dasharo/zephyr.git
synced 2026-03-06 14:57:20 -08:00
`z_is_t1_higher_prio_than_t2` was being called twice in both the context-switch fastpath and in `z_priq_rb_lessthan`, just to dealing with priority ties. In addition, the API was error-prone (and too much in the fastpath to be able to assert its invarients) - see also #32710 for a previous example of this API breaking and returning a>b but also b>a. Replacing this with a direct 3-way comparison `z_cmp_t1_prio_with_t2` sidesteps most of these issues. There is still a concern that `sgn(z_cmp_t1_prio_with_t2(a,b)) != -sgn(z_cmp_t1_prio_with_t2(b,a))` but I don't see any way to alleviate this aside from adding an assert to the fastpath. Signed-off-by: James Harris <james.harris@intel.com>