From db718b4b150dd8a732e2b26368eba510b6887f01 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Tue, 31 May 2016 18:35:50 +0200 Subject: coccinelle: use macro DIV_ROUND_UP instead of (((n) + (d) - 1) /(d)) sample from http://coccinellery.org/ Signed-off-by: Laurent Vivier Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- scripts/coccinelle/round.cocci | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/coccinelle/round.cocci (limited to 'scripts/coccinelle') diff --git a/scripts/coccinelle/round.cocci b/scripts/coccinelle/round.cocci new file mode 100644 index 0000000000..ed06773289 --- /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) -- cgit v1.2.3-55-g7522