diff options
author | Jeremy Sowden <jeremy@azazel.net> | 2020-03-03 09:48:28 +0000 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2020-03-04 23:36:19 +0100 |
commit | 5f38f3f3afe48213e34654b5a5464af67e40a0e5 (patch) | |
tree | 310e693bf1a4b572da2fa3fe162eadaa5fd083f9 /src | |
parent | 61d93d5fd35c9cbb3c71acc8e3fcc3be82ed3d9e (diff) |
evaluate: simplify calculation of payload size.
Use div_round_up and one statement.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/evaluate.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/evaluate.c b/src/evaluate.c index fda30fd8..e2eff235 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -2236,8 +2236,8 @@ static int stmt_evaluate_payload(struct eval_ctx *ctx, struct stmt *stmt) shift_imm = expr_offset_shift(payload, payload->payload.offset, &extra_len); - payload_byte_size = round_up(payload->len, BITS_PER_BYTE) / BITS_PER_BYTE; - payload_byte_size += (extra_len / BITS_PER_BYTE); + payload_byte_size = div_round_up(payload->len + extra_len, + BITS_PER_BYTE); if (need_csum && payload_byte_size & 1) { payload_byte_size++; |