svn commit: r187251 - head/sys/mips/malta

Oleksandr Tymoshenko gonzo at FreeBSD.org
Wed Jan 14 14:32:46 PST 2009


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)
 		{


More information about the svn-src-all mailing list