Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8615


Ignore:
Timestamp:
May 26, 2011, 6:01:34 PM (14 years ago)
Author:
landauf
Message:

turns out the mod(x,y) function was fucked up all the time. we need unit tests! also there was a small bug in the shell history. fixed both.

Location:
code/branches/presentation/src/libraries
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/libraries/core/command/Shell.cc

    r8079 r8615  
    265265            return;
    266266
    267         size_t previous_offset = mod(this->historyOffset_ - 1, this->maxHistoryLength_);
     267        size_t previous_offset = mod(static_cast<int>(this->historyOffset_) - 1, this->maxHistoryLength_);
    268268        if (previous_offset < this->commandHistory_.size() && command == this->commandHistory_[previous_offset])
    269269            return;
  • code/branches/presentation/src/libraries/util/Math.h

    r8351 r8615  
    174174            return (x % max);
    175175        else
    176             return ((x % max) + max);
     176        {
     177            T temp = x % max;
     178            return (temp < 0) ? (temp + max) : temp;
     179        }
    177180    }
    178181
Note: See TracChangeset for help on using the changeset viewer.