svn commit: r187251 - head/sys/mips/malta
Stanislav Sedov
stas at FreeBSD.org
Wed Jan 14 15:19:06 PST 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, 14 Jan 2009 22:32:43 +0000 (UTC)
Oleksandr Tymoshenko <gonzo at FreeBSD.org> mentioned:
> Author: gonzo
> Date: Wed Jan 14 22:32:43 2009
> New Revision: 187251
> URL: http://svn.freebsd.org/changeset/base/187251
>
> Log:
> o Simplify code: trade 15 lines of case for one multiplication
>
> Modified:
> head/sys/mips/malta/gt_pci.c
>
> Modified: head/sys/mips/malta/gt_pci.c
> ==============================================================================
> --- head/sys/mips/malta/gt_pci.c Wed Jan 14 22:11:01 2009 (r187250)
> +++ head/sys/mips/malta/gt_pci.c Wed Jan 14 22:32:43 2009 (r187251)
> @@ -457,21 +457,7 @@ gt_pci_write_config(device_t dev, int bu
> * Should we set the mode explicitly during chip
> * Initialization?
> */
> - switch(reg % 4)
> - {
> - case 3:
> - shift = 24;
> - break;
> - case 2:
> - shift = 16;
> - break;
> - case 1:
> - shift = 8;
> - break;
> - default:
> - shift = 0;
> - break;
> - }
> + shift = 8 * (reg & 3);
>
Would it make sense to replace this with
> + shift = (reg & 3) << 3;
to not rely on possible compiler optimizations?
- --
Stanislav Sedov
ST4096-RIPE
-----BEGIN PGP SIGNATURE-----
iEYEARECAAYFAklucFAACgkQK/VZk+smlYHvawCdFWtJKfuX3xBOkQ66BURedB8I
hy0AmgMGQKaqzVS3gIUeOFOLwYB67L93
=BTIx
-----END PGP SIGNATURE-----
!DSPAM:496e7051967003867013891!
More information about the svn-src-all
mailing list