summaryrefslogtreecommitdiffstats
path: root/coccinelle/div-round-up.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'coccinelle/div-round-up.cocci')
-rw-r--r--coccinelle/div-round-up.cocci20
1 files changed, 20 insertions, 0 deletions
diff --git a/coccinelle/div-round-up.cocci b/coccinelle/div-round-up.cocci
new file mode 100644
index 0000000..a0c6df9
--- /dev/null
+++ b/coccinelle/div-round-up.cocci
@@ -0,0 +1,20 @@
+@@
+expression x, y;
+@@
+- ((x + y - 1) / y)
++ DIV_ROUND_UP(x, y)
+@@
+expression x, y;
+@@
+- ((x + (y - 1)) / y)
++ DIV_ROUND_UP(x, y)
+@@
+expression x, y;
+@@
+- (x + y - 1) / y
++ DIV_ROUND_UP(x, y)
+@@
+expression x, y;
+@@
+- (x + (y - 1)) / y
++ DIV_ROUND_UP(x, y)