Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of dgps by
Diff: handle/dataLocation.cpp
- Revision:
- 27:db73f8ac6c75
- Parent:
- 15:e3e03a9df89e
- Child:
- 32:9cb7bc3fc9e0
--- a/handle/dataLocation.cpp Tue Apr 22 14:21:01 2014 +0000 +++ b/handle/dataLocation.cpp Tue Apr 22 14:56:03 2014 +0000 @@ -31,14 +31,18 @@ } void LocHolder::inc(LHType type,int amount,bool abs){ + // Grab current index holder unsigned int& index=getI(type); - index=getRealIndex(type,(abs?0:index),amount);//((abs?0:index)+amount)%getI(type,LHIType_size); - getI(type)=index; + // Set index and make sure the index is valid (not negative or greater than max) + index=getRealIndex(type,(abs?0:index)+amount); } void LocHolder::add(LHType type,DataLocation newLoc){ + // Set the current index to the current size getI(type)=getI(type,LHIType_size); + // Increment size getI(type,LHIType_size)++; + // Assign current index getC(type)=newLoc; }