summaryrefslogtreecommitdiffstats
path: root/scripts/coccinelle/simplify_muldiv64.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/coccinelle/simplify_muldiv64.cocci')
-rw-r--r--scripts/coccinelle/simplify_muldiv64.cocci11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/coccinelle/simplify_muldiv64.cocci b/scripts/coccinelle/simplify_muldiv64.cocci
new file mode 100644
index 0000000000..3d7c9744aa
--- /dev/null
+++ b/scripts/coccinelle/simplify_muldiv64.cocci
@@ -0,0 +1,11 @@
+// replace muldiv64(i32, i32, x) by (uint64_t)i32 * i32 / x
+@@
+typedef uint32_t;
+typedef int32_t;
+{ uint32_t, int32_t, int, unsigned int } a, b;
+typedef uint64_t;
+expression c;
+@@
+
+-muldiv64(a,b,c)
++(uint64_t) a * b / c