Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jan 2009 02:07:52 +0300
From:      Stanislav Sedov <stas@FreeBSD.org>
To:        Oleksandr Tymoshenko <gonzo@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r187251 - head/sys/mips/malta
Message-ID:  <20090115020752.52566769.stas@FreeBSD.org>
In-Reply-To: <200901142232.n0EMWhGw055895@svn.freebsd.org>
References:  <200901142232.n0EMWhGw055895@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 14 Jan 2009 22:32:43 +0000 (UTC)
Oleksandr Tymoshenko <gonzo@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!





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090115020752.52566769.stas>