Skip to content

Commit

Permalink
Fixes issue #198
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisOSRM committed Mar 22, 2012
1 parent bd2c99d commit a558f44
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions DataStructures/NNGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class NNGrid {
unsigned fileIndex = GetFileIndexForLatLon(startCoord.lat, startCoord.lon);
std::vector<_GridEdge> candidates;
boost::unordered_map< unsigned, unsigned, IdenticalHashFunction > cellMap;
for(int j = -32768; j < (32768+1); j+=32768) {
for(int j = -32768; (j < (32768+1)) && (fileIndex != UINT_MAX); j+=32768) {
for(int i = -1; i < 2; ++i){
GetContentsOfFileBucket(fileIndex+i+j, candidates, cellMap);
}
Expand Down Expand Up @@ -497,8 +497,10 @@ class NNGrid {
double x = ( lon + 180.0 ) / 360.0;
double y = ( lat + 180.0 ) / 360.0;

assert( x<=1.0 && x >= 0);
assert( y<=1.0 && y >= 0);
if( x>1.0 || x < 0.)
return UINT_MAX;
if( y>1.0 || y < 0.)
return UINT_MAX;

unsigned line = (32768 * (32768-1))*y;
line = line - (line % 32768);
Expand Down

0 comments on commit a558f44

Please sign in to comment.