This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] Another small tweak to S_construct_pattern


Hi,

the Changelog entry says it all, moreover the code is not less clear.

Tested x86-linux, committed.

Paolo.

/////////////
2003-12-02  Paolo Carlini  <pcarlini@suse.de>

	* config/locale/gnu/monetary_members.cc
	(money_base::_S_construct_pattern): For case 3: and 4:
	exchanging 'if (__precedes)' and 'if (__space)' allows
	to factor out a few more assignments.
diff -prN libstdc++-v3-orig/config/locale/gnu/monetary_members.cc libstdc++-v3/config/locale/gnu/monetary_members.cc
*** libstdc++-v3-orig/config/locale/gnu/monetary_members.cc	Sat Nov 22 19:47:13 2003
--- libstdc++-v3/config/locale/gnu/monetary_members.cc	Mon Dec  1 00:08:37 2003
*************** namespace std
*** 132,209 ****
  	break;
        case 3:
  	// 3 The sign immediately precedes the symbol.
! 	if (__space)
  	  {
! 	    // Have space.
! 	    if (__precedes)
  	      {
- 		__ret.field[0] = sign;
- 		__ret.field[1] = symbol;
  		__ret.field[2] = space;
  		__ret.field[3] = value;
  	      }
  	    else
  	      {
! 		__ret.field[0] = value;
! 		__ret.field[1] = space;
! 		__ret.field[2] = sign;
! 		__ret.field[3] = symbol;
  	      }
  	  }
  	else
  	  {
! 	    // Have none.
! 	    if (__precedes)
  	      {
! 		__ret.field[0] = sign;
! 		__ret.field[1] = symbol;
! 		__ret.field[2] = value;
  	      }
  	    else
  	      {
- 		__ret.field[0] = value;
  		__ret.field[1] = sign;
  		__ret.field[2] = symbol;
  	      }
- 	    __ret.field[3] = none;
  	  }
  	break;
        case 4:
! 	// 4 The sign immediately follows the symbol. 
! 	if (__space)
  	  {
! 	    // Have space.
! 	    if (__precedes)
  	      {
- 		__ret.field[0] = symbol;
- 		__ret.field[1] = sign;
  		__ret.field[2] = space;
  		__ret.field[3] = value;
  	      }
  	    else
  	      {
! 		__ret.field[0] = value;
! 		__ret.field[1] = space;
! 		__ret.field[2] = symbol;
! 		__ret.field[3] = sign;
  	      }
  	  }
  	else
  	  {
! 	    // Have none.
! 	    if (__precedes)
  	      {
! 		__ret.field[0] = symbol;
! 		__ret.field[1] = sign;
! 		__ret.field[2] = value;
  	      }
  	    else
  	      {
- 		__ret.field[0] = value;
  		__ret.field[1] = symbol;
  		__ret.field[2] = sign;
  	      }
- 	    __ret.field[3] = none;
  	  }
  	break;
        default:
--- 132,201 ----
  	break;
        case 3:
  	// 3 The sign immediately precedes the symbol.
! 	if (__precedes)
  	  {
! 	    __ret.field[0] = sign;
! 	    __ret.field[1] = symbol;	    
! 	    if (__space)
  	      {
  		__ret.field[2] = space;
  		__ret.field[3] = value;
  	      }
  	    else
  	      {
! 		__ret.field[2] = value;		
! 		__ret.field[3] = none;
  	      }
  	  }
  	else
  	  {
! 	    __ret.field[0] = value;
! 	    if (__space)
  	      {
! 		__ret.field[1] = space;
! 		__ret.field[2] = sign;
! 		__ret.field[3] = symbol;
  	      }
  	    else
  	      {
  		__ret.field[1] = sign;
  		__ret.field[2] = symbol;
+ 		__ret.field[3] = none;
  	      }
  	  }
  	break;
        case 4:
! 	// 4 The sign immediately follows the symbol.
! 	if (__precedes)
  	  {
! 	    __ret.field[0] = symbol;
! 	    __ret.field[1] = sign;
! 	    if (__space)
  	      {
  		__ret.field[2] = space;
  		__ret.field[3] = value;
  	      }
  	    else
  	      {
! 		__ret.field[2] = value;
! 		__ret.field[3] = none;
  	      }
  	  }
  	else
  	  {
! 	    __ret.field[0] = value;
! 	    if (__space)
  	      {
! 		__ret.field[1] = space;
! 		__ret.field[2] = symbol;
! 		__ret.field[3] = sign;
  	      }
  	    else
  	      {
  		__ret.field[1] = symbol;
  		__ret.field[2] = sign;
+ 		__ret.field[3] = none;
  	      }
  	  }
  	break;
        default:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]