new file mode 100644
@@ -0,0 +1,6 @@
+// replace muldiv64(a, 1, b) by "a / b"
+@@
+expression a, b;
+@@
+-muldiv64(a, 1, b)
++a / b
new file mode 100644
@@ -0,0 +1,46 @@
+// replace muldiv64(i32, i64, x) by muldiv64(i64, i32, x)
+@filter@
+typedef uint64_t;
+typedef int64_t;
+typedef uint32_t;
+typedef int32_t;
+uint64_t u64;
+int64_t s64;
+uint32_t u32;
+int32_t s32;
+int si;
+unsigned int ui;
+long sl;
+unsigned long ul;
+expression b;
+position p;
+@@
+ muldiv64(
+(
+si
+|
+ui
+|
+s32
+|
+u32
+)
+,
+(
+sl
+|
+ul
+|
+u64
+|
+s64
+)
+, b)@p
+
+@swap@
+position filter.p;
+expression a, b, c;
+@@
+
+-muldiv64(a,b,c)@p
++muldiv64(b,a,c)
Signed-off-by: Laurent Vivier <lvivier@redhat.com> --- scripts/coccinelle/remove_muldiv64.cocci | 6 +++++ scripts/coccinelle/swap_muldiv64.cocci | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 scripts/coccinelle/remove_muldiv64.cocci create mode 100644 scripts/coccinelle/swap_muldiv64.cocci