slirp: use DIV_ROUND_UP

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>
This commit is contained in:
Marc-André Lureau 2017-06-22 14:41:45 +02:00 committed by Samuel Thibault
parent 4871b51b92
commit e88718fc0b

View File

@ -57,9 +57,9 @@ static inline bool in6_equal_mach(const struct in6_addr *a,
const struct in6_addr *b, const struct in6_addr *b,
int prefix_len) int prefix_len)
{ {
if (memcmp(&(a->s6_addr[(prefix_len + 7) / 8]), if (memcmp(&(a->s6_addr[DIV_ROUND_UP(prefix_len, 8)]),
&(b->s6_addr[(prefix_len + 7) / 8]), &(b->s6_addr[DIV_ROUND_UP(prefix_len, 8)]),
16 - (prefix_len + 7) / 8) != 0) { 16 - DIV_ROUND_UP(prefix_len, 8)) != 0) {
return 0; return 0;
} }