Commit 9636c8c1 authored by Dennis Nienhüser's avatar Dennis Nienhüser
Browse files

Reduce number of comparisons from 2n to 1.5n in average.

parent 35c33f18
......@@ -243,9 +243,12 @@ GeoDataLatLonAltBox GeoDataLatLonAltBox::fromLineString( const GeoDataLineStrin
// Get coordinates and normalize them to the desired range.
const qreal altitude = (it)->altitude();
// Determining the maximum and minimum latitude
if ( altitude > maxAltitude ) maxAltitude = altitude;
if ( altitude < minAltitude ) minAltitude = altitude;
// Determining the maximum and minimum altitude
if ( altitude > maxAltitude ) {
maxAltitude = altitude;
} else if ( altitude < minAltitude ) {
minAltitude = altitude;
}
}
temp.setMinAltitude( minAltitude );
......
......@@ -716,8 +716,11 @@ GeoDataLatLonBox GeoDataLatLonBox::fromLineString( const GeoDataLineString& lin
GeoDataCoordinates::normalizeLonLat( lon, lat );
// Determining the maximum and minimum latitude
if ( lat > north ) north = lat;
if ( lat < south ) south = lat;
if ( lat > north ) {
north = lat;
} else if ( lat < south ) {
south = lat;
}
currentSign = ( lon < 0 ) ? -1 : +1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment