Optimize encode
This commit is contained in:
committed by
Tom Payne
parent
1d1dbb08c9
commit
432c6d8af3
@@ -270,10 +270,7 @@ ol.format.Polyline.decodeFloat = function(encoded, opt_factor) {
|
|||||||
* @return {string} The encoded string.
|
* @return {string} The encoded string.
|
||||||
*/
|
*/
|
||||||
ol.format.Polyline.encodeSignedInteger = function(num) {
|
ol.format.Polyline.encodeSignedInteger = function(num) {
|
||||||
var signedNum = num << 1;
|
var signedNum = (num < 0) ? ~(num << 1) : (num << 1);
|
||||||
if (num < 0) {
|
|
||||||
signedNum = ~(signedNum);
|
|
||||||
}
|
|
||||||
return ol.format.Polyline.encodeUnsignedInteger(signedNum);
|
return ol.format.Polyline.encodeUnsignedInteger(signedNum);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user