From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7meQ-0004n1-U4 for qemu-devel@nongnu.org; Tue, 31 May 2016 12:36:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7meP-0003BJ-Ox for qemu-devel@nongnu.org; Tue, 31 May 2016 12:36:18 -0400 From: Laurent Vivier Date: Tue, 31 May 2016 18:35:50 +0200 Message-Id: <1464712565-14857-2-git-send-email-lvivier@redhat.com> In-Reply-To: <1464712565-14857-1-git-send-email-lvivier@redhat.com> References: <1464712565-14857-1-git-send-email-lvivier@redhat.com> Subject: [Qemu-devel] [PATCH 01/16] coccinelle: use macro DIV_ROUND_UP instead of (((n) + (d) - 1) /(d)) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-trivial@nongnu.org, qemu-devel@nongnu.org Cc: Laurent Vivier sample from http://coccinellery.org/ Signed-off-by: Laurent Vivier --- scripts/coccinelle/round.cocci | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/coccinelle/round.cocci diff --git a/scripts/coccinelle/round.cocci b/scripts/coccinelle/round.cocci new file mode 100644 index 0000000..ed06773 --- /dev/null +++ b/scripts/coccinelle/round.cocci @@ -0,0 +1,19 @@ +// Use macro DIV_ROUND_UP instead of (((n) + (d) - 1) /(d)) +@@ +expression e1; +expression e2; +@@ +( +- ((e1) + e2 - 1) / (e2) ++ DIV_ROUND_UP(e1,e2) +| +- ((e1) + (e2 - 1)) / (e2) ++ DIV_ROUND_UP(e1,e2) +) + +@@ +expression e1; +expression e2; +@@ +-(DIV_ROUND_UP(e1,e2)) ++DIV_ROUND_UP(e1,e2) -- 2.5.5