mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
Fixed an operator precedence issue in codel_impl.h
The get_next_interval_sqrt function has the line: __u64 val = (__u64)CODEL_EXCEED_INTERVAL << 16 / get_sqrt_sh16(cnt); However, the division operator has higher precedence than the shift operator. Therefore, 16 / get_sqrt_sh16(cnt) will always evaluate to zero. Signed-off-by: Frey Alfredsson <freysteinn@freysteinn.com>
This commit is contained in:
@@ -69,7 +69,7 @@ static __always_inline __u32 get_sqrt_sh16(__u64 cnt)
|
||||
|
||||
static __always_inline __u64 get_next_interval_sqrt(__u64 cnt)
|
||||
{
|
||||
__u64 val = (__u64)CODEL_EXCEED_INTERVAL << 16 / get_sqrt_sh16(cnt);
|
||||
__u64 val = ((__u64)CODEL_EXCEED_INTERVAL << 16) / get_sqrt_sh16(cnt);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user