/[dotgnu-pnet]/pnet/cscc/csharp/cs_stmt.tc
ViewVC logotype

Diff of /pnet/cscc/csharp/cs_stmt.tc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.38 by t3rmin4t0r, Fri Jun 11 11:49:58 2004 UTC revision 1.39 by t3rmin4t0r, Tue Feb 22 08:52:53 2005 UTC
# Line 839  static ILSwitchTableType SwitchTableType Line 839  static ILSwitchTableType SwitchTableType
839    
840          /* If the switch type can fit in a 32-bit integer, and the          /* If the switch type can fit in a 32-bit integer, and the
841             cases fill up at least 80% of the range, then use an             cases fill up at least 80% of the range, then use an
842             indexed table for the switch */             indexed table for the switch. But the calculation is prone
843               to overflow, hence the upper limit check. */
844          type = ILTypeToMachineType(switchType);          type = ILTypeToMachineType(switchType);
845          switch(type)          switch(type)
846          {          {
# Line 852  static ILSwitchTableType SwitchTableType Line 853  static ILSwitchTableType SwitchTableType
853                  {                  {
854                          range = (unsigned long)(values[numValues - 1].value.un.i4Value -                          range = (unsigned long)(values[numValues - 1].value.un.i4Value -
855                                                                          values[0].value.un.i4Value);                                                                          values[0].value.un.i4Value);
856                          if(((range * 80) / 100) <= numValues)                          if(((range * 4) / 5) <= numValues && range < 0x1fffffff)
857                          {                          {
858                                  return ILSwitchTableType_Indexed;                                  return ILSwitchTableType_Indexed;
859                          }                          }
# Line 868  static ILSwitchTableType SwitchTableType Line 869  static ILSwitchTableType SwitchTableType
869                          range = (unsigned long)                          range = (unsigned long)
870                                  (((ILUInt32)(values[numValues - 1].value.un.i4Value)) -                                  (((ILUInt32)(values[numValues - 1].value.un.i4Value)) -
871                                   ((ILUInt32)(values[0].value.un.i4Value)));                                   ((ILUInt32)(values[0].value.un.i4Value)));
872                          if(((range * 80) / 100) <= numValues)                          if(((range * 4) / 5) <= numValues && range < 0x3fffffff)
873                          {                          {
874                                  return ILSwitchTableType_Indexed;                                  return ILSwitchTableType_Indexed;
875                          }                          }

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26