lkml.org 
[lkml]   [1998]   [Jan]   [27]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 27 Jan 1998 09:10:03 +0100
FromHans-Joachim Widmaier <>
SubjectRe: kernel and egcs
Michael Elizabeth Chastain:
> The code in question looks like this:
> 
> 	/* include/asm-i386/string.h */
> 	switch (n % 4) {
> 		case 0: COMMON(""); return to;
> 		case 1: COMMON("\n\tmovsb"); return to;
> 		case 2: COMMON("\n\tmovsw"); return to;
> 		case 3: COMMON("\n\tmovsw\n\tmovsb"); return to;
> 	}
> 
> The compiler isn't smart enough to figure out that one of the cases
> is always taken.

Why not tell it that one is always taken?

 	switch (n % 4) {
 		case 0:  COMMON(""); return to;
 		case 1:  COMMON("\n\tmovsb"); return to;
 		case 2:  COMMON("\n\tmovsw"); return to;
 		default: COMMON("\n\tmovsw\n\tmovsb"); return to;
 	}
- 
Hans-Joachim Widmaier

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.463 / U:0.030 seconds]
©2003-2008 Jasper Spaans