Skip to content

Commit

Permalink
slirp: use DIV_ROUND_UP
Browse files Browse the repository at this point in the history
I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
  • Loading branch information
elmarco authored and sthibaul committed Jul 15, 2017
1 parent 4871b51 commit e88718f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions slirp/ip6.h
Expand Up @@ -57,9 +57,9 @@ static inline bool in6_equal_mach(const struct in6_addr *a,
const struct in6_addr *b,
int prefix_len)
{
if (memcmp(&(a->s6_addr[(prefix_len + 7) / 8]),
&(b->s6_addr[(prefix_len + 7) / 8]),
16 - (prefix_len + 7) / 8) != 0) {
if (memcmp(&(a->s6_addr[DIV_ROUND_UP(prefix_len, 8)]),
&(b->s6_addr[DIV_ROUND_UP(prefix_len, 8)]),
16 - DIV_ROUND_UP(prefix_len, 8)) != 0) {
return 0;
}

Expand Down

0 comments on commit e88718f

Please sign in to comment.