mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-03 03:52:38 +00:00
[OPTIM] add compiler hints in tick_is_expired()
adding those two unlikely() reduces the number of branches taken in the common path and the size of the code.
This commit is contained in:
parent
3537467679
commit
534c5a2224
@ -82,9 +82,11 @@ static inline int tick_add_ifset(int now, int timeout)
|
|||||||
/* return 1 if timer <timer> is expired at date <now>, otherwise zero */
|
/* return 1 if timer <timer> is expired at date <now>, otherwise zero */
|
||||||
static inline int tick_is_expired(int timer, int now)
|
static inline int tick_is_expired(int timer, int now)
|
||||||
{
|
{
|
||||||
if (!tick_isset(timer))
|
if (unlikely(!tick_isset(timer)))
|
||||||
return 0;
|
return 0;
|
||||||
return (timer - now) <= 0;
|
if (unlikely((timer - now) <= 0))
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return the first one of the two timers, both of which may be infinite */
|
/* return the first one of the two timers, both of which may be infinite */
|
||||||
|
Loading…
Reference in New Issue
Block a user