Optimize encode

This commit is contained in:
Tobias Bieniek
2013-12-19 18:14:10 +01:00
committed by Tom Payne
parent 1d1dbb08c9
commit 432c6d8af3

View File

@@ -270,10 +270,7 @@ ol.format.Polyline.decodeFloat = function(encoded, opt_factor) {
* @return {string} The encoded string.
*/
ol.format.Polyline.encodeSignedInteger = function(num) {
var signedNum = num << 1;
if (num < 0) {
signedNum = ~(signedNum);
}
var signedNum = (num < 0) ? ~(num << 1) : (num << 1);
return ol.format.Polyline.encodeUnsignedInteger(signedNum);
};