Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jan 2009 22:32:43 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r187251 - head/sys/mips/malta
Message-ID:  <200901142232.n0EMWhGw055895@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 
 		switch(bytes)
 		{



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