[ovs-dev] [PATCHv2] netflow: Send multiple records for byte counts > UINT32_MAX
Jesse Gross
jesse at nicira.com
Wed Sep 1 09:03:14 PDT 2010
On Wed, Sep 1, 2010 at 1:37 AM, Justin Pettit <jpettit at nicira.com> wrote:
> + while (byte_delta || pkt_delta) {
> + int n_recs = (byte_delta + UINT32_MAX - 1) / UINT32_MAX;
> + uint32_t pkt_count = pkt_delta / n_recs;
> + uint32_t byte_count = byte_delta / n_recs;
I don't think that you should include pkt_delta in the loop condition.
There are two reasons:
1. It should never happen that pkt_delta < byte_delta.
2. If it were to happen that byte_delta is zero and pkt_delta is not,
n_recs will be zero which leads to division by zero in the next two
lines.
This version is a lot easier to read, thanks.
More information about the dev
mailing list