From: Jan Kiszka <jan.kiszka@web.de>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Correct computation of bytes per pixel from bits per pixel
Date: Wed, 22 Aug 2012 10:02:23 +0200 [thread overview]
Message-ID: <5034920F.7030101@web.de> (raw)
In-Reply-To: <Pine.GSO.4.64.1208212331340.11653@mono>
[-- Attachment #1: Type: text/plain, Size: 1194 bytes --]
Can you use this free space to provide a scenario where the missing
round-up caused a problem?
On 2012-08-21 23:32, BALATON Zoltan wrote:
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
> console.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/console.c b/console.c
> index 4525cc7..f698b77 100644
> --- a/console.c
> +++ b/console.c
> @@ -1612,7 +1612,7 @@ PixelFormat
> qemu_different_endianness_pixelformat(int bpp)
> memset(&pf, 0x00, sizeof(PixelFormat));
>
> pf.bits_per_pixel = bpp;
> - pf.bytes_per_pixel = bpp / 8;
> + pf.bytes_per_pixel = (bpp + 7) >> 3;
Compilers are smart enough to substitute such divisions by shift
operations but for humans the explicit form is easier to read. So please
keep it.
> pf.depth = bpp == 32 ? 24 : bpp;
>
> switch (bpp) {
> @@ -1661,7 +1661,7 @@ PixelFormat qemu_default_pixelformat(int bpp)
> memset(&pf, 0x00, sizeof(PixelFormat));
>
> pf.bits_per_pixel = bpp;
> - pf.bytes_per_pixel = bpp / 8;
> + pf.bytes_per_pixel = (bpp + 7) >> 3;
> pf.depth = bpp == 32 ? 24 : bpp;
>
> switch (bpp) {
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2012-08-22 8:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-21 21:32 [Qemu-devel] [PATCH] Correct computation of bytes per pixel from bits per pixel BALATON Zoltan
2012-08-22 8:02 ` Jan Kiszka [this message]
2012-08-22 8:30 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5034920F.7030101@web.de \
--to=jan.kiszka@web.de \
--cc=balaton@eik.bme.hu \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).