mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-15 22:21:57 -06:00
coccinelle: use macro DIV_ROUND_UP instead of (((n) + (d) - 1) /(d))
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>
This commit is contained in:
parent
e0ca2ed562
commit
db718b4b15
1 changed files with 19 additions and 0 deletions
19
scripts/coccinelle/round.cocci
Normal file
19
scripts/coccinelle/round.cocci
Normal file
|
@ -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)
|
Loading…
Add table
Add a link
Reference in a new issue