From 432c6d8af36dfe5ed81f4d9e982b9e20aff72360 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Thu, 19 Dec 2013 18:14:10 +0100 Subject: [PATCH] Optimize encode --- src/ol/format/polylineformat.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ol/format/polylineformat.js b/src/ol/format/polylineformat.js index af36338564..a50cef525f 100644 --- a/src/ol/format/polylineformat.js +++ b/src/ol/format/polylineformat.js @@ -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); };