Ignore:
Timestamp:
May 23, 2008, 9:17:19 AM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
6145aa7
Parents:
6c96f4
Message:

Lots of for loops now count in reverse order where it does not matter, some 3 -> NDIM

for(i=0;i<var;i++) is slower than for (i=var;i--;) if the order of the i's is not important (note: i-- is also a value and it stops when on i == 0 automatically)
in builder.cpp there were some remnant 3 actually meant to be NDIM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/helpers.cpp

    r6c96f4 rf75030  
    106106  if (buffer == NULL)
    107107    cout << Verbose(0) << output << endl;
    108   for (i=0;i<size;i++)  // reset
     108  for (i=size;i--;)  // reset
    109109    buffer[i] = i % 2 == 0 ? 'p': 'c';
    110110  buffer[size] = '\0'; // and set length marker on its end
     
    147147  int res = 1;
    148148  int j;
    149   for (j=0;j<n;j++)
     149  for (j=n;j--;)
    150150    res *= base;
    151151  return res;
     
    172172  returnstring[order] = '\0';
    173173  number = digits;
    174   for (int i=order-1;i>=0;i--){
     174  for (int i=order-1;i--;){
    175175    returnstring[i] = '0' + (char)(number % 10);
    176176    number = (int)floor(((double)number / 10.));
Note: See TracChangeset for help on using the changeset viewer.