[Qemu-devel] [PATCH v2 16/29] console: use DIV_ROUND_UP

Marc-André Lureau posted 29 patches 8 years, 7 months ago
[Qemu-devel] [PATCH v2 16/29] console: use DIV_ROUND_UP
Posted by Marc-André Lureau 8 years, 7 months ago
I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/ui/console.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 7262bef6d3..8024878bae 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -328,7 +328,7 @@ static inline int surface_bits_per_pixel(DisplaySurface *s)
 static inline int surface_bytes_per_pixel(DisplaySurface *s)
 {
     int bits = PIXMAN_FORMAT_BPP(s->format);
-    return (bits + 7) / 8;
+    return DIV_ROUND_UP(bits, 8);
 }
 
 static inline pixman_format_code_t surface_format(DisplaySurface *s)
-- 
2.13.1.395.gf7b71de06


Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 16/29] console: use DIV_ROUND_UP
Posted by Philippe Mathieu-Daudé 8 years, 7 months ago
On 07/13/2017 01:32 PM, Marc-André Lureau wrote:
> I used the clang-tidy qemu-round check to generate the fix:
> https://github.com/elmarco/clang-tools-extra
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>   include/ui/console.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/ui/console.h b/include/ui/console.h
> index 7262bef6d3..8024878bae 100644
> --- a/include/ui/console.h
> +++ b/include/ui/console.h
> @@ -328,7 +328,7 @@ static inline int surface_bits_per_pixel(DisplaySurface *s)
>   static inline int surface_bytes_per_pixel(DisplaySurface *s)
>   {
>       int bits = PIXMAN_FORMAT_BPP(s->format);
> -    return (bits + 7) / 8;
> +    return DIV_ROUND_UP(bits, 8);
>   }
>   
>   static inline pixman_format_code_t surface_format(DisplaySurface *s)
> 

Re: [Qemu-devel] [PATCH v2 16/29] console: use DIV_ROUND_UP
Posted by Richard Henderson 8 years, 7 months ago
On 07/13/2017 06:32 AM, Marc-André Lureau wrote:
> I used the clang-tidy qemu-round check to generate the fix:
> https://github.com/elmarco/clang-tools-extra
> 
> Signed-off-by: Marc-André Lureau<marcandre.lureau@redhat.com>
> ---
>   include/ui/console.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~