projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e0ca2ed
)
coccinelle: use macro DIV_ROUND_UP instead of (((n) + (d) - 1) /(d))
author
Laurent Vivier
<lvivier@redhat.com>
Tue, 31 May 2016 16:35:50 +0000
(18:35 +0200)
committer
Michael Tokarev
<mjt@tls.msk.ru>
Tue, 7 Jun 2016 15:19:24 +0000
(18:19 +0300)
sample from http://coccinellery.org/
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
scripts/coccinelle/round.cocci
[new file with mode: 0644]
patch
|
blob
diff --git a/scripts/coccinelle/round.cocci
b/scripts/coccinelle/round.cocci
new file mode 100644
(file)
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)