qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/5] coccinelle: replace code with ROUND_UP macr


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 1/5] coccinelle: replace code with ROUND_UP macro
Date: Wed, 7 Jun 2017 16:48:39 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0

On 06/07/2017 02:46 AM, Marc-André Lureau wrote:
> I used a the following coccinelle script:
> 
> @@
> expression e1;
> @@
> - ((e1) + (3)) / (4) * (4)
> + ROUND_UP(e1,4)


Can't you also search for:

@@
expression e1, e2
@@
- ((e1) + (e2 - 1)) / (e2) * (e2)
+ ROUND_UP(e1, e2)

to catch cases where we are rounding by a non-constant?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]