aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-22 14:41:45 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2017-07-15 14:28:25 +0200
commitc0870d703b1c5a7bb6c573c585957751b3971f4e (patch)
treeff3eb3d721ac51c6195bc7b80ef24c6aac2ebe13
parentc2eda25bd2b38c7eb09fd279bcdafb1bd59fac69 (diff)
downloadslirp-c0870d703b1c5a7bb6c573c585957751b3971f4e.zip
slirp-c0870d703b1c5a7bb6c573c585957751b3971f4e.tar.gz
slirp-c0870d703b1c5a7bb6c573c585957751b3971f4e.tar.bz2
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>
-rw-r--r--ip6.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/ip6.h b/ip6.h
index b0c1526..9760d4f 100644
--- a/ip6.h
+++ b/ip6.h
@@ -119,9 +119,9 @@ static inline bool in6_equal_net(const struct in6_addr *a,
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;
}