From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T45tp-00053z-1f for qemu-devel@nongnu.org; Wed, 22 Aug 2012 04:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T45tj-0000GT-C9 for qemu-devel@nongnu.org; Wed, 22 Aug 2012 04:02:48 -0400 Message-ID: <5034920F.7030101@web.de> Date: Wed, 22 Aug 2012 10:02:23 +0200 From: Jan Kiszka MIME-Version: 1.0 References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigD6E957840309594CF6512E9D" Subject: Re: [Qemu-devel] [PATCH] Correct computation of bytes per pixel from bits per pixel List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: BALATON Zoltan Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigD6E957840309594CF6512E9D Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: >=20 > Signed-off-by: BALATON Zoltan > --- > console.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > 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)); >=20 > pf.bits_per_pixel =3D bpp; > - pf.bytes_per_pixel =3D bpp / 8; > + pf.bytes_per_pixel =3D (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 =3D bpp =3D=3D 32 ? 24 : bpp; >=20 > switch (bpp) { > @@ -1661,7 +1661,7 @@ PixelFormat qemu_default_pixelformat(int bpp) > memset(&pf, 0x00, sizeof(PixelFormat)); >=20 > pf.bits_per_pixel =3D bpp; > - pf.bytes_per_pixel =3D bpp / 8; > + pf.bytes_per_pixel =3D (bpp + 7) >> 3; > pf.depth =3D bpp =3D=3D 32 ? 24 : bpp; >=20 > switch (bpp) { Jan --------------enigD6E957840309594CF6512E9D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlA0kg8ACgkQitSsb3rl5xQbtwCg3bCVrdy131nK6KuhPv7n3bbp ofUAnRoXqTc3ZQestiRbBVgSRxiCmHx8 =+oBk -----END PGP SIGNATURE----- --------------enigD6E957840309594CF6512E9D--